Error in Disjunctive Program

Problems with syntax of GAMS
Post Reply
wayne9205
User
User
Posts: 1
Joined: 6 months ago

Error in Disjunctive Program

Post by wayne9205 » 6 months ago

I am solving a disjunctive program by EMP.

The code and output are shown as follows:


May I know whether problem is normally solved and how to tackle the EMP syntax error


$title GAMS model for disjunctive programming

Set i /r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12/
j /c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11/
h /m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11/;

Scalar L / 0.08333 /;

Positive Variables a(i), s(i,j);
Variables z, t, b, c, v(j), f(h);

*=== Import from excel using GDX utility

$call gdxxrw.exe Theta1.xlsx squeeze=N par=ThetaLevelFirst rng=sheet1!A1:L13
Parameter ThetaLevelFirst(i,j);
$gdxin Theta1.gdx
$load ThetaLevelFirst
$gdxin

$call gdxxrw.exe Theta2.xlsx squeeze=N par=ThetaLevelSecond rng=sheet1!A1:L13
Parameter ThetaLevelSecond(i,h);
$gdxin Theta2.gdx
$load ThetaLevelSecond
$gdxin

$call gdxxrw.exe X.xlsx par=XLevel rng=sheet1!A1:B13
Parameter XLevel(i,j);
$gdxin X.gdx
$load XLevel
$gdxin

display ThetaLevelFirst, ThetaLevelSecond, XLevel;

*=== Optimization problem start here

equations obj, alg1, alg2, alg3, alg4, alg5, alg6, alg7, alg8,
alg9(i,j), alg10(j), alg11(i), alg12,
alg13, alg14, alg15, alg16, alg17, alg18, alg19, alg20, alg21, alg22, alg23,
dis1(j,h),dis2(j,h),dis3(j),dis4(j);

* objective

obj.. z =e= t;

* common constraints

alg1.. t =g= c;
alg2.. t =g= b + sum(i,a(i)*Xlevel(i,"c1"));
alg3.. v("c11") =e= 0;
alg4.. v("c1") =g= v("c6");
alg5.. v("c2") =g= v("c7");
alg6.. v("c3") =g= v("c8");
alg7.. v("c4") =g= v("c9");
alg8.. v("c5") =g= v("c10");
alg9(i,j).. s(i,j) =g= 0;
alg10(j).. smax(i,s(i,j)) =l= L;
alg11(i).. a(i) =g= 0;
alg12.. smax(i,a(i)) =l= L;

alg13.. v("c1") =e= f("m1");
alg14.. v("c2") =e= f("m2");
alg15.. v("c3") =e= f("m3");
alg16.. v("c4") =e= f("m4");
alg17.. v("c5") =e= f("m5");
alg18.. v("c6") =e= f("m6");
alg19.. v("c7") =e= f("m7");
alg20.. v("c8") =e= f("m8");
alg21.. v("c9") =e= f("m9");
alg22.. v("c10") =e= f("m10");
alg23.. v("c11") =e= f("m11");

* disjunctive
dis1(j,h).. v(j)+sum(i,s(i,j)*(ThetaLevelSecond(i,h)- ThetaLevelFirst(i,j))) =g= f(h);
dis2(j,h).. v(j) =g= f(h);
dis3(j).. sum(i,a(i)*ThetaLevelFirst(i,j))+b =g= v(j);
dis4(j).. c =g= v(j);

Model example / all /;
file emp / '%emp.info%' /;
putclose emp
"disjunction * dis1(j,h) else dis2(j,h)"/
"disjunction * dis3(j) else dis4(j)"/
;
*option optcr = 0.0;
solve example using EMP minimizing z;

The output is shown as follows

Job Disjunctive.gms Start 01/28/19 23:34:41 25.1.3 r4e34d435fbd WEX-WEI x86 64bit/MS Windows
GAMS 25.1.3 Copyright (C) 1987-2018 GAMS Development. All rights reserved
Licensee: Wenjie Huang, Single User License S190128:0911AO-WIN
National University of Singapore, Industrial Systems EnginDC14741
License for teaching and research at degree granting institutions
isehuan@nus.edu.sg
--- Starting compilation
--- Disjunctive.gms(14) 3 Mb
--- call gdxxrw.exe Theta1.xlsx squeeze=N par=ThetaLevelFirst rng=sheet1!A1:L13

GDXXRW 25.1.3 r4e34d435fbd Released Oct 30, 2018 VS8 x86 32bit/MS Wi
Input file : C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\Theta1.xlsx
Output file: C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\Theta1.gdx
Total time = 1203 Ms
--- Disjunctive.gms(16) 3 Mb

--- GDXin=C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\Theta1.gdx
--- Disjunctive.gms(20) 3 Mb
--- call gdxxrw.exe Theta2.xlsx squeeze=N par=ThetaLevelSecond rng=sheet1!A1:L13

GDXXRW 25.1.3 r4e34d435fbd Released Oct 30, 2018 VS8 x86 32bit/MS Wi
Input file : C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\Theta2.xlsx
Output file: C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\Theta2.gdx
Total time = 1094 Ms
--- Disjunctive.gms(22) 3 Mb

--- GDXin=C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\Theta2.gdx
--- Disjunctive.gms(26) 3 Mb
--- call gdxxrw.exe X.xlsx par=XLevel rng=sheet1!A1:B13

GDXXRW 25.1.3 r4e34d435fbd Released Oct 30, 2018 VS8 x86 32bit/MS Wi
Input file : C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\X.xlsx
Output file: C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\X.gdx
Total time = 1094 Ms
--- Disjunctive.gms(28) 3 Mb

--- GDXin=C:\Users\isehuan\Desktop\Research\Research Project\Haskell_Huang_Multiattribute\experiment\Disjunctive\X.gdx
--- Disjunctive.gms(86) 3 Mb
--- Starting execution: elapsed 0:00:03.691
--- Disjunctive.gms(80) 4 Mb
--- Generating EMP model example
--- Disjunctive.gms(85) 6 Mb
--- 440 rows 170 columns 2,307 non-zeroes
--- 324 nl-code 144 nl-non-zeroes
--- Disjunctive.gms(85) 4 Mb
--- Executing JAMS: elapsed 0:00:03.753

JAMS 1.0 25.1.3 r4e34d435fbd Released Oct 30, 2018 WEI x86 64bit/MS Wi

JAMS - Solver for Extended Mathematical Programs (EMP)
------------------------------------------------------
*** EMP syntax error: need at least one equation in term is dis1 (item 3 on line 1) but instance not in equation rim
*** EMP syntax error: key expected: is dis1 (item 3 on line 1) but instance not in equation rim
--- EMP Summary
Logical Constraints = 0
Disjunctions = 1
Adjusted Constraint = 0
Flipped Constraints = 0
Dual Variable Maps = 0
Dual Equation Maps = 0
VI Functions = 0
QVI Parameters = 0
Equilibrium Agent = 0
Bilevel Followers = 0

*** Warning 1 of 1 CHull disjunctions use JAMS's default for big (10000)
*** Warning 1 of 1 CHull disjunctions use JAMS's default for eps (0.0001)


Find below a list of the allowed JAMS syntax
--------------------------------------------
Disjunction chull [big eps | bigM big eps threshold | indic]
NOT var|* NOT {equ} {ELSEIF NOT var|* NOT {equ}} ELSE [NOT {equ}]
Default chull [big eps | bigM big eps threshold | indic]
ParallelStep1 {equ|*}
AdjustEqu equ abs|sqr|maxz|... {weight}
ModelType MCP|NLP|MIP|...
BiLevel {var} {MAX|MIN obj {var|*} {- equ}} {VI {var|*} {- equ var} {- equ}}
{DualVar {var - equ}}
Equilibrium {Implicit {var equ}} {VIsol {equ}}
{MAX|MIN obj {var|*} {- equ}} {VI {var|*} {- equ var} {- equ}}
{DualVar {var - equ}}
VI {var|*} {- equ var} {- equ}
DualEqu {- equ var}
DualVar {var - equ}
-------
optional | exclusive { } can be repeated

***
*** JAMS Pre processing failed
***
--- Restarting execution
--- Disjunctive.gms(85) 2 Mb
--- Reading solution for model example
*** Status: Normal completion
--- Job Disjunctive.gms Stop 01/28/19 23:34:45 elapsed 0:00:03.892

Post Reply