Professional Documents
Culture Documents
Lab5 Gams Formulation
Lab5 Gams Formulation
Lab5 Gams Formulation
EN.NO:12102020503006
Q.1 Optimize the objective function with lp maximization of z=3*x1 - x2; with constraints 2*x1 +
x2>2; x1 + 3*x2<4.
CODE:
Equations
Con1,
Con2,
Con3,
Obj;
Con3.. x2 =L=4 ;
Model Ketan/
Con1,
Con2,
Con3,
Obj/;
Options LP = Cplex;
Display x1.L,x2.L,z.L;
SOLVE SUMMARY
EN.NO:12102020503010
MODEL Ketan OBJECTIVE z
--- *** This solver runs with a demo license. No commercial use.
0 INFEASIBLE
1 UNBOUNDED (UNBND)
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/03/23 18:56:52 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
EN.NO:12102020503010
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.2 Optimize the objective function with lp maximization of 12*x1 + 15*x2 + 14*x3; with
constraints - 1*x1 + x2 >0;-1*x1 + 2*x3<100.
CODE:
Equations
Con1,
Con2,
Con3,
Obj;
Model Ketan/
Con1,
Con2,
Con3,
Obj/;
Options LP = Cplex;
Display x1.L,x2.L,x3.L,z.L;
SOLVE SUMMARY
--- *** This solver runs with a demo license. No commercial use.
0 INFEASIBLE
1 UNBOUNDED (UNBND)
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/03/23 19:02:18 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Equations
Con1,
Con2,
Con3,
Con4,
Con5,
Con6,
Obj;
Model Ketan/
Con1,
Con2,
EN.NO:12102020503010
Con3,
Con4,
Con5,
Con6,
Obj/;
Options LP = Cplex;
Display x2.L,x4.L,x6.L,x7.L,x8.L,x10.L,z.L;
SOLVE SUMMARY
--- *** This solver runs with a demo license. No commercial use.
Objective: 54287.422280
0 INFEASIBLE
0 UNBOUNDED
EN.NO:12102020503010
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/03/23 19:14:57 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Equations
Con1,
Con2,
Con3,
Obj;
Model Ketan/
Con1,
Con2,
Con3,
Obj/;
Options LP = Cplex;
Display M1.L,M2.L,M3.L,M4.L,z.L;
SOLVE SUMMARY
--- *** This solver runs with a demo license. No commercial use.
0 INFEASIBLE
1 UNBOUNDED (UNBND)
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/03/23 19:26:15 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.5 Optimize the functions using function with lp minimization 3*x1+2*x2+2*x3; with
constraints 5*x1+7*x2+4*x3<-2; 3*x1+4*x2-6*x3>29/7.
CODE:
Free Variable x1,x2,x3,z;
Equations
Con1,
Con2,
Con3,
Obj;
Model Ketan/
Con1,
Con2,
Con3,
Obj/;
Options LP = Cplex;
Display x1.L,x2.L,x3.L,z.L;
SOLVE SUMMARY
--- *** This solver runs with a demo license. No commercial use.
0 INFEASIBLE
1 UNBOUNDED (UNBND)
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/03/23 19:32:26 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
EN.NO:12102020503010
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
CODE:
Free Variable x11,x12,x13,x21,x22,x23,x31,x32,x33,z;
Equations
Con1,
Con2,
Con3,
Con4,
Con5,
Con6,
Obj;
Model Ketan/
Con1,
Con2,
EN.NO:12102020503010
Con3,
Con4,
Con5,
Con6,
Obj/;
Options LP = Cplex;
Display x11.L,x12.L,x13.L,x21.L,x22.L,x23.L,x31.L,x32.L,x33.L,z.L;
SOLVE SUMMARY
--- *** This solver runs with a demo license. No commercial use.
0 INFEASIBLE
1 UNBOUNDED (UNBND)
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/03/23 19:43:37 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
EN.NO:12102020503010
CODE:
Free Variable Xa1,Xa2,Xb1,Xb2,Xc1,Xc2,z;
Equations
Con1,
Con2,
Con3,
Con4,
Obj;
Model Ketan/
Con1,
Con2,
Con3,
Con4,
Obj/;
Options LP = Cplex;
SOLVE SUMMARY
--- *** This solver runs with a demo license. No commercial use.
--- Rerunning with presolve turned off and solving with LPMETHOD=1.
0 INFEASIBLE
1 UNBOUNDED (UNBND)
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/04/23 22:20:52 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.8 Optimize function with lp maximization for function 7*y1 + 4*y2 - 10*y3 + 3*y4 +
2*y5; for given constraints 3*y1 + 6*y2 - 7*y3 + y4 + 4*y5 < 3; 5*y1 + y2 + 2*y3 - 2*y4 +
7*y5 <-2; 4*y1 + 3*y2 + y3 + 5*y4 - 2*y5 <4.
CODE:
Free Variable y1,y2,y3,y4,y5,z;
Equations
Con1,
Con2,
Con3,
Obj;
Model Ketan/
Con1,
EN.NO:12102020503010
Con2,
Con3,
Obj/;
Options LP = Cplex;
Display y1.L,y2.L,y3.L,y4.L,y5.L,z.L;
SOLVE SUMMARY
--- *** This solver runs with a demo license. No commercial use.
bounded
0 INFEASIBLE
0 UNBOUNDED
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/04/23 22:32:21 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.9 Optimize the function for mixed nonlinear program (minlp) 75*(x1*x1) + 6*(x2*x2) +
3*(x3*x3) + 33*(x4*x4); for constraints 774*x1 + 76*(x2*x2) + 22*(x3*x3) +42*(x4*x4)
<875.
CODE:
Free Variable x1,x2,x3,x4,z;
Equations
Con1,
Con2,
Obj;
Model Ketan/
Con1,
EN.NO:12102020503010
Con2,
Obj/;
Display x1.L,x2.L,x3.L,x4.L,z.L;
SOLVE SUMMARY
EVALUATION ERRORS 0 0
--- *** This solver runs with a demo license. No commercial use.
C O N O P T 3 version 3.17N
Bagsvaerdvej 246 A
** Warning ** The number of nonlinear derivatives equal to zero in the initial point is large (= 61
Pre-triangular equations: 0
Post-triangular equations: 1
0 INFEASIBLE
0 UNBOUNDED
0 ERRORS
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/04/23 22:50:44 Page
7
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.10 Optimize the function of mixed integer where x1 is positive variable, x2 is integer and
x3 is binary variable x1+ x2+ x3; using constraints x1 - 2*x2 >7;X1 + 20*x3 > 9.
CODE:
Variable z;
Equations
Con1,
Con2,
Obj;
Model Ketan/
Con1,
EN.NO:12102020503010
Con2,
Obj/;
Display x1.L,x2.L,x3.L,z.L;
SOLVE SUMMARY
--- *** This solver runs with a demo license. No commercial use.
Objective: 7.100000
0 INFEASIBLE
0 UNBOUNDED
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/06/23 19:23:37 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.11 Optimize the function where, free variable z; positive variables x1,x2; integer variable
x3;functional variable z is X1*X1 + X2*X2 + X3*X3; constraints provided is 4*X1 +
X2*X2 + 2*X3=14. This is a mixed integral non liner program for maximizing z.
CODE:
Variable z;
Equations
Con1,
Obj;
Model Ketan/
Con1,
Obj/;
Display x1.L,x2.L,x3.L,z.L;
SOLVE SUMMARY
EVALUATION ERRORS 0 0
-------------------------------------------------------------------------------
EN.NO:12102020503010
Dicopt 2 41.5.0 2a5a4ddc Jan 3, 2023 WEI x86 64bit/MS Window
------------------------------------------------------------------------------
------------------------------------------------------------------------------- ***
--- *** This solver runs with a demo license. No commercial use.
C O N O P T 3 version 3.17N
Bagsvaerdvej 246 A
Pre-triangular equations: 0
Post-triangular equations: 1
0 INFEASIBLE
0 UNBOUNDED
0 ERRORS
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/06/23 19:40:47 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.12 Optimize for minlp maximization of free variable z; where, integer variables
x1,x2,xn;and function being x1*x2*xn ; with constraints x1 + x2 +xn= 1.
CODE:
Variable z;
Equations
Con1,
Obj;
Model Ketan/
Con1,
Obj/;
Display x1.L,x2.L,xn.L,z.L;
SOLVE SUMMARY
EVALUATION ERRORS 0 0
-------------------------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------- ***
--- *** This solver runs with a demo license. No commercial use.
C O N O P T 3 version 3.17N
Bagsvaerdvej 246 A
Post-triangular equations: 1
0 INFEASIBLE
0 UNBOUNDED
0 ERRORS
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/06/23 19:46:57 Page
7G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
EN.NO:12102020503010
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.13 Optimize for minlp minimization of free variable z; where, integer variables
x1,x2; binary variable X3; Objective function being 4*x1*x1+ 2*x2*x2 +x3*x3 -4*x1*x2
; constraints are x1 + x2 +x3=15; and 2*x1 -x2 +2*x3=20 CODE:
Variable z;
Equations
Con1,
Con2,
Obj;
Model Ketan/
Con1,
EN.NO:12102020503010
Con2,
Obj/;
Display x1.L,x2.L,x3.L,z.L;
SOLVE SUMMARY
EVALUATION ERRORS 0 0
-------------------------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------- ***
--- *** This solver runs with a demo license. No commercial use
C O N O P T 3 version 3.17N
EN.NO:12102020503010
Copyright (C) ARKI Consulting and Development A/S
Bagsvaerdvej 246 A
Pre-triangular equations: 0
Post-triangular equations: 1
0 INFEASIBLE
0 UNBOUNDED
0 ERRORS
GAMS 41.5.0 2a5a4ddc Jan 3, 2023 WEX-WEI x86 64bit/MS Windows - 03/06/23 19:52:47 Page
7
Execution
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
Q.14 Run the following syntax of GAMS and find out whether its a lp, nlp, minlp, milp
problem and what is the maximized or minimized value.
(A) variable z; positive variables
x1,x2,x3,x4,x5,x6,x7,x8,x9,x10; equations
obj,a3,a5,a7,a8,a9,a11;
obj..z=e=2.17*x2+32*x4+13.96*x6+20.6*x7+3.66*x8+4.5*x10;
SUMMARY
--- *** This solver runs with a demo license. No commercial use.
Objective: 54287.422280
EN.NO:12102020503010
LOWER LEVEL UPPER MARGINAL
0 INFEASIBLE
0 UNBOUNDED
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst
EN.NO:12102020503010
SOLVE SUMMARY
EVALUATION ERRORS NA 0
-------------------------------------------------------------------------------
------------------------------------------------------------------------------
--- *** This solver runs with a demo license. No commercial use.
0 INFEASIBLE
0 UNBOUNDED
0 ERRORS
Input C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.gms
Output C:\Users\ADMIN\Documents\gamsdir\projdir\Untitled_1.lst