mathematica线性规划问题,其约束条件变量值二取一,如何实现?a = {{0,500,1000,300,400,1500},{1500,0,250,630,360,1140},{400,510,0,460,320,490},{300,600,810,0,820,310},{400,100,420,730,0,970},{350,1020,260,580,380,0}};d = {{0,945,605,46
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 07:24:09
mathematica线性规划问题,其约束条件变量值二取一,如何实现?a = {{0,500,1000,300,400,1500},{1500,0,250,630,360,1140},{400,510,0,460,320,490},{300,600,810,0,820,310},{400,100,420,730,0,970},{350,1020,260,580,380,0}};d = {{0,945,605,46
mathematica线性规划问题,其约束条件变量值二取一,如何实现?
a = {{0,500,1000,300,400,1500},{1500,0,250,630,360,
1140},{400,510,0,460,320,490},{300,600,810,0,820,
310},{400,100,420,730,0,970},{350,1020,260,580,380,0}};
d = {{0,945,605,4667,4749,4394},{945,0,866,3726,3806,
3448},{605,866,0,4471,4541,4152},{4667,3726,4471,0,109,
415},{4749,3806,4541,109,0,431},{4394,3448,4152,415,
431,0}};
Do[
Do[
{Md = Minimize[
Sum[Sum[(a[[i,j]] +
a[[j,i]]) (.8 d[[x,y]] Boole[z[i] = z[j]] +
d[[i,z[i]]] + d[[j,z[j]]]),
{j,1,6}],
{i,1,6}],
{z[1] \[Element] {x,y},z[2] \[Element] {x,y},
z[3] \[Element] {x,y},z[4] \[Element] {x,y},
z[5] \[Element] {x,y},z[6] \[Element] {x,y}},
{z[1],z[2],z[3],z[4],z[5],z[6]}],
Print["枢纽城市为:",x,"-----",y],
Print["最小吨公里数:",Md]},
{y,x + 1,6,1}],
{x,1,5,1}]
这段程序该如何修改?其中 \[Element] 表示属于的意思.
或者在lingo中如何实现?
mathematica线性规划问题,其约束条件变量值二取一,如何实现?a = {{0,500,1000,300,400,1500},{1500,0,250,630,360,1140},{400,510,0,460,320,490},{300,600,810,0,820,310},{400,100,420,730,0,970},{350,1020,260,580,380,0}};d = {{0,945,605,46
这个真简单!哈哈