Revised algebra exploiting optimization example

Top  Previous  Next

The optimization example is as follows

eq003

This is a special case of the general resource allocation problem that can be written as

         eq004

where

 j =                {        corn                wheat        cotton        }

 i =                {        land                labor        }

 xj =                {        Xcorn        Xwheat        Xcotton        }

 cj =                {        109        90                115        }

 aij =                        1                        1                        1        

                         6                        4                        8

 bi =                {        100                500                }'

 

Such a model can be cast in GAMS as (optalgebra.gms)

 

SET        j          /Corn,Wheat,Cotton/

           i          /Land ,Labor/;

PARAMETER

  c(j)         / corn     109    ,wheat   90 ,cotton    115/

  b(i)         /land 100 ,labor 500/;

TABLE a(i,j)

            corn    wheat    cotton

land          1        1        1

labor         6        4        8      ;

POSITIVE VARIABLES    x(j);

VARIABLES                    PROFIT             ;

EQUATIONS                 OBJective          ,  

                          constraint(i) ;

OBJective..         PROFIT=E=   SUM(J,(c(J))*x(J)) ;

constraint(i)..            SUM(J,a(i,J) *x(J))  =L= b(i);

MODEL    RESALLOC /ALL/;

SOLVE RESALLOC USING LP MAXIMIZING PROFIT;

 

I will dissect the GAMS components after presenting the other example.