概述
用fmincon求解最小值问题(1个目标函数、9个变量、6个线性等式约束),一直都是No feasible solution,不知道本身无解还是什么问题。
x0=[4000;4000;2000;500;100;10;10;10;10];
A=[]; b=[];
Aeq=[-88.840439250000020, 20.679950666666663, -2.158236236666667e+02, -3.601469919166667e+02, -36.694763666666690, 21.462819666666660, -13.261596999999995, 7.477251833333336, -1.023975406666667e+02;
0.012, 0, 0, 0.012, 0.012, 0, 0, 0, 0.012;
0, 0.002, 0.002, 0, 0.004, 0, 0.003, 0.002, 0;
0.016, 0, 0.016, 0.032, 0, 0, 0, 0, 0.016;
0, 0, 0, 0, 0, 0.028, 0.014, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0.032, 0.032]
beq=[4588048.12066667;
171.600000000000;
21.5666666666667;
241.933333333333;
2.10000000000000;
0.600000000000000]
VLB=[0.001;0.001;0.001;0.001;0.001;0.001;0.001;0.001;0.001];
VUB=[6601.833333;4978.305556;4978.305556;5172.684028;2489.152778;34.625;69.25;8.65625;8.65625];
options = optimoptions(@fmincon,'Algorithm','interior-point','MaxIter',5000);
[x,fval,exitflag,output]=fmincon(@Gibbsfun,x0,A,b,Aeq,beq,VLB,VUB,[],options)
%%目标函数为myobjfun
function G=myobjfun(x)
deltaG1=-8.841665127258336e+04; deltaG2=-1.661952727160000e+05;
deltaG3=5.504948170966668e+04; deltaG4=-1.666712325249982e+03;
deltaG5=1.092642304030001e+05; deltaG6=-2.281491138470000e+05;
deltaG7=1.169078584030000e+05; deltaG8=1.087887085851667e+05;
deltaG9=4.941138012599998e+04;
G=x(1)*(deltaG1+8314*log(x(1)/sum(x)*1.2))+x(2)*(deltaG2+8314*log(x(2)/sum(x)*1.2))...
+x(3)*(deltaG3+8314*log(x(3)/sum(x)*1.2))+x(4)*(deltaG4+8314*log(x(4)/sum(x)*1.2))...
+x(5)*(deltaG5+8314*log(x(5)/sum(x)*1.2))+x(6)*(deltaG6+8314*log(x(6)/sum(x)*1.2))...
+x(7)*(deltaG7+8314*log(x(7)/sum(x)*1.2))+x(8)*(deltaG8+8314*log(x(8)/sum(x)*1.2))...
+x(9)*(deltaG9+8314*log(x(9)/sum(x)*1.2))
计算结果如下:
No feasible solution found.
fmincon stopped because the size of the current step is less than
the default value of the step size tolerance but constraints are not
satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x =
1.0e+03 *
4.666024308553983
3.857233354391819
2.387214185792911
0.000001000000005
0.000001000000001
0.015465337002847
0.000001000000003
0.008656249999525
0.006364985001793
fval =
-1.006342210855910e+09
exitflag =
-2
output =
iterations: 70
funcCount: 710
constrviolation: 5.438285104570996e+06
stepsize: 9.313859771460607e-10
algorithm: 'interior-point'
firstorderopt: 0.043644013275751
cgiterations: 76
message: 'No feasible solution found.
最后
以上就是平常小蜜蜂为你收集整理的matlab中stepfun,Matlab中用fmincon求解最小值问题,调试了好多次,一直找不到可行解,求大神指导 - 程序语言 - 小木虫 - 学术 科研 互动社区...的全部内容,希望文章能够帮你解决matlab中stepfun,Matlab中用fmincon求解最小值问题,调试了好多次,一直找不到可行解,求大神指导 - 程序语言 - 小木虫 - 学术 科研 互动社区...所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复