0

I am trying to solve a problem using linear optimization on matlab

 sum=zeros(5,1);
 for i=1:5
    min 2x1+3x2-5x3
    s.t.
      x1 <= 4;
      x2+3x3 <= 2;
      sum(1:i) >= 3

    sol=linprog(fill them)
    sum(i) = sum(i)+sol(2)-sol(3)
 end

How can I represent sum(i) in the matrices we use in linprog function?

1 Answer 1

1

The fact that x4 and x5 do not appear explicitly in the objective function does not necessarily mean they do not exist.
Think about this objective function

min 2*x1 + 3*x2 - 5*x3 + 0*x4 + 0*x5

Now you have a linear program with 5 variables.

Bottom line: just add two zeros to your objective function and you are done.

Sign up to request clarification or add additional context in comments.

Comments

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.