0

How to solve the linear programming maximization problem that contains both <= and >= equations?

For example here's a case:

Maximize:

z = c1x1 + c2x2 + c3x3

Subject to:

a1x1 + a2x2 + a3x3 <= b1
a4x1 + a5x2 + a6x3 <= b2
x1 >= d1
x2 >= d2
x3 >= d3

Where a1, a2, a3, a4, a5, a6, b1, b2, b3, c1, c2, c3 are the constants in the given equations.

What will be the proper Matlab code to solve this problem?

1 Answer 1

1

That's how :

    z = -[c1 ; c2 ; c3];

    A = [ a1 a2 a3 ; 
          a4 a5 a6]; 

    b=[b1;
       b2];

    Aeq= [ ]; beq= [ ];

    LB = [d1 ; d2 ; d3]; 

    UB = [1 ; 1 ; 1]* inf; % Any relax number

    x = linprog(z, A, b, Aeq, beq, LB, UB)
Sign up to request clarification or add additional context in comments.

7 Comments

Thanks @Sardar_Usama, How can I get the value of z using matlab?
By putting the values of constants c1 , c2 and c3
Do I have to calculate it manually or is there any built-in function to do that?
What exactly are you asking?
if you're asking for the value of this: z = c1x1 + c2x2 + c3x3 , it doesn't mean anything since x1,x2 andx3 are decision variables. You can find the value of z by putting the different values of these variables and constants c1,c2 and c3. And if you want to find the maximum value of z, it is already given in the code.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.