Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: MATLAB function to solve LP relaxation

  1. Oct 27, 2008 #1
    1. The problem statement, all variables and given/known data
    Use MATLAB to solve the LP Relaxation for the following integer problem:

    max f=2x + 3y
    s.t. 195x + 273y ≤ 1365
    4x + 40y ≤ 140
    x ≤ 4
    x,y ≥ 0
    x,y are integers

    2. Relevant equations
    So far I've only used MATLAB for very simple integer problems. For this particular case I'm having trouble using the right MATLAB function to get the right result.

    3. The attempt at a solution
    I pretty much used the same MATLAB function I've used in other questions I've done, which is:

    >> f = [2,3]
    >> A = [195 273; 4 40; 1 0]
    >> b = [1365; 140; 4]
    >> LB = [0; 0; 0]
    >> [X,FVAL] = linprog(-f,A,b,[],[],LB)

    Which resulted in:
    ??? Undefined function or variable 'linprog'.

    This is the first time this has happened to me. I have only just started using matlab, so please forgive me for not knowing much. I've tried looking through books and sites for some help but have found it hard to find anything relevant or understandable to me.

    I've found examples in books with thing like:
    >> Aeq=zeros(1,3)

    But not sure how thiese sort of thing relate to this particular problem. If anyone knows how to use MATLAB to solve this sort of problem any help would be much appreciated. Thank you in advance.
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted