Scipy 线性规划 returns False 表示成功
Scipy Linear Programming returns False for success
我正在从事一个关于交通网络分析的项目。我的网络包含节点、边、自由流动旅行时间、容量等数据。我需要使用 Frank-Wolf 算法找到边(链接)的体积。我在我的代码中使用了 scipy.optimize.linprog;但是,它 returns False 表示成功。
第一个密码是:
result = optimize.linprog(c_0, A_eq=A, b_eq=b) # min(c_0*x) such that: Ax=b
print(result)
result = np.reshape(result['x'], (k, n))
xa = np.sum(result, axis=0) # initial value of xa
print(xa)
第一段代码的输出是:
con: array([ 1.17458269e+04, 1.19588056e+03, -5.99940081e+00, 1.19488066e+03,
1.19388076e+03, -5.99940073e+00, -5.99940082e+00, -7.99920106e+00,
-5.99940082e+00, 9.71902933e+02, 9.95900537e+02, -5.99940081e+00,
1.13188696e+03, 8.89911122e+02, 8.51914917e+02, -5.99940084e+00,
-5.99940084e+00, -3.99960052e+00, 8.13918712e+02, 5.33946673e+02,
5.33946673e+02, 6.91930895e+02, -7.99920110e+00, 6.63933691e+02,
1.19688046e+03, 1.15548460e+04, -5.99940084e+00, 1.13488666e+03,
1.17388276e+03, -5.99940081e+00, -5.99940078e+00, -7.99920111e+00,
-5.99940078e+00, 9.91900936e+02, 1.01589854e+03, -5.99940087e+00,
8.11918912e+02, 8.49915117e+02, 8.41915916e+02, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, 1.17388276e+03, 5.33946673e+02,
6.13938684e+02, 6.01939883e+02, -7.99920113e+00, 5.33946673e+02,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
1.19688046e+03, 1.13588656e+03, -5.99940075e+00, 1.10638950e+04,
1.19388076e+03, -5.99940078e+00, -5.99940081e+00, -7.99920113e+00,
-5.99940081e+00, 9.71902933e+02, 9.65903533e+02, -5.99940081e+00,
8.51914917e+02, 8.09919111e+02, 7.51924903e+02, -5.99940082e+00,
-5.99940085e+00, -3.99960056e+00, 7.23927699e+02, 5.53944676e+02,
5.73942679e+02, 5.31946873e+02, -7.99920109e+00, 7.23927699e+02,
1.19688046e+03, 1.17588256e+03, -5.99940085e+00, 1.19488066e+03,
1.13728642e+04, -5.99940079e+00, -5.99940091e+00, -7.99920121e+00,
-5.99940080e+00, 1.02189794e+03, 8.75912520e+02, -5.99940083e+00,
8.21917913e+02, 7.89921108e+02, 7.31926900e+02, -5.99940082e+00,
-5.99940079e+00, -3.99960055e+00, 6.53934690e+02, 7.23927699e+02,
7.33926701e+02, 8.41915916e+02, -7.99920111e+00, 5.33946673e+02,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
9.76902434e+02, 9.95900537e+02, -5.99940080e+00, 9.74902634e+02,
1.02389774e+03, -5.99940083e+00, -5.99940084e+00, -7.99920109e+00,
-5.99940077e+00, 1.22707745e+04, 1.20587957e+03, -5.99940074e+00,
8.11918912e+02, 8.89911122e+02, 1.19188096e+03, -5.99940081e+00,
-5.99940082e+00, -3.99960054e+00, 1.05389474e+03, 8.53914717e+02,
8.13918712e+02, 8.71912920e+02, -7.99920105e+00, 5.33946673e+02,
9.96900437e+02, 1.01589854e+03, -5.99940085e+00, 9.64903632e+02,
8.73912720e+02, -5.99940082e+00, -5.99940080e+00, -7.99920109e+00,
-5.99940080e+00, 1.20187996e+03, 1.21647851e+04, -5.99940083e+00,
8.41915916e+02, 1.18988116e+03, 1.00189994e+03, -5.99940083e+00,
-5.99940081e+00, -3.99960055e+00, 8.53914717e+02, 6.63933691e+02,
5.43945675e+02, 9.91900936e+02, -7.99920107e+00, 9.43905730e+02,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
1.13688646e+03, 8.15918512e+02, -5.99940082e+00, 8.54914617e+02,
8.23917713e+02, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, 8.11918911e+02, 8.45915516e+02, -5.99940086e+00,
1.04109602e+04, 7.79922107e+02, 7.71922906e+02, -5.99940081e+00,
-5.99940082e+00, -3.99960055e+00, 6.13938684e+02, 5.33946673e+02,
5.53944676e+02, 6.01939883e+02, -7.99920111e+00, 1.19388076e+03,
8.96910423e+02, 8.55914517e+02, -5.99940082e+00, 8.14918612e+02,
7.93920709e+02, -5.99940082e+00, -5.99940083e+00, -7.99920109e+00,
-5.99940083e+00, 8.91910922e+02, 1.19588056e+03, -5.99940083e+00,
7.81921907e+02, 1.19888026e+04, 1.19188096e+03, -5.99940082e+00,
-5.99940083e+00, -3.99960055e+00, 1.02389774e+03, 8.53914717e+02,
7.83921708e+02, 8.11918911e+02, -7.99920111e+00, 1.02389774e+03,
8.56914418e+02, 8.45915516e+02, -5.99940082e+00, 7.54924604e+02,
7.33926701e+02, -5.99940083e+00, -5.99940083e+00, -7.99920112e+00,
-5.99940083e+00, 1.19188096e+03, 1.00589954e+03, -5.99940083e+00,
7.71922906e+02, 1.18988116e+03, 1.28107206e+04, -5.99940081e+00,
-5.99940085e+00, -3.99960055e+00, 1.19388076e+03, 1.14388576e+03,
1.03389674e+03, 1.19188096e+03, -7.99920110e+00, 8.23917713e+02,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
8.16918412e+02, 1.17588256e+03, -5.99940082e+00, 7.24927600e+02,
6.53934690e+02, -5.99940085e+00, -5.99940081e+00, -7.99920107e+00,
-5.99940082e+00, 1.05189494e+03, 8.55914517e+02, -5.99940083e+00,
6.11938884e+02, 1.01989814e+03, 1.19188096e+03, -5.99940082e+00,
-5.99940079e+00, -3.99960055e+00, 1.20927923e+04, 1.19388076e+03,
1.00389974e+03, 9.91900936e+02, -7.99920108e+00, 7.23927699e+02,
5.36946374e+02, 5.35946474e+02, -5.99940082e+00, 5.54944576e+02,
7.23927699e+02, -5.99940082e+00, -5.99940081e+00, -7.99920109e+00,
-5.99940082e+00, 8.51914917e+02, 6.65933491e+02, -5.99940082e+00,
5.31946873e+02, 8.49915117e+02, 1.14188596e+03, -5.99940082e+00,
-5.99940080e+00, -3.99960056e+00, 1.19388076e+03, 1.05929421e+04,
1.19388076e+03, 1.19188096e+03, -7.99920110e+00, 5.43945675e+02,
5.36946374e+02, 6.15938485e+02, -5.99940082e+00, 5.74942579e+02,
7.33926701e+02, -5.99940084e+00, -5.99940083e+00, -7.99920110e+00,
-5.99940082e+00, 8.11918911e+02, 5.45945475e+02, -5.99940081e+00,
5.51944876e+02, 7.79922107e+02, 1.03189694e+03, -5.99940080e+00,
-5.99940081e+00, -3.99960056e+00, 1.00389974e+03, 1.19388076e+03,
1.08429171e+04, 1.19188096e+03, -7.99920113e+00, 1.19388076e+03,
6.96930396e+02, 6.05939483e+02, -5.99940082e+00, 5.34946573e+02,
8.43915716e+02, -5.99940083e+00, -5.99940083e+00, -7.99920109e+00,
-5.99940083e+00, 8.71912920e+02, 9.95900537e+02, -5.99940083e+00,
6.01939883e+02, 8.09919111e+02, 1.19188096e+03, -5.99940081e+00,
-5.99940078e+00, -3.99960055e+00, 9.93900736e+02, 1.19388076e+03,
1.19388076e+03, 1.16308384e+04, -7.99920112e+00, 1.02389774e+03,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
6.66933392e+02, 5.35946474e+02, -5.99940082e+00, 7.24927600e+02,
5.33946673e+02, -5.99940081e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, 5.31946873e+02, 9.45905530e+02, -5.99940082e+00,
1.19188096e+03, 1.01989814e+03, 8.21917913e+02, -5.99940082e+00,
-5.99940086e+00, -3.99960055e+00, 7.23927699e+02, 5.43945675e+02,
1.19388076e+03, 1.02189794e+03, -7.99920107e+00, 1.05329480e+04])
fun: 4381.002675394279
message: 'The algorithm terminated successfully and determined that the problem is infeasible.'
nit: 4
slack: array([], dtype=float64)
status: 2
success: False
x: array([1.33630125, 1.33630125, 0.72363567, ..., 1.25494354, 1.2520338 ,
1.01759439])
[25.2836661 25.2836661 23.87454089 23.85736666 22.92358045 25.21218089
23.77225208 23.82974501 25.39313184 23.82974501 24.83242583 24.49277083
25.37410372 22.90803073 23.68565375 24.81485143 22.88570538 24.25372542
24.45895798 24.68762057 22.92335758 23.92017804 24.27533126 23.11925871
24.58518598 25.23224542 24.60817148 23.14973545 24.26067157 24.60817148
24.59406271 24.6106668 23.6338265 23.75661862 24.24302036 24.72759441
24.39088079 23.6338265 24.60238281 24.71703015 23.86485208 24.78126498
23.29432843 23.86485208 24.04833536 25.12592644 24.26371588 23.24762732
24.39088079 24.33909973 23.87288055 24.01656751 24.04795658 23.70134198
24.30170872 24.30170872 24.23917449 24.64327592 24.07970166 24.34396678
24.67725583 25.12592644 24.32280263 23.60364009 24.23113127 24.21024173
24.40209124 24.3105531 23.75661862 23.63524614 24.42120405 24.17605304
24.42120405 24.36787799 24.23917449]
第二个代码(添加方法:'simplex')为:
result = optimize.linprog(c_0, A_eq=A, b_eq=b, method='simplex') # min(c_0*x) such that: Ax=b
print(result)
result = np.reshape(result['x'], (k, n))
xa = np.sum(result, axis=0) # initial value of xa
print(xa)
第二个代码的输出是:
con: array([9.350e+03, 0.000e+00, 0.000e+00, 0.000e+00, 1.200e+03, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.000e+01, 0.000e+00,
2.400e+02, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 1.000e+01, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 1.036e+04, 0.000e+00, 0.000e+00, 4.000e+01, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.000e+01, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
1.000e+02, 0.000e+00, 0.000e+00, 4.200e+02, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 9.810e+03, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
3.000e+01, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 2.000e+02, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 1.020e+04, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 1.200e+02, 2.400e+02, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 2.000e+01, 0.000e+00, 0.000e+00, 5.000e+01, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 1.025e+04, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 5.200e+02, 5.400e+02, 0.000e+00, 0.000e+00,
0.000e+00, 2.000e+01, 0.000e+00, 9.000e+01, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 1.096e+04, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 1.300e+02, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.900e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 3.000e+01, 0.000e+00,
9.630e+03, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 1.500e+02, 0.000e+00, 0.000e+00, 0.000e+00, 5.800e+02,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.000e+01, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 3.000e+02, 0.000e+00,
0.000e+00, 1.001e+04, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 4.000e+01, 7.900e+02, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 1.000e+01, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 9.970e+03, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 7.800e+02, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 3.600e+02, 0.000e+00, 7.000e+01, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
1.017e+04, 0.000e+00, 4.200e+02, 1.000e+03, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 1.700e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 8.750e+03, 5.600e+02, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 8.000e+01, 0.000e+00, 0.000e+00, 1.600e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 1.031e+04, 0.000e+00, 0.000e+00, 1.900e+02,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 4.000e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 1.200e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 2.100e+02, 1.041e+04, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
6.700e+02, 5.400e+02, 0.000e+00, 7.300e+02, 5.400e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 5.400e+02, 9.500e+02, 0.000e+00,
1.200e+03, 1.030e+03, 8.300e+02, 0.000e+00, 0.000e+00, 0.000e+00,
7.300e+02, 5.500e+02, 1.200e+03, 1.030e+03, 0.000e+00, 1.054e+04])
fun: 202134.0
message: "Phase 1 of the simplex method failed to find a feasible solution. The pseudo-objective function evaluates to 1.6e+05 which exceeds the required tolerance of 1e-09 for a solution to be considered 'close enough' to zero to be a basic solution. Consider increasing the tolerance to be greater than 1.6e+05. If this tolerance is unacceptably large the problem may be infeasible."
nit: 1000
slack: array([], dtype=float64)
status: 2
success: False
x: array([1200., 0., 0., ..., 0., 0., 0.])
[11740. 0. 0. 0. 0. 0. 1740. 9690. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 11940. 0. 1830. 0.
0. 0. 0. 0. 0. 7910. 0. 0. 0. 0.
5050. 0. 0. 0. 0. 7570. 2220. 0. 0. 0.
0. 0. 0. 0. 0. 0. 9650. 3550. 0. 7170.
0. 0. 0. 0. 0. 0. 120. 0. 0. 0.
0. 0. 0. 0. 0.]
对于解决此问题的任何帮助,我将不胜感激。
是关联矩阵导致了问题。
我应该使用这个代码:
incMatrixScipy = nx.incidence_matrix(Graph1, oriented=True)
incMatrixNumPy = incMatrixScipy.todense()
代替此代码:
incMatrixScipy = nx.incidence_matrix(Graph1)
incMatrixNumPy = incMatrixScipy.todense()
我需要添加 oriented=True 来接收正确的关联矩阵,因为我的图是有向的。
我正在从事一个关于交通网络分析的项目。我的网络包含节点、边、自由流动旅行时间、容量等数据。我需要使用 Frank-Wolf 算法找到边(链接)的体积。我在我的代码中使用了 scipy.optimize.linprog;但是,它 returns False 表示成功。
第一个密码是:
result = optimize.linprog(c_0, A_eq=A, b_eq=b) # min(c_0*x) such that: Ax=b
print(result)
result = np.reshape(result['x'], (k, n))
xa = np.sum(result, axis=0) # initial value of xa
print(xa)
第一段代码的输出是:
con: array([ 1.17458269e+04, 1.19588056e+03, -5.99940081e+00, 1.19488066e+03,
1.19388076e+03, -5.99940073e+00, -5.99940082e+00, -7.99920106e+00,
-5.99940082e+00, 9.71902933e+02, 9.95900537e+02, -5.99940081e+00,
1.13188696e+03, 8.89911122e+02, 8.51914917e+02, -5.99940084e+00,
-5.99940084e+00, -3.99960052e+00, 8.13918712e+02, 5.33946673e+02,
5.33946673e+02, 6.91930895e+02, -7.99920110e+00, 6.63933691e+02,
1.19688046e+03, 1.15548460e+04, -5.99940084e+00, 1.13488666e+03,
1.17388276e+03, -5.99940081e+00, -5.99940078e+00, -7.99920111e+00,
-5.99940078e+00, 9.91900936e+02, 1.01589854e+03, -5.99940087e+00,
8.11918912e+02, 8.49915117e+02, 8.41915916e+02, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, 1.17388276e+03, 5.33946673e+02,
6.13938684e+02, 6.01939883e+02, -7.99920113e+00, 5.33946673e+02,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
1.19688046e+03, 1.13588656e+03, -5.99940075e+00, 1.10638950e+04,
1.19388076e+03, -5.99940078e+00, -5.99940081e+00, -7.99920113e+00,
-5.99940081e+00, 9.71902933e+02, 9.65903533e+02, -5.99940081e+00,
8.51914917e+02, 8.09919111e+02, 7.51924903e+02, -5.99940082e+00,
-5.99940085e+00, -3.99960056e+00, 7.23927699e+02, 5.53944676e+02,
5.73942679e+02, 5.31946873e+02, -7.99920109e+00, 7.23927699e+02,
1.19688046e+03, 1.17588256e+03, -5.99940085e+00, 1.19488066e+03,
1.13728642e+04, -5.99940079e+00, -5.99940091e+00, -7.99920121e+00,
-5.99940080e+00, 1.02189794e+03, 8.75912520e+02, -5.99940083e+00,
8.21917913e+02, 7.89921108e+02, 7.31926900e+02, -5.99940082e+00,
-5.99940079e+00, -3.99960055e+00, 6.53934690e+02, 7.23927699e+02,
7.33926701e+02, 8.41915916e+02, -7.99920111e+00, 5.33946673e+02,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
9.76902434e+02, 9.95900537e+02, -5.99940080e+00, 9.74902634e+02,
1.02389774e+03, -5.99940083e+00, -5.99940084e+00, -7.99920109e+00,
-5.99940077e+00, 1.22707745e+04, 1.20587957e+03, -5.99940074e+00,
8.11918912e+02, 8.89911122e+02, 1.19188096e+03, -5.99940081e+00,
-5.99940082e+00, -3.99960054e+00, 1.05389474e+03, 8.53914717e+02,
8.13918712e+02, 8.71912920e+02, -7.99920105e+00, 5.33946673e+02,
9.96900437e+02, 1.01589854e+03, -5.99940085e+00, 9.64903632e+02,
8.73912720e+02, -5.99940082e+00, -5.99940080e+00, -7.99920109e+00,
-5.99940080e+00, 1.20187996e+03, 1.21647851e+04, -5.99940083e+00,
8.41915916e+02, 1.18988116e+03, 1.00189994e+03, -5.99940083e+00,
-5.99940081e+00, -3.99960055e+00, 8.53914717e+02, 6.63933691e+02,
5.43945675e+02, 9.91900936e+02, -7.99920107e+00, 9.43905730e+02,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
1.13688646e+03, 8.15918512e+02, -5.99940082e+00, 8.54914617e+02,
8.23917713e+02, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, 8.11918911e+02, 8.45915516e+02, -5.99940086e+00,
1.04109602e+04, 7.79922107e+02, 7.71922906e+02, -5.99940081e+00,
-5.99940082e+00, -3.99960055e+00, 6.13938684e+02, 5.33946673e+02,
5.53944676e+02, 6.01939883e+02, -7.99920111e+00, 1.19388076e+03,
8.96910423e+02, 8.55914517e+02, -5.99940082e+00, 8.14918612e+02,
7.93920709e+02, -5.99940082e+00, -5.99940083e+00, -7.99920109e+00,
-5.99940083e+00, 8.91910922e+02, 1.19588056e+03, -5.99940083e+00,
7.81921907e+02, 1.19888026e+04, 1.19188096e+03, -5.99940082e+00,
-5.99940083e+00, -3.99960055e+00, 1.02389774e+03, 8.53914717e+02,
7.83921708e+02, 8.11918911e+02, -7.99920111e+00, 1.02389774e+03,
8.56914418e+02, 8.45915516e+02, -5.99940082e+00, 7.54924604e+02,
7.33926701e+02, -5.99940083e+00, -5.99940083e+00, -7.99920112e+00,
-5.99940083e+00, 1.19188096e+03, 1.00589954e+03, -5.99940083e+00,
7.71922906e+02, 1.18988116e+03, 1.28107206e+04, -5.99940081e+00,
-5.99940085e+00, -3.99960055e+00, 1.19388076e+03, 1.14388576e+03,
1.03389674e+03, 1.19188096e+03, -7.99920110e+00, 8.23917713e+02,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
8.16918412e+02, 1.17588256e+03, -5.99940082e+00, 7.24927600e+02,
6.53934690e+02, -5.99940085e+00, -5.99940081e+00, -7.99920107e+00,
-5.99940082e+00, 1.05189494e+03, 8.55914517e+02, -5.99940083e+00,
6.11938884e+02, 1.01989814e+03, 1.19188096e+03, -5.99940082e+00,
-5.99940079e+00, -3.99960055e+00, 1.20927923e+04, 1.19388076e+03,
1.00389974e+03, 9.91900936e+02, -7.99920108e+00, 7.23927699e+02,
5.36946374e+02, 5.35946474e+02, -5.99940082e+00, 5.54944576e+02,
7.23927699e+02, -5.99940082e+00, -5.99940081e+00, -7.99920109e+00,
-5.99940082e+00, 8.51914917e+02, 6.65933491e+02, -5.99940082e+00,
5.31946873e+02, 8.49915117e+02, 1.14188596e+03, -5.99940082e+00,
-5.99940080e+00, -3.99960056e+00, 1.19388076e+03, 1.05929421e+04,
1.19388076e+03, 1.19188096e+03, -7.99920110e+00, 5.43945675e+02,
5.36946374e+02, 6.15938485e+02, -5.99940082e+00, 5.74942579e+02,
7.33926701e+02, -5.99940084e+00, -5.99940083e+00, -7.99920110e+00,
-5.99940082e+00, 8.11918911e+02, 5.45945475e+02, -5.99940081e+00,
5.51944876e+02, 7.79922107e+02, 1.03189694e+03, -5.99940080e+00,
-5.99940081e+00, -3.99960056e+00, 1.00389974e+03, 1.19388076e+03,
1.08429171e+04, 1.19188096e+03, -7.99920113e+00, 1.19388076e+03,
6.96930396e+02, 6.05939483e+02, -5.99940082e+00, 5.34946573e+02,
8.43915716e+02, -5.99940083e+00, -5.99940083e+00, -7.99920109e+00,
-5.99940083e+00, 8.71912920e+02, 9.95900537e+02, -5.99940083e+00,
6.01939883e+02, 8.09919111e+02, 1.19188096e+03, -5.99940081e+00,
-5.99940078e+00, -3.99960055e+00, 9.93900736e+02, 1.19388076e+03,
1.19388076e+03, 1.16308384e+04, -7.99920112e+00, 1.02389774e+03,
-2.99970041e+00, -3.99960055e+00, -5.99940082e+00, -4.99950069e+00,
-5.99940082e+00, -5.99940082e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, -7.99920110e+00, -3.99960055e+00, -5.99940082e+00,
-7.99920110e+00, -9.99900137e+00, -7.99920110e+00, -5.99940082e+00,
-5.99940082e+00, -3.99960055e+00, -5.99940082e+00, -5.99940082e+00,
-5.99940082e+00, -7.99920110e+00, -7.99920110e+00, -5.99940082e+00,
6.66933392e+02, 5.35946474e+02, -5.99940082e+00, 7.24927600e+02,
5.33946673e+02, -5.99940081e+00, -5.99940082e+00, -7.99920110e+00,
-5.99940082e+00, 5.31946873e+02, 9.45905530e+02, -5.99940082e+00,
1.19188096e+03, 1.01989814e+03, 8.21917913e+02, -5.99940082e+00,
-5.99940086e+00, -3.99960055e+00, 7.23927699e+02, 5.43945675e+02,
1.19388076e+03, 1.02189794e+03, -7.99920107e+00, 1.05329480e+04])
fun: 4381.002675394279
message: 'The algorithm terminated successfully and determined that the problem is infeasible.'
nit: 4
slack: array([], dtype=float64)
status: 2
success: False
x: array([1.33630125, 1.33630125, 0.72363567, ..., 1.25494354, 1.2520338 ,
1.01759439])
[25.2836661 25.2836661 23.87454089 23.85736666 22.92358045 25.21218089
23.77225208 23.82974501 25.39313184 23.82974501 24.83242583 24.49277083
25.37410372 22.90803073 23.68565375 24.81485143 22.88570538 24.25372542
24.45895798 24.68762057 22.92335758 23.92017804 24.27533126 23.11925871
24.58518598 25.23224542 24.60817148 23.14973545 24.26067157 24.60817148
24.59406271 24.6106668 23.6338265 23.75661862 24.24302036 24.72759441
24.39088079 23.6338265 24.60238281 24.71703015 23.86485208 24.78126498
23.29432843 23.86485208 24.04833536 25.12592644 24.26371588 23.24762732
24.39088079 24.33909973 23.87288055 24.01656751 24.04795658 23.70134198
24.30170872 24.30170872 24.23917449 24.64327592 24.07970166 24.34396678
24.67725583 25.12592644 24.32280263 23.60364009 24.23113127 24.21024173
24.40209124 24.3105531 23.75661862 23.63524614 24.42120405 24.17605304
24.42120405 24.36787799 24.23917449]
第二个代码(添加方法:'simplex')为:
result = optimize.linprog(c_0, A_eq=A, b_eq=b, method='simplex') # min(c_0*x) such that: Ax=b
print(result)
result = np.reshape(result['x'], (k, n))
xa = np.sum(result, axis=0) # initial value of xa
print(xa)
第二个代码的输出是:
con: array([9.350e+03, 0.000e+00, 0.000e+00, 0.000e+00, 1.200e+03, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.000e+01, 0.000e+00,
2.400e+02, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 1.000e+01, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 1.036e+04, 0.000e+00, 0.000e+00, 4.000e+01, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.000e+01, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
1.000e+02, 0.000e+00, 0.000e+00, 4.200e+02, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 9.810e+03, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
3.000e+01, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 2.000e+02, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 1.020e+04, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 1.200e+02, 2.400e+02, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 2.000e+01, 0.000e+00, 0.000e+00, 5.000e+01, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 1.025e+04, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 5.200e+02, 5.400e+02, 0.000e+00, 0.000e+00,
0.000e+00, 2.000e+01, 0.000e+00, 9.000e+01, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 1.096e+04, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 1.300e+02, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.900e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 3.000e+01, 0.000e+00,
9.630e+03, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 1.500e+02, 0.000e+00, 0.000e+00, 0.000e+00, 5.800e+02,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 2.000e+01, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 3.000e+02, 0.000e+00,
0.000e+00, 1.001e+04, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 4.000e+01, 7.900e+02, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 1.000e+01, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 9.970e+03, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 7.800e+02, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 3.600e+02, 0.000e+00, 7.000e+01, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
1.017e+04, 0.000e+00, 4.200e+02, 1.000e+03, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 1.700e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 8.750e+03, 5.600e+02, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 8.000e+01, 0.000e+00, 0.000e+00, 1.600e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 1.031e+04, 0.000e+00, 0.000e+00, 1.900e+02,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 4.000e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 1.200e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 2.100e+02, 1.041e+04, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
6.700e+02, 5.400e+02, 0.000e+00, 7.300e+02, 5.400e+02, 0.000e+00,
0.000e+00, 0.000e+00, 0.000e+00, 5.400e+02, 9.500e+02, 0.000e+00,
1.200e+03, 1.030e+03, 8.300e+02, 0.000e+00, 0.000e+00, 0.000e+00,
7.300e+02, 5.500e+02, 1.200e+03, 1.030e+03, 0.000e+00, 1.054e+04])
fun: 202134.0
message: "Phase 1 of the simplex method failed to find a feasible solution. The pseudo-objective function evaluates to 1.6e+05 which exceeds the required tolerance of 1e-09 for a solution to be considered 'close enough' to zero to be a basic solution. Consider increasing the tolerance to be greater than 1.6e+05. If this tolerance is unacceptably large the problem may be infeasible."
nit: 1000
slack: array([], dtype=float64)
status: 2
success: False
x: array([1200., 0., 0., ..., 0., 0., 0.])
[11740. 0. 0. 0. 0. 0. 1740. 9690. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 11940. 0. 1830. 0.
0. 0. 0. 0. 0. 7910. 0. 0. 0. 0.
5050. 0. 0. 0. 0. 7570. 2220. 0. 0. 0.
0. 0. 0. 0. 0. 0. 9650. 3550. 0. 7170.
0. 0. 0. 0. 0. 0. 120. 0. 0. 0.
0. 0. 0. 0. 0.]
对于解决此问题的任何帮助,我将不胜感激。
是关联矩阵导致了问题。
我应该使用这个代码:
incMatrixScipy = nx.incidence_matrix(Graph1, oriented=True)
incMatrixNumPy = incMatrixScipy.todense()
代替此代码:
incMatrixScipy = nx.incidence_matrix(Graph1)
incMatrixNumPy = incMatrixScipy.todense()
我需要添加 oriented=True 来接收正确的关联矩阵,因为我的图是有向的。