|
<< Click to Display Table of Contents >> ENDO |
![]() ![]()
|
ENDO and EXO are used for fixing variables, that is, setting variables to some values (goal), and asking the system to solve this by means of other variables (means). The ENDO statement works differently depending upon option model type (if a model is loaded with the MODEL statement, this option is set automatically).
•With option model type = default, ENDO endogenizes a list of variables (without date settings). A model must be defined beforehand.
•With option model type = gams, ENDO produces array-series with names starting with endo_. These array-series can subsequently be used to tell e.g. GAMS which variables are fixed and non-fixed. In this case, ENDO must indicate dates.
Use UNFIX to remove previously set ENDO or EXO variables.
default type: endo variable1, variable2, ... ;
gams type: endo <period0> variable1 <period1>, variable2 <period2>, ... ;
variables |
Default type: The variables are simple series names, or lists of these, for instance x2, or {#m}. Gams type: The variables are series or array-series names, for instance x2 or x2[a,b]. For array-series, lists may be used, for instance x2[a,#i,#j], where #i and #j are lists of strings. |
period0 |
A period is a Gekko time interval like <2020 2030> or <2020q1 2030q4>. The general period can be set in the period0 field, and this period will be be used for the variables, unless specific periods are given in the period1, period2, etc. |
period1, period2, ... |
A period is a Gekko time interval like <2020 2030> or <2020q1 2030q4>. These specific periods will overrule the general period (period0). |
Gekko type
If you need to exogenize a variable fy, and endogenize a variable tg, use this:
model forecst; //Gekko model, will set "option model type = default" |
Gams type
The following example exogenizes variables x1[a,k1] and y1, and endogenizes x2[a,k1] and y2.
option model type = gams; //may omit if a MODEL<gms> statement is used first |
The resulting variables are as follows (note that these variables are overwritten if they exist beforehand):
|
Instead of individual elements, you may use lists:
option model type = gams; //may omit if a MODEL<gms> statement is used first #a = a1, a2; |
The two lists are automatically unfolded into 2 x 2 = 4 elements (sub-series) regarding exo_x1 and endo_x2:
exo_x1[a1, k1] exo_x1[a1, k2] exo_x1[a2, k1] exo_x1[a2, k2] |
With a Gekko model, the ENDO and EXO statements are non-cumulative, so all endogenized/exogenized variables should be present in the same ENDO/EXO statement.
With a GAMS model, the ENDO and EXO statements are cumulative in the sense that ENDO or EXO do not delete existing endo_... and exo_... array-series.
option model type = default;