Description
1) An equilibrium model using EMP Python syntax 2) Formulate the simplevi.gms example using EMP Python syntax 3) A combination of optimization and vi agents using EMP Python syntax Contributor: Youngdae Kim (02/17/2019)
Small Model of Type : GAMS
Category : GAMS EMP library
Main file : emppython1.gms
$title Three Simple EMP Models with Indexed EMP Syntax and Python Parser (EMPPYTHON1,SEQ=104)
$onText
1) An equilibrium model using EMP Python syntax
2) Formulate the simplevi.gms example using EMP Python syntax
3) A combination of optimization and vi agents using EMP Python syntax
Contributor: Youngdae Kim (02/17/2019)
$offText
* On the major platforms (Windows, Linux, Mac), GMSPYTHONLIB gets automatically set
* to use the internal Python installation in sysdir/GMSPython.
$if not setEnv GMSPYTHONLIB $abort.noError Embedded code Python not ready to be used
$log --- Using Python library %sysEnv.GMSPYTHONLIB%
$title An equilibrium model using EMP Python syntax
set i / 1*3 /;
alias(i,j);
variables obj(i);
positive variables x1(i);
equations defobj1(i);
defobj1(i)..
obj(i) =E= x1(i)*(1 - sum(j, x1(j)));
model m1 / defobj1 /;
$onEcho > empinfo.txt
equilibrium
max obj(i) s.t. x1(i), defobj1(i)
$offEcho
$libInclude empmodel empinfo.txt
x1.up(i) = 1;
solve m1 using emp;
$title Formulate the simplevi.gms example using EMP Python syntax
sets
k / k1, k2 /
l / l1 * l3 /;
table A(k,l)
l1 l2 l3
k1 1 1
k2 1 1;
parameter b(k) /
k1 6
k2 9
/;
positive variable
x2(l) 'primal vars, perp to f(l)'
;
equations
F(l)
g(k)
;
F(l).. 2 * x2(l) =n= 0 ;
g(k).. sum {l, A(k,l)*x2(l)} =g= b(k) ;
model m2 / F, g /;
$onEcho > empfile.txt
vi F(l), x2(l), g(k)
$offEcho
$libInclude empmodel empfile.txt
solve m2 using emp;
$title A combination of optimization and vi agents using EMP Python syntax
* set i, alias j and variables obj(i) from example 1
variables y;
positive variables x3(i);
equations defobj3(i), defext;
defobj3(i)..
obj(i) =E= x3(i)*(1 - sum(j, x3(j))) + y;
defext..
1 - sum(j, x3(j)) - y =E= 0;
$onEcho > empfile.txt
equilibrium
max obj(i) s.t. x3(i), defobj3(i)
vi defext, y
$offEcho
$libInclude empmodel empfile.txt
model m3 / defobj3, defext /;
x3.up(i) = 1;
solve m3 using emp;