Using "fminimax" in Matlab to solve the Max-Min programming problem
3 次查看(过去 30 天)
显示 更早的评论
Consider the following function defined in the following picture.
Define a finite set of points as follows:
I want to solve the following programing problem:
My idea is the following:
This programing is the first step of a general programing I am studying at. So it should not give trivial solution like 0 or something like this. However, when I attempted it in Matlab, the solution is not desirable.
The following is my code:
fun = @(x)[-log(max(1,0.1037))+x(1)*log(abs(poly1(0.1037)))+x(2)*log(abs(poly2(0.1037)))...
+x(3)*log(abs(poly3(0.1037)))+...
x(4)*log(abs(poly4(0.1037)));
-log(max(1,0.0259))+x(1)*log(abs(poly1(0.0259)))+x(2)*log(abs(poly2(0.0259)))...
+x(3)*log(abs(poly3(0.0259)))+...
x(4)*log(abs(poly4(0.0259)));
-log(max(1,0.2288))+x(1)*log(abs(poly1(0.2288)))+x(2)*log(abs(poly2(0.2288)))...
+x(3)*log(abs(poly3(0.2288)))+...
x(4)*log(abs(poly4(0.2288)));
-log(max(1,0.0938))+x(1)*log(abs(poly1(0.0938)))+x(2)*log(abs(poly2(0.0938)))...
+x(3)*log(abs(poly3(0.0938)))+...
x(4)*log(abs(poly4(0.0938)));
-log(max(1,0.0917))+x(1)*log(abs(poly1(0.0917)))+x(2)*log(abs(poly2(0.0917)))...
+x(3)*log(abs(poly3(0.0917)))+...
x(4)*log(abs(poly4(0.0917)));
-log(max(1,0.2386))+x(1)*log(abs(poly1(0.2386)))+x(2)*log(abs(poly2(0.2386)))...
+x(3)*log(abs(poly3(0.2386)))+...
x(4)*log(abs(poly4(0.2386)));
-log(max(1,0.2003))+x(1)*log(abs(poly1(0.2003)))+x(2)*log(abs(poly2(0.2003)))...
+x(3)*log(abs(poly3(0.2003)))+...
x(4)*log(abs(poly4(0.2003)));];
A= [];
b= [];
Aeq = [];
beq = [];
x0 = [0,0,0,0];
lb = [0,0,0,0];
up = [1000,1000,1000,1000];
[x,fval] = fminimax(fun,x0,A,b,Aeq,beq,lb,ub)
where in the code:
The solution that Matlab provides is the following:
I don't quite understand why this happens. Is there anything wrong in my idea or code? Thank you so much for your help!
0 个评论
采纳的回答
Torsten
2022-4-24
编辑:Torsten
2022-4-24
Yes, [0 0 0 0] is the correct solution to your problem.
For all other c vectors >= 0, min g(x,c) would be negative.
Since your problem is linear in the c's, here is an easier way to solve your problem:
poly1=@(x)x.^2-x-1;
poly2=@(x)x.^4-x.^3-3*x.^2+x+1;
poly3=@(x)x.^8-x.^7-7*x.^6+4*x.^5+13*x.^4-4*x.^3-7*x.^2+x+1;
poly4=@(x)x.^3+x.^2-2*x-1;
X = [0.1037;0.0259;0.2288;0.0938;0.0917;0.2386;0.2003];
A = [log(abs(poly1(X))),log(abs(poly2(X))),log(abs(poly3(X))),log(abs(poly4(X))),ones(numel(X),1)] b = zeros(numel(X),1);
f = [0 0 0 0 -1].';
lb = [0 0 0 0 -Inf].';
ub = [1000 1000 1000 1000 Inf].';
c = linprog(f,A,b,[],[],lb,ub)
3 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!