1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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)
    >>beq=0

    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
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?



Similar Discussions: MATLAB function to solve LP relaxation
Loading...