自己写的一个lingo程序解决二次规划的问题为何得不到正确答案model:data:w=@file('size.txt');h=@file('size.txt');wnew=@file('size.txt');hnew=@file('size.txt');tn=@file('size.txt');pn=@file('size.txt');enddatasets:xy/1..2/;index/1
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/09 00:49:45
自己写的一个lingo程序解决二次规划的问题为何得不到正确答案model:data:w=@file('size.txt');h=@file('size.txt');wnew=@file('size.txt');hnew=@file('size.txt');tn=@file('size.txt');pn=@file('size.txt');enddatasets:xy/1..2/;index/1
自己写的一个lingo程序解决二次规划的问题为何得不到正确答案
model:
data:
w=@file('size.txt');
h=@file('size.txt');
wnew=@file('size.txt');
hnew=@file('size.txt');
tn=@file('size.txt');
pn=@file('size.txt');
enddata
sets:
xy/1..2/;
index/1..3/;
rows/1..6/;
cols/1..6/;
tnum/1..tn/;
pnum/1..pn/;
S(tnum):sa;
M(tnum,rows,cols):matrix;
Tr(tnum,cols):tr_index;
coordinate(pnum,xy):points,newcoord;
endsets
data:
sa=@file('data.txt');
points=@file('data.txt');
matrix=@file('data.txt');
tr_index=@file('data.txt');
newcoord=1.0,1.0,244.000000,1.0,244.000000,231.000000,1.0,231.000000,1.0,244.000000,1.0,231.000000,1.0,1.0,1.0,1.0,1.0,244.000000,244.000000,244.000000,1.0,231.000000,1.0,1.0,1.0,1.0,244.000000,1.0,244.000000,244.000000,244.000000,;
@text('newcoord.txt')=newcoord;
enddata
init:
newcoord=@file('init.txt');
endinit
目标函数;
min=@sum(tnum(I):sa(I)*@sum(rows(J):(@sum(cols(K):matrix(I,J,K)*newcoord(tr_index(I,J),K-@floor((K-1)/2)*2)))^2));
取值约束;
@for(coordinate(U,V)|V #eq# 1:@bnd(1,newcoord(U,V),hnew)); 限制L≤x≤U;
@for(coordinate(U,V)|V #eq# 2:@bnd(1,newcoord(U,V),wnew)); 限制L≤x≤U;
边界约束;
相对位置约束;
@for(coordinate(P,Q):@for(coordinate(T,Y)|(Q #eq# Y) #and# (points(P,Q) #lt# points(T,Y)):newcoord(P,Q)+1
自己写的一个lingo程序解决二次规划的问题为何得不到正确答案model:data:w=@file('size.txt');h=@file('size.txt');wnew=@file('size.txt');hnew=@file('size.txt');tn=@file('size.txt');pn=@file('size.txt');enddatasets:xy/1..2/;index/1
先别说你运行结果对不对 你这个问题能运行吗 如果不能运行怎么可能对