$title 'CONVERT test suite - Basic test of convert output' (CONVERT16,SEQ=865) * This tests the basic convert file formats using the * himmel11 model and the 'all' (most) files option. $onDollar $set ide ide=%gams.ide% lo=%gams.lo% $call gamslib -q himmel11 $onEcho > convert.opt all filelist $offEcho $call gams himmel11.gms optfile=1 solver=convert %ide% $onEcho > ampl_mod # QCP written by GAMS Convert # # Equation counts # Total E G L N X C B # 4 3 1 0 0 0 0 0 # # Variable counts # x b i s1s s2s sc si # Total cont binary integer sos1 sos2 scont sint # 9 9 0 0 0 0 0 0 # FX 0 # # Nonzero counts # Total const NL # 22 9 13 # # Reformulation has removed 1 variable and 1 equation var x1 >= 0, <= 92; var x2 := 90, >= 90, <= 110; var x3 := 20, >= 20, <= 25; var x4 >= 0; var x5 := 78.62, >= 78, <= 102; var x6 := 33.44, >= 33, <= 45; var x7 := 31.07, >= 27, <= 45; var x8 := 44.18, >= 27, <= 45; var x9 := 35.22, >= 27, <= 45; minimize obj: 5.3578547 * x7^2 + 0.8356891 * x5 * x9 + 37.293239 * x5 + 5000 * x4 - 40792.141; subject to e1: 5 * x4 - x5 + 7 * x7 - x9 >= 0; e2: -0.0056858 * x6 * x9 - 0.0006262 * x5 * x8 + 0.0022053 * x7 * x9 + x1 + 2 * x4 = 85.334407; e3: -0.0071317 * x6 * x9 - 0.0029955 * x5 * x6 - 0.0021813 * x7^2 + x2 = 80.51249; e4: -0.0047026 * x7 * x9 - 0.0012547 * x5 * x7 - 0.0019085 * x7 * x8 + x3 + 4 * x4 = 9.300961; $offEcho $call grep -v "QCP written by GAMS" ampl_mod > ampl.mod.want $call grep -v "QCP written by GAMS" ampl.mod > ampl.mod.got $call =diff -b ampl.mod.want ampl.mod.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > cplex_lp \ QCP written by GAMS Convert \ \ Equation counts \ Total E G L N X C B \ 5 4 1 0 0 0 0 0 \ \ Variable counts \ x b i s1s s2s sc si \ Total cont binary integer sos1 sos2 scont sint \ 10 10 0 0 0 0 0 0 \ FX 0 \ \ Nonzero counts \ Total const NL \ 27 11 16 Minimize obj: x10 Subject To e1: 5 x4 - x5 + 7 x7 - x9 >= 0 e2: x1 + 2 x4 + [-0.0006262 x5 * x8 - 0.0056858 x6 * x9 + 0.0022053 x7 * x9] = 85.334407 e3: x2 + [-0.0029955 x5 * x6 - 0.0071317 x6 * x9 - 0.0021813 x7^2] = 80.51249 e4: x3 + 4 x4 + [-0.0012547 x5 * x7 - 0.0019085 x7 * x8 - 0.0047026 x7 * x9] = 9.300961 e5: -5000 x4 - 37.293239 x5 + x10 + [-0.8356891 x5 * x9 - 5.3578547 x7^2] = -40792.141 Bounds 0 <= x1 <= 92 90 <= x2 <= 110 20 <= x3 <= 25 78 <= x5 <= 102 33 <= x6 <= 45 27 <= x7 <= 45 27 <= x8 <= 45 27 <= x9 <= 45 x10 Free End $offEcho $call grep -v "QCP written by GAMS" cplex_lp > cplex.lp.want $call grep -v "QCP written by GAMS" cplex.lp > cplex.lp.got $call =diff -b cplex.lp.want cplex.lp.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > cplex_mps * QCP written by GAMS Convert * * Equation counts * Total E G L N X C B * 5 4 1 0 0 0 0 0 * * Variable counts * x b i s1s s2s sc si * Total cont binary integer sos1 sos2 scont sint * 10 10 0 0 0 0 0 0 * FX 0 * * Nonzero counts * Total const NL * 27 11 16 NAME Convert OBJSENSE MIN ROWS N obj G e1 E e2 E e3 E e4 E e5 COLUMNS x1 e2 1 x2 e3 1 x3 e4 1 x4 e1 5 x4 e2 2 x4 e4 4 x4 e5 -5000 x5 e1 -1 x5 e5 -37.293239 x7 e1 7 x9 e1 -1 x10 obj 1 x10 e5 1 RHS rhs e2 85.334407 rhs e3 80.51249 rhs e4 9.300961 rhs e5 -40792.141 BOUNDS UP bnd x1 92 LO bnd x2 90 UP bnd x2 110 LO bnd x3 20 UP bnd x3 25 LO bnd x5 78 UP bnd x5 102 LO bnd x6 33 UP bnd x6 45 LO bnd x7 27 UP bnd x7 45 LO bnd x8 27 UP bnd x8 45 LO bnd x9 27 UP bnd x9 45 FR bnd x10 QCMATRIX e2 x5 x8 -0.0006262 x8 x5 -0.0006262 x6 x9 -0.0056858 x9 x6 -0.0056858 x7 x9 0.0022053 x9 x7 0.0022053 QCMATRIX e3 x5 x6 -0.0029955 x6 x5 -0.0029955 x6 x9 -0.0071317 x9 x6 -0.0071317 x7 x7 -0.0043626 QCMATRIX e4 x5 x7 -0.0012547 x7 x5 -0.0012547 x7 x8 -0.0019085 x8 x7 -0.0019085 x7 x9 -0.0047026 x9 x7 -0.0047026 QCMATRIX e5 x5 x9 -0.8356891 x9 x5 -0.8356891 x7 x7 -10.7157094 ENDATA $offEcho $call grep -v "QCP written by GAMS" cplex_mps > cplex.mps.want $call grep -v "QCP written by GAMS" cplex.mps > cplex.mps.got $call =diff -b cplex.mps.want cplex.mps.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > fixed_mps * QCP written by GAMS Convert * * Equation counts * Total E G L N X C B * 5 4 1 0 0 0 0 0 * * Variable counts * x b i s1s s2s sc si * Total cont binary integer sos1 sos2 scont sint * 10 10 0 0 0 0 0 0 * FX 0 * * Nonzero counts * Total const NL * 27 11 16 NAME Convert * * original model was minimizing * ROWS N obj G e1 E e2 E e3 E e4 E e5 COLUMNS x1 e2 1 x2 e3 1 x3 e4 1 x4 e1 5 x4 e2 2 x4 e4 4 x4 e5 -5000 x5 e1 -1 x5 e5 -37.293239 x7 e1 7 x9 e1 -1 x10 obj 1 x10 e5 1 RHS rhs e2 85.334407 rhs e3 80.51249 rhs e4 9.300961 rhs e5 -40792.141 BOUNDS UP bnd x1 92 LO bnd x2 90 UP bnd x2 110 LO bnd x3 20 UP bnd x3 25 LO bnd x5 78 UP bnd x5 102 LO bnd x6 33 UP bnd x6 45 LO bnd x7 27 UP bnd x7 45 LO bnd x8 27 UP bnd x8 45 LO bnd x9 27 UP bnd x9 45 FR bnd x10 QCMATRIX e2 x5 x8 -0.0006262 x8 x5 -0.0006262 x6 x9 -0.0056858 x9 x6 -0.0056858 x7 x9 0.0022053 x9 x7 0.0022053 QCMATRIX e3 x5 x6 -0.0029955 x6 x5 -0.0029955 x6 x9 -0.0071317 x9 x6 -0.0071317 x7 x7 -0.0043626 QCMATRIX e4 x5 x7 -0.0012547 x7 x5 -0.0012547 x7 x8 -0.0019085 x8 x7 -0.0019085 x7 x9 -0.0047026 x9 x7 -0.0047026 QCMATRIX e5 x5 x9 -0.8356891 x9 x5 -0.8356891 x7 x7 -10.7157094 ENDATA $offEcho $call grep -v "QCP written by GAMS" fixed_mps > fixed.mps.want $call grep -v "QCP written by GAMS" fixed.mps > fixed.mps.got $call =diff -b fixed.mps.want fixed.mps.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > gams_gms * QCP written by GAMS Convert * * Equation counts * Total E G L N X C B * 5 4 1 0 0 0 0 0 * * Variable counts * x b i s1s s2s sc si * Total cont binary integer sos1 sos2 scont sint * 10 10 0 0 0 0 0 0 * FX 0 * * Nonzero counts * Total const NL * 27 11 16 * Solve m using QCP minimizing x10; Variables x1,x2,x3,x4,x5,x6,x7,x8,x9,x10; Positive Variables x4; Equations e1,e2,e3,e4,e5; e1.. 5 * x4 - x5 + 7 * x7 - x9 =G= 0; e2.. -0.0056858 * x6 * x9 - 0.0006262 * x5 * x8 + 0.0022053 * x7 * x9 + x1 + 2 * x4 =E= 85.334407; e3.. -0.0071317 * x6 * x9 - 0.0029955 * x5 * x6 - 0.0021813 * sqr(x7) + x2 =E= 80.51249; e4.. -0.0047026 * x7 * x9 - 0.0012547 * x5 * x7 - 0.0019085 * x7 * x8 + x3 + 4 * x4 =E= 9.300961; e5.. -5.3578547 * sqr(x7) - 0.8356891 * x5 * x9 - 37.293239 * x5 - 5000 * x4 + x10 =E= -40792.141; * set non-default bounds x1.lo = 0; x1.up = 92; x2.lo = 90; x2.up = 110; x3.lo = 20; x3.up = 25; x5.lo = 78; x5.up = 102; x6.lo = 33; x6.up = 45; x7.lo = 27; x7.up = 45; x8.lo = 27; x8.up = 45; x9.lo = 27; x9.up = 45; * set non-default levels (default: 0 projected into bounds) x5.l = 78.62; x6.l = 33.44; x7.l = 31.07; x8.l = 44.18; x9.l = 35.22; Model m / all /; m.limrow = 0; m.limcol = 0; Solve m using QCP minimizing x10; $offEcho $call grep -v "QCP written by GAMS" gams_gms > gams.gms.want $call grep -v "QCP written by GAMS" gams.gms > gams.gms.got $call =diff -b gams.gms.want gams.gms.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > lingo_lng ! QCP written by GAMS Convert ! ! Equation counts ! Total E G L N X C B ! 4 3 1 0 0 0 0 0 ! ! Variable counts ! x b i s1s s2s sc si ! Total cont binary integer sos1 sos2 scont sint ! 9 9 0 0 0 0 0 0 ! FX 0 ! ! Nonzero counts ! Total const NL ! 22 9 13 ! ! Reformulation has removed 1 variable and 1 equation ! ; MODEL: [Obj] MIN = 5.3578547 * @SQR(x7) + 0.8356891 * x5 * x9 + 37.293239 * x5 + 5000 * x4 - 40792.141; [e1] 5 * x4 - x5 + 7 * x7 - x9 >= 0; [e2] -(0.0056858 * x6 * x9) - 0.0006262 * x5 * x8 + 0.0022053 * x7 * x9 + x1 + 2 * x4 = 85.334407; [e3] -(0.0071317 * x6 * x9) - 0.0029955 * x5 * x6 - 0.0021813 * @SQR(x7) + x2 = 80.51249; [e4] -(0.0047026 * x7 * x9) - 0.0012547 * x5 * x7 - 0.0019085 * x7 * x8 + x3 + 4 * x4 = 9.300961; @BND(0, x1, 92); @BND(90, x2, 110); @BND(20, x3, 25); @BND(78, x5, 102); @BND(33, x6, 45); @BND(27, x7, 45); @BND(27, x8, 45); @BND(27, x9, 45); INIT: x2 = 90; x3 = 20; x5 = 78.62; x6 = 33.44; x7 = 31.07; x8 = 44.18; x9 = 35.22; ENDINIT END $offEcho $call grep -v "QCP written by GAMS" lingo_lng > lingo.lng.want $call grep -v "QCP written by GAMS" lingo.lng > lingo.lng.got $call =diff -b lingo.lng.want lingo.lng.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > dict_txt QCP written by GAMS Convert Equation counts Total E G L N X C B 5 4 1 0 0 0 0 0 Variable counts x b i s1s s2s sc si Total cont binary integer sos1 sos2 scont sint 10 10 0 0 0 0 0 0 FX 0 Nonzero counts Total const NL 27 11 16 Equations 1 to 5 e1 e1 e2 e2 e3 e3 e4 e4 e5 e5 Variables 1 to 10 x1 g2 x2 g3 x3 g4 x4 xl x5 x1 x6 x2 x7 x3 x8 x4 x9 x5 x10 obj $offEcho $call grep -v "QCP written by GAMS" dict_txt > dict.txt.want $call grep -v "QCP written by GAMS" dict.txt > dict.txt.got $call =diff -b dict.txt.want dict.txt.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > files_txt ampl.mod ampl.nl cplex.lp cplex.mps dict.txt dictmap.gdx dump.gdx fixed.mps gams.gms jump.jl lingo.lng osil.xml pyomo.py files.txt $offEcho $call grep -v "QCP written by GAMS" files_txt > files.txt.want $call grep -v "QCP written by GAMS" files.txt > files.txt.got $call =diff -b files.txt.want files.txt.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > jump_jl # QCP written by GAMS Convert # # Equation counts # Total E G L N X C B # 4 3 1 0 0 0 0 0 # # Variable counts # x b i s1s s2s sc si # Total cont binary integer sos1 sos2 scont sint # 9 9 0 0 0 0 0 0 # FX 0 # # Nonzero counts # Total const NL # 22 9 13 # # Reformulation has removed 1 variable and 1 equation using JuMP using MathOptInterface const MOI = MathOptInterface model = m = Model() @variable(m, 0 <= x1 <= 92, start=0) @variable(m, 90 <= x2 <= 110, start=90) @variable(m, 20 <= x3 <= 25, start=20) @variable(m, 0 <= x4, start=0) @variable(m, 78 <= x5 <= 102, start=78.62) @variable(m, 33 <= x6 <= 45, start=33.44) @variable(m, 27 <= x7 <= 45, start=31.07) @variable(m, 27 <= x8 <= 45, start=44.18) @variable(m, 27 <= x9 <= 45, start=35.22) @objective(m, Min, 5.3578547 * x7^2 + 0.8356891 * x5 * x9 + 37.293239 * x5 + 5000 * x4 - 40792.141) @constraint(m, e1, 5 * x4 - x5 + 7 * x7 - x9 >= 0) @constraint(m, e2, -0.0056858 * x6 * x9 - 0.0006262 * x5 * x8 + 0.0022053 * x7 * x9 + x1 + 2 * x4 == 85.334407) @constraint(m, e3, -0.0071317 * x6 * x9 - 0.0029955 * x5 * x6 - 0.0021813 * x7^ 2 + x2 == 80.51249) @constraint(m, e4, -0.0047026 * x7 * x9 - 0.0012547 * x5 * x7 - 0.0019085 * x7 * x8 + x3 + 4 * x4 == 9.300961) $offEcho $call grep -v "QCP written by GAMS" jump_jl > jump.jl.want $call grep -v "QCP written by GAMS" jump.jl > jump.jl.got $call =diff -b jump.jl.want jump.jl.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel% $onEcho > pyomo_py # QCP written by GAMS Convert # # Equation counts # Total E G L N X C B # 4 3 1 0 0 0 0 0 # # Variable counts # x b i s1s s2s sc si # Total cont binary integer sos1 sos2 scont sint # 9 9 0 0 0 0 0 0 # FX 0 # # Nonzero counts # Total const NL # 22 9 13 # # Reformulation has removed 1 variable and 1 equation from pyomo.environ import * model = m = ConcreteModel() m.x1 = Var(within=Reals, bounds=(0,92), initialize=0) m.x2 = Var(within=Reals, bounds=(90,110), initialize=90) m.x3 = Var(within=Reals, bounds=(20,25), initialize=20) m.x4 = Var(within=Reals, bounds=(0,None), initialize=0) m.x5 = Var(within=Reals, bounds=(78,102), initialize=78.62) m.x6 = Var(within=Reals, bounds=(33,45), initialize=33.44) m.x7 = Var(within=Reals, bounds=(27,45), initialize=31.07) m.x8 = Var(within=Reals, bounds=(27,45), initialize=44.18) m.x9 = Var(within=Reals, bounds=(27,45), initialize=35.22) m.obj = Objective(sense=minimize, expr= 5.3578547 * m.x7**2 + 0.8356891 * m.x5 * m.x9 + 37.293239 * m.x5 + 5000 * m.x4 - 40792.141) m.e1 = Constraint(expr= 5 * m.x4 - m.x5 + 7 * m.x7 - m.x9 >= 0) m.e2 = Constraint(expr= -0.0056858 * m.x6 * m.x9 - 0.0006262 * m.x5 * m.x8 + 0.0022053 * m.x7 * m.x9 + m.x1 + 2 * m.x4 == 85.334407) m.e3 = Constraint(expr= -0.0071317 * m.x6 * m.x9 - 0.0029955 * m.x5 * m.x6 - 0.0021813 * m.x7**2 + m.x2 == 80.51249) m.e4 = Constraint(expr= -0.0047026 * m.x7 * m.x9 - 0.0012547 * m.x5 * m.x7 - 0.0019085 * m.x7 * m.x8 + m.x3 + 4 * m.x4 == 9.300961) $offEcho $call grep -v "QCP written by GAMS" pyomo_py > pyomo.py.want $call grep -v "QCP written by GAMS" pyomo.py > pyomo.py.got $call =diff -b pyomo.py.want pyomo.py.got $if NOT errorlevel 0 $error errorlevel not 0 but is %system.errorlevel% $if errorlevel 1 $error errorlevel not 0 but is %system.errorlevel%