数学建模社区-数学中国

标题: matlab优化问题 [打印本页]

作者: simonsnow    时间: 2015-7-23 20:43
标题: matlab优化问题
本帖最后由 simonsnow 于 2015-7-23 22:28 编辑

这个问题用matlab怎么解啊,大神路过麻烦帮下忙,提供一下思路也好,谢谢啦
360反馈意见截图16341022282553.png


作者: shengshengchina    时间: 2015-7-23 20:43
再发一遍

lingo程序:

sets:
a/1..4/:x,c;
aa(a,a):  Q;
endsets
data:
c=6 8 4 2;
Q=-1 2 0 0
2 -1 2 0
0 2 -1 2
0 0 2 -1;
enddata
max=@sum(a:c*x)+1/2*@sum(a(j):x(j)*@sum(a(i):x(i)*Q(i,j)));
x(1)*x(2)+x(3)*x(4)>-1;
x(1)*x(2)+x(3)*x(4)<1;
@sum(a:x)>-3;
@sum(a:x)<2;
@for(a :  @free(x);@bnd(-1,x,1));

结果:
  Global optimal solution found.
   Objective value:                              16.33333
   Objective bound:                              16.33334
   Infeasibilities:                              0.000000
   Extended solver steps:                              11
   Total solver iterations:                           706


                        Variable           Value        Reduced Cost
                           X( 1)        1.000000           -3.000000
                           X( 2)        1.000000           -6.333333
                           X( 3)       0.6666667            0.000000
                           X( 4)      -0.6666667            0.000000

作者: shengshengchina    时间: 2015-7-24 16:34
lingo程序:

sets:
a/1..4/:x,c;
aa(a,a);
endsets
data:
c=6 8 4 2;
Q=-1 2 0 0
2 -1 2 0
0 2 -1 2
0 0 2 -1;
enddata
max=@sum(a:c*x)+1/2*@sum(a(j):x(j)*@sum(a(i):x(i)*Q(i,j)));
x(1)*x(2)+x(3)*x(4)>-1;
x(1)*x(2)+x(3)*x(4)<1;
@sum(a:x)>-3;
@sum(a:x)<2;
@for(afree(x);@bnd(-1,x,1));

结果:
  Global optimal solution found.
  Objective value:                              16.33333
  Objective bound:                              16.33334
  Infeasibilities:                              0.000000
  Extended solver steps:                              11
  Total solver iterations:                           706


                       Variable           Value        Reduced Cost
                          X( 1)        1.000000           -3.000000
                          X( 2)        1.000000           -6.333333
                          X( 3)       0.6666667            0.000000
                          X( 4)      -0.6666667            0.000000

作者: simonsnow    时间: 2015-7-25 11:05
shengshengchina 发表于 2015-7-24 16:37
再发一遍

lingo程序:

x1-x4只能是-1或1,下面有条件限制。。。而且我用lingo解出来了,值是16,不知道怎么用matlab来解,不过还是谢谢你,先给你采纳了,你会用matlab解吗





欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5