|
Data may also be entered through replacement or assignment statements. Such statements involve the use of a statement like
parametername(setdependency) = expression;
where the parameters on the left hand side must have been previously defined in a set, parameter or table statement.
Examples:
(Caldata.gms)
scalar a1;
scalars a2 /11/;
parameter cc(j) , bc(j) /j2 22/;
a1=10;
a2=5;
cc(j)=bc(j)+10;
cc("j1")=1;
Notes:
| • | When a statement like cc(j)=bc(j)+10; is executed this is done for all elements in k so if j had 100,000 elements this would define values for each and every one. |
| • | These assignments can be the sole entry of a data item or may redefine items. |
| • | If an item is redefined then it has the new value from then on and does not retain the original data. |
| • | Items in parameter or scalar coefficients without a data definition must have a calculated value specified before they can be used. |
| • | Calculations do not have to cover all set element cases of the parameters involved (through partial set references as discussed in the Sets chapter). Set elements that are not computed over retain their original values if defined or a zero if never defined by entry or previous calculation. |
|