|
Algebra and model .. specifications |
Top Previous Next |
|
The equations and variables in a model are defined by the evaluation of the .. equation specifications. The .. equations for our examples are
OBJective.. PROFIT=E= SUM(J,c(J)*x(J)) ; constraint(i).. SUM(J,a(i,J) *x(J)) =L= b(i);
Pdemand(commodities).. P(commodities)=g= intercepts("demand",commodities) +sum(cc,slopes("demand",commodities,cc)*Qd(cc)); Psupply(commodities).. intercepts("supply",commodities) +sum(cc,slopes("supply",commodities,cc)* Qs(cc)) =g= P(commodities); Equilibrium(commodities).. Qs(commodities)=g= Qd(commodities);
Here GAMS will operate over all the elements in the sets in each term. For example, in the OBJective equation GAMS will add up the term c(J)*x(J) for all set elements in j. Similarly, the equation constraint(i) will define a separate constraint equation case for each element of i. Also within the equation case associated with an element of i only the elements of a(i,j) associated with that particular i will be included in the term SUM(J,a(i,J) *x(J)). Similarly, within the second example equations of each type are included for each member of set commodities. Notes:
|