Comparison of Gams, Ampl, and Minos for Optimization

Comparison of Gams, Ampl, and Minos for Optimization

curriculum COMPARISON OF GAMS, AMPL, AND MINOS FOR OPTIMIZATION XUEYU CHEN, KRrSHNARAJ S. HAD, JUFANG Yu, AND RALPH W. PIKE Louisiana State University. Baton Rouge" AL 70803 ptimization of plant operations and process design XA, and OSL, with others to become available.[4JBoth have requires maximizing a profit function subject to a . mainframe, workstation, and PC versions, and they have O plant model that can involve thousands of con- student editions that can solve small problems (about 300 straint equations. The mathematical programming modeling constraint equations). The manual is the same for all ver- languages of GAMS and AMPL were developed to alleviate sions, and licensing fees are comparable. many of the difficulties associated with the development GAMS has been used to solve chemical engineering opti- and solution of large, complex mathematical program- mization problems, and Grossmann['] has edited a CACHE ming models like these and to allow direct formulation Design Case Studies Series with a number of typical prob- and solution on a computer. They have problem formula- lems for use in optimization courses. Also, we have used tion in a language very similar to the mathematical state- GAMS and AMPL in research and instruction and have ment of the optimization problem. found them to be valuable tools that can be used to solve a The modeling language GAMS (General Algebraic Mod- range of optimization problems. Consequently, we offer here eling System) was developed at the World Bank to facilitate a brief comparison of GAMS, AMPL, and MINOS to assist the solution of multi-sectoral economy-wide models['] where those who would like to take advantage of this new approach FORTRAN programs had been previously used. The model- for solving mathematical programming problems. ing language AMPL (A Modeling Language for Mathemati- Prior to GAMS and AMPL, codes like MINOS were used cal Programming) was developed at AT&T Bell Laborato- [2J to solve large linear and nonlinear programming problems. ries for communication applications. These two languages MINOS (Modular In-Core, Non-Linear Optimization Sys- offer an efficient and effective way to solve mathemati- tem) is a widely used nonlinear programming solver that cal programming problems at the expense of learning was developed in the System Optimization Laboratory of the another programming language. Both languages have Department of Operations Research at Stanford University. similar construction, and AMPL is interactive and use It is described as a FORTRAN-based computer system that separate model and data files. solves large-scale linear and nonlinear optimization prob- [6] GAMS appeared in 1988, is now in version 2.25, and has a lem.. Two files are needed to solve linear programs. One a number of linear, mixed integer linear, nonlinear, and mixed MPS (IBM-Mathematical Programming System) file, is re- integer nonlinear solvers, including MINOS, CONOPT, quired for all problems to define the names of all variables CPLEX, DICOPT, LAMPS, XA, and OSL, among others.['] and constraints and to specify the bounds and initial values AMPL appeared in 1993 and includes,,~e solvers MINOS, for variables. The other is a SPECS (Specifications) file that sets various run-time parameters. Xueyu Chen is a PhD candidate in chemical engineering at Louisiana For nonlinear programming problems, two additional FOR- State University. TRAN subroutines, FUNOBJ and FUNCON, are required. Krlshnsraj S. RBO received his MS degree from Louisiana State Univer- sity in computer engineering and is currently with Intel Corporation in Palo The nonlinear parts of the objective function are provided in Alto, California. a FORTRAN subroutine FUNOBJ, and the nonlinear con- JufBng Yu is a PhD candidate in industrial engineering at Louisiana State University. straints are defined by the subroutine FUNCON. The sub- Ralph W. Pike Is the Paul M. Horlon Professor of Chemical Engineering routine FUNOBJ calculates values of the nonlinear part of at Louisiana State University. the objective function and as many gradients as possible. CI Copyright ChE Division of ASEE 1996 The subroutine FUNCON is used to evaluate the nonlinear 220 Chemical Engineering Eduction -- AMPL has essentially all of the TABLE 1 TABLE 2 features of GAMS but is more flex- GAMS Program for Problem Pi ible and interactive. The process and CiY AMPL Model File for Problem Pi economic models can be input in $TITLEExample Problem segments; debugging and running the # Input the bounds for the variables in the optimizationproblem * Define the variables in the optimization problem optimization can be done with the var X>=L, <=U; VARIABLES X,Y; results viewed. In GAMS, a model POSmvE VARIABLES X,Y; varY>=L, <=U; file has to be edited, and this file is *Specify the values of constants in the problem # Define the names of the constants in the problem PARAMETER cr Ivalue..J; param CT; run in a separate step. PARAMETER DTI value..J; paramDT; In summary, GAMS and AMPL PARAMETER All value..J; param Al PARAMETER A21 value..J; param A2 modeling languages act as a bridge PARAMETER A31 value..J; param A3 between mathematical programming . Define the objective function and constraints # Definetheobjectivefunction of the problem problems and FORTRAN solvers for EQUATIONS OBIFUN minimizeobj; P{X] +cr'x +O1'Y; problem fonnulation, and they can CONI # Define theconstraintequationsof theproblem apply different solvers to an optimi- CON2; subjectto CONI;fIX] + AI'Y =BI zation problem. Also, both have a OBIFUN..TCOST=E=p{X] + Cf'X+DT'Y; subject to CON2: A2'X + AJ'Y =B2; CONI.. qX] +AI'Y=E=BI; presolve phase that uses bound tight- CON2.. A2'X + AJ'Y=E=B2 (b.)AMPL Data File for Problem Pi ening procedures and variable sub- 'Imposethe bounds on the variables stitutions to reduce the number of X.UP=U; # Inputthe values of the constants in the problem constraints and variables. On the Y.UP = U; param cr :=value ; other hand, FORTRAN solvers pro- X.LO = L; param DT :=value ; Y.1O=L; param Al :=value ; vide experienced modelers with 'Specify the equations included by model 'Example" param A2 :=value ; more flexibility in setting run-time MODELExampleJalV; param A3 :=value ; parameters, which is important for . Give the solve statement large and complicated problems. SOL VB Example USING NLP MINIMIZING TeOST; . Display the optimaJ solution GAMS AND AMPL STATEMENTS DISPLAY X.L, Y.L; OF THE OPTIMIZATION PROBLEM Both linear and nonlinear programming problems can be expressed in the following standard mathematical fonn used constraints and as many elements of the Jacobian matrix as by MINOS: possible. The current version of MINOS is 5.4, which added a callable subroutine feature to version 5.3. minimize F(x)+cTx+dTy objective function GAMS 2.25 is described as a high-level language that subject to f(x)+A!y=bJ nonlinear and linear (PI) makes concise algebraic statements of mathematical pro- Azx + A3y = bz equality constra iots gramming models in a language that is relatively easy to 1S;(x,y)S;u var iable bounds read and write and hence is easy to understand and imple- ment,11!Further, the advantages of GAMS over FORTRAN where the vectors (c, d, bl' bz,l, u) and the matrices (AI' A" solvers like MINOS are described as providing a computer and A,) are constants, where F(x) is a smooth scalar func- language for compact representation of large and complex tion, and where f(x) is a vector of smooth functions)61PI is a models, allowing changes to be made in model specifica- linear programming problem if x is zero. The objective tions simply and safely, having unambiguous statements of function gives a measure of the profit or cost of the operation algebraic relationships, and permitting model descriptions of a plant, and the constraint equations represent material that are independent of solution algorithms. and energy balances, rate equations, equilibrium relations, A GAMS program is a collection of statements in the demand for product, availability of raw material, etc. GAMS language. These statements consist of the sentences The GAMS and AMPL statements are given in Tables I that defme data structures, initial values, and data modifica- and 2 for the mathematical programming problem PI with tions and of equations that provide relationships among the the parameters and variables as scalars. The AMPL model variables. When problems contain matrices and vectors, sets file is in Table 2a and the data ftle is in Table 2b. As can be and indices are used to express these statements in a concise seen in Tables I and 2a,b, the modeling language representa- fonn. The program calls on an adapted version of a solver, tions are similar to the mathematical statements for problem such as MINOS, that is controlled by a number of default PI. Both start by defining variables and parameters and then parameters or "options" similar to the SPECS file in MINOS. follow with the objective function and constraints. GAMS Summer 1996 221 has the values of parameters with their definitions, and AMPL has the values of parameters in a data file. These TABLE 3 programs are easy to read, and they can be checked by Description of Standard Optimization Problems people other than the modeler. A nonlinear fuel oil allocation optimization problem PROBLEM DESCRIPTION by Karimi from the CACHE compilation of GAMS RefineryScheduling A refinery produced gasoline, healing oil, jet fuel, and IS] models is given in the appendix with the GAMS, LP lube oil from limited amount of 4 different crudes. The AMPL, and MINOS codes and solutions. This is a 9 variables objective was to maximize the profit per week by increas- 4 eq., 8 ineq. constraints ing product sales and reducingthe operating and purchase representative illustration for the comparison of these costs of crude(Karimiin [5]) three methods.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us