作业帮 > 综合 > 作业

一个LINGO程序的找错~

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/20 16:16:17
一个LINGO程序的找错~
程序代码如下:
model:
sets:
part/1..7/:x,f,cost,ub,lb;
endsets
data:
cost=25 20 20 50 50 10 25;
ub=0.125 0.375 0.125 0.125 1.875 20 0.935;
lb=0.075 0.225 0.075 0.075 1.125 12 0.5625;
enddata
calc:
f(1)=(8721*(-x(3)/(x(1)-x(2)))^(17/20)*(-((131*(x(4)/x(2))^(29/25)*(1-9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50-1)/(x(6)*x(7)))^(1/2))/(50*x(5))+(148257*x(1)*x(3)*(-((131*(x(4)/x(2))^(29/25)*(1-9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50-1)/(x(6)*x(7)))^(1/2))/(1000*x(5)*(x(1)-x(2))^2*(-x(3)/(x(1)-x(2)))^(3/20));
f(2)=(8721*x(1)*((24759*x(4)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(1/2))/(31250*x(2)^2*(x(4)/x(2))^(2/5)) + (3799*x(4)*(x(4)/x(2))^(4/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/(1250*x(2)^2))*(-x(3)/(x(1) - x(2)))^(17/20))/(100*x(5)*x(6)*x(7)*(-((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1)/(x(6)*x(7)))^(1/2)) - (148257*x(1)*x(3)*(-((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1)/(x(6)*x(7)))^(1/2))/(1000*x(5)*(x(1) - x(2))^2*(-x(3)/(x(1) - x(2)))^(3/20));
f(3)=-(148257*x(1)*(-((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1)/(x(6)*x(7)))^(1/2))/(1000*x(5)*(x(1) - x(2))*(-x(3)/(x(1) - x(2)))^(3/20));
f(4)=-(8721*x(1)*((24759*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(1/2))/(31250*x(2)*(x(4)/x(2))^(2/5)) + (3799*(x(4)/x(2))^(4/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/(1250*x(2)))*(-x(3)/(x(1) - x(2)))^(17/20))/(100*x(5)*x(6)*x(7)*(-((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1)/(x(6)*x(7)))^(1/2));
f(5)=-(8721*x(1)*(-x(3)/(x(1) - x(2)))^(17/20)*(-((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1)/(x(6)*x(7)))^(1/2))/(50*x(5)^2);
f(6)=(8721*x(1)*(-x(3)/(x(1) - x(2)))^(17/20)*((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1))/(100*x(5)*x(6)^2*x(7)*(-((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1)/(x(6)*x(7)))^(1/2));
f(7)=(8721*x(1)*(-x(3)/(x(1) - x(2)))^(17/20)*((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1))/(100*x(5)*x(6)*x(7)^2*(-((131*(x(4)/x(2))^(29/25)*(1 - 9/(25*(x(4)/x(2))^(14/25)))^(3/2))/50 - 1)/(x(6)*x(7)))^(1/2));
y=174.42*(x(1)/x(5))*(x(3)/(x(2)-x(1)))^0.85*@sqrt((1-2.62*(1-0.36*(x(4)/x(2))^(-0.56))^1.5*(x(4)/x(2))^1.16)/(x(6)*x(7)));
endcalc
min=100000*(y-1.5)^2+100000/9*@sum(part(i):(diff(i)*x(i)*cost(i))^2); 目标函数;
@for(part:@bnd(lb,x,ub));
@for(part(i):@free(diff(i)));
end
目标函数中diff改为f
很奇怪,把calc段去掉以后程序就可以运行,只是没有可行解.可能我模型建错了
一个LINGO程序的找错~
主要是你calc段里面的问题 具体是什么需要给我表达式看看
问题在于calc是预处理段 就是为你预先算出某些数据而不用你在其它地方算 这个需要你在里面使用的量都是赋值过的 但是你的x没有赋值 所以无法处理
至于为何没有可行解就不知道了 是不是f也需要解除非负限制