# Find an optimal solution for a linear system with two inequations

3 views (last 30 days)
Hello expert i have a function that i have to maximize, and i don't i have much information about algorithm that i should use , i used the MILP but it doesn’t work well .
The function : Max (x1+x2)
Contraints : 150x1+200x2 <= 164
X1+x2 <= 2
X1 and x2 are binary
I will be very grateful if you can help me

James Tursa on 7 Jun 2019
What does "x1 and x2 are binary" mean? Do you mean they are both integers?
Imane hammou ouali on 8 Jun 2019
x1 and x2 takes just 0 or 1

Walter Roberson on 8 Jun 2019
intlinprog([-1 -1], 1:2, [150 200;1 1], [164;2],[],[],[0 0],[1 1])

#### 1 Comment

Imane hammou ouali on 8 Jun 2019
Thank you for your help now it works well !!

James Tursa on 8 Jun 2019
Edited: James Tursa on 8 Jun 2019
The way you have this problem posed, and assuming by "binary" you mean integer, it can be solved by simple inspection. The max value is simply 2 and can be achieved in many ways. E.g., x1 = 5 and x2 = -3. Maybe there is something missing in your problem statement? Or maybe by "binary" you really did mean just 0 or 1 values?

#### 1 Comment

Imane hammou ouali on 8 Jun 2019
thanks for responding
in my problem x1 and x2 takes just 0 or 1