How to solve the min-max problem with mixed integer linear programming(MILP)?
Show older comments
I am trying to solve the MILP problem by referring to the page below.
https://jp.mathworks.com/help/optim/ug/mixed-integer-linear-programming-basics-problem-based.html?lang=en
The problem I want to solve is that the objective function is represented by min-max.
However, I understand that the "optimproblem function" that creates an optimization problem only supports maximization and minimization, not min-max.
https://jp.mathworks.com/help/optim/ug/optimproblem.html?lang=en
So, please tell me how to solve the min-max problem.
thanks in advance.
3 Comments
Alan Weiss
on 17 Aug 2021
I do not understand what you mean that you are trying to solve a MILP problem using min-max. MILP by definition has a linear objective function. I do not understand where you can put a linear objective function into a min-max framework.
Can you please write out exactly what you are trying to do in a brief mathematical description? Something like:
Alan Weiss
MATLAB mathematical toolbox documentation
keisuke maesako
on 18 Aug 2021
Sadia Tasnim
on 2 Feb 2024
Moved: Matt J
on 2 Feb 2024
How did you solve your problem? I am facing the similar challange as you described here.
Answers (1)
Eliminate the inner max problem by rewriting it as,

7 Comments
Sadia Tasnim
on 2 Feb 2024
how to solve minimize z after that? Is there any tool in matlab?
Sadia Tasnim
on 2 Feb 2024
Edited: Sadia Tasnim
on 2 Feb 2024
thank you so much for your kind response. I am new to this expression and also learning optimization recently. can you please help me figure out how to code this kinda min max z expression in matlab?
The following is my sample code. I wanted to minimize the maximum of z under nonlinear constarints but cannot figure out how to make matlab understand:
clc; clear; close all;
rowx = 2; colx = 2;
x = optimvar("x",rowx,colx,"LowerBound",0,"UpperBound",2);
rowy = 3; coly = 3;
%x = optimvar(name,n) creates an n-by-1 vector of optimization variables.
y = optimvar("y",rowy,coly,"Type", "integer", "LowerBound",0,"UpperBound",1);
z = optimvar("z","UpperBound",1);
obj = [];
prob = optimproblem('Objective',obj);
prob.Constraints.cons1 = sum(y) == ones(1,coly);
count = 0;
for i = 1:rowx
for j = 1:colx
count = count+1;
prob.Constraints.(['cons', num2str(1+count)]) = z >= (sin(x(i,j)))^2 + y(1)^2/4-(x(i,j)+x(i,j)-x(i,j)/5)^2+exp(y(2));
end
end
for i = 1:rowx
for j = 1:colx
x0.x(i,j) = abs(randn(1,1));
end
end
for i = 1:rowy
for j = 1:coly
x0.y(i,j) = 0;
end
end
for i = 1:coly
x0.y(randi(rowy),i)= 1;
end
x0.z = 0.59;
show(prob)
[sol,fval] = solve(prob,x0)
I also understand that my code is just finding points that meets the constraints only rather than minimizing it.
Matt J
on 2 Feb 2024
I wanted to minimize the maximum of z under nonlinear constarints but cannot figure out how to make matlab understand:
The OP had no nonlinear constraints, and our advice was based on that.You do not have a similar problem.
You mean that you want to add
prob.Objective = z;
to your problem formulation ?
The code gives a result, but I wonder why because you try to access y(1) and y(2) although you define y as a 3x3 matrix.
Sadia Tasnim
on 3 Feb 2024
Edited: Sadia Tasnim
on 3 Feb 2024
Categories
Find more on Choose a Solver in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

