Solving an optimization problem

Top  Previous  Next

Many optimization problem forms exist.  The simplest of these is the Linear Programming or LP problem.  Suppose I wish to solve the optimization problem

eq001

where this is a farm profit maximization problem with three decision variables: Xcorn is the land area devoted to corn production,  Xwheat is the land area devoted to wheat production, and Xcotton is the land area devoted to cotton production.  The first equation gives an expression for total profit as a function of per acre contributions times the acreage allocated by crop and will be maximized.  The second equation limits the choice of the decision variables to the land available and the third to the labor available.  Finally, we only allow positive or zero acreage.

The simplest GAMS formulation of this is optimize.gms

 

VARIABLES             Z;

POSITIVE VARIABLES    Xcorn ,    Xwheat , Xcotton;

EQUATIONS     OBJ,  land ,  labor;

OBJ..  Z =E= 109 * Xcorn + 90 * Xwheat + 115 * Xcotton;

land..             Xcorn +      Xwheat +       Xcotton =L= 100;

labor..          6*Xcorn +  4 * Xwheat +  8  * Xcotton =L= 500;

MODEL farmPROBLEM /ALL/;

SOLVE farmPROBLEM USING LP MAXIMIZING Z;

 

Below after introduction of the other two examples I will dissect this formulation explaining its components.