MATH 441 Section 201
Some sample inputs for LINDO and/or LINGO
Online Course Material 
  • Linear Programming has fairly wide applicability and so in a first course it is also nice to see some software that can assist you in solving quite large LP's. The windows interface is quite friendly (you should have used the old packages!) and you will discover that everything runs extremely quickly. The sensitivity analysis is readily available and performs many of the standard computations. We get dual variables given to us. You will quickly discover that the value of the dual prices is not in providing some computational aid to solve some related LP's (which could be done with alarming speed from scratch by LINDO) but to provide some predictive power and aid analysis of the model.

  • New Forest problem (from Chvatal)
    max 204x10+287x11a+215x11b+228x12+293x13
    +148x20+201x21a+135x21b+148x22+212x23
    +112x30+157x31a+85x31b+98x32+162x33
    +371x40+487x41a+415x41b
    +264x50+337x51a+265x51b
    +61x60+87x61a+15x61b
    subject to
    hivolhd)x10+x11a+x11b+x12+x13=2754
    mdvolhd)x20+x21a+x21b+x22+x23=850
    lovolhd)x30+x31a+x31b+x32+x33=855
    conifhi)x40+x41a+x41b=1598
    mixedhi)x50+x51a+x51b=405
    barelnd)x60+x61a+x61b=1761
    confier)x11a+x21a+x31a+x41a+x51a+x61a+x40<3845
    treatmnt)x11a+x11b+x12+x13+x21a+x21b+x22+x23
    +x31a+x31b+x32+x33+x41a+x41b+x51a+x51b+x61a+x61b<5000
    felledhd)2000x11a+2000x11b+2000x12+2000x13
    +1200x21a+1200x21b+1200x22+1200x23
    +700x31a+700x31b+700x32+700x33<2440000
    felledcm)4000x41a+4000x41b+2500x51a+2500x51b<4160000
    x12<357
    x22<197
    x32<39
    x13<500
    x23<130
    x33<170
    x11b+x21b+x31b+x41b+x51b+x61b>500
    end

    Slick Oil (written up by Robert Israel)
    max 3.5c1o+2.6c2o+1.8r1sr+2.1r2sr
    +2.5r1hfo+2.7r2hfo-8.8ogm6-5.2olfm6
    -.8r1gm6-.8r1lfm6-.3c1r1-.25c2r1
    -.15c2t2-.4tr1-1.4c1l-1.6c2l
    -1.7c1h-2.1c2h-2.2c1r2-1.7c2r2
    -.3r1gm3-.3r1lfm3-.3r1hfm3
    -.25r2gm3-.25r2lfm3-.25r2hfm3
    -.4r1gm4-.4r1lfm4-.4r1hfm4
    -.3r2gm4-.3r2lfm4-.3r2hfm4
    st
    c1prod)c1o+c1r1+c1r2<30000
    c2prod)c2r1+c2t2<50000
    c2r1pipe)c2r1<9000
    c2r2pipe)c2t2<44000
    termbal)tr1+c2o+c2r2-c2t2=0
    r1cap)c1r1+c2r1+tr1<40000
    c1r1proc)c1l+c1h-c1r1=0
    c2r1proc)c2l+c2h-c2r1-tr1=0
    hgcap)c1h+1.4c2h<25000
    r1gprod)r1g-.49c1l-.35c2l-.67c1h-.59c2h=0
    r1lfprod)r1lf-.15c1l-.14c2l-.19c1h-.18c2h=0
    r1hfprod)r1hf-.29c1l-.4c2l-.1c1h-.15c2h=0
    r1srprod)r1sr-.07c1l-.1c2l-.03c1h-.06c2h=0
    r2cap)c1r2+c2r2<20000
    r2gprod)r2g-.54c1r2-.39c2r2=0
    r2lfprod)r2lf-.14c1r2-.16c2r2=0
    r2hfprod)r2hf-.25c1r2-.35c2r2=0
    r2srprod)r2sr-.06c1r2-.08c2r2=0
    r1gdist)r1gm3+r1gm4+r1gm6-r1g<-13100
    r1lfdist)r1lfm3+r1lfm4+r1lfm6-r1lf<-3900
    r1hfist)r1hfm3+r1hfm4+r1hfo-r1hf<-4200
    r2gdist)r2gm3+r2gm4-r2g<-6800
    r2lfdist)r2lfm3+r2lfm4-r2lf<-2600
    r2hfdist)r2hfm3+r2hfm4+r2hfo-r2hf<-3800
    maxr1hfo)r1hfo<6000
    maxr2hfo)r2hfo<2000
    m3gas)r1gm3+r2gm3=6100
    m3lf)r1lfm3+r2lfm3=2200
    m3hf)r1hfm3+r2hfm3=3200
    m4gas)r1gm4+r2gm4=4200
    m4lf)r1lfm4+r2lfm4=900
    m4hf)r1hfm4+r2hfm4=800
    m6gas)r1gm6+ogm6=1800
    m6lf)r1lfm6+olfm6=400
    end





    LINGO MODEL for Hiring/Firing Problem:
    !xi=production in month i (not on overtime) so that the number of workers is xi/20;
    !yi=overtime production in month i;
    !zi=inventory carried forward from month i to month i+1;
    !t_i=hiring/firing costs in month i;

    Sets:
    months / JAN..DEC/: demand, x, y, z, t;
    endsets

    [objective] Min=@sum( months(j) : 20*y(j)+8*z(j)+t(j) );

    [lastyear] xprev=290;
    [janbalance] 20*x(1)+y(1)-z(1)=demand(1);
    @for(months(j) | j #GE# 2 : [balance] z(j-1)+20*x(j)+y(j)-z(j)=demand(j));
    [decinventory] z(12)=0;
    @for(months(j) : [overtime] y(j)<6*x(j) );
    [hirejan]x(1)-xprev<=40;
    @for(months(j) | j #GE# 2: [maxhire] x(j)-x(j-1)<=40 );
    [firejan]xprev-x(1)<=40;
    @for(months(j) | j #GE# 2: [maxfire] x(j-1)-x(j)<=40 );
    [hirecstj]hirecst*x(1)-hirecst*xprev<=t(1);
    @for(months(j) | j #GE# 2: [hirecost] hirecst*x(j)-hirecst*x(j-1)-t(j)<=0 );
    [firecstj]firecst*xprev-firecst*x(1)<=t(1);
    @for(months(j) | j #GE# 2: [firecost] firecst*x(j-1)-firecst*x(j)-t(j)<=0 );
    @for(months(j) : @gin(x));
    @for(months(j) : @gin(y));


    Data:
    demand = 5300 5100 4400 2800 4100 4800 6000 7100 7300 7800 7600 6400;
    hirecst=300;
    firecst=6000;
    enddata

    end

    Various assignments and the course project will require the computer. You have been given a course account on the PC system and a printing allotment of 35 pages. You can always email files to your home account for printing or if need be you can purchase extra page allotments (I'll check how to do this).

    To sign on remember that the id is all in lower case but the password starts with a capital S not lower case s.

    To run LINDO either select the shortcut icon for LINDO or select LINDO among the programs available from the START button. Here is a sample program to run:

    max 5100c+5000r
    subject to
    c+r<100
    200c+100r<12000
    50c+120r<13000
    end
    gin 2

    Now you can copy this and enter this into the untitled window that pops up when you start LINDO. Now select SOLVE from the menu at the top of the LINDO screen to get the familiar optimal solution with c=20 and r=80. The reports window will have the solution. Now hunt around to try some of the other buttons such as WINDOW to return to the untitled window with the formulation and REPORT to send a copy of the formulation to the reports window. You might try printing the reports window at this stage. In assignment 2, you must edit the report window so that it contains the relevant information (input and output) and you can, if you wish, enter comments. You should add your name at the top of a printout for easy retrieval from the printer. Might as well save an great deal of your work. You can always email files to a home computer for printing.