9
$\begingroup$

Some optimization software/frameworks (commercial or open-source) such as AMPL, GAMS, Cplex, ... have a specific Algebraic modelling language. Some of them have another type of programming that uses APIs to connect with general programming languages ​​like C ++ / Java or others.

AFAIK, Algebraic modelling language is a bit easier than general programming to write optimization models. I would like to know, especially in the practical situation (solving a real-world optimization model):

1) What is the difference between them?

2) Is it necessary to know a general programming language to write an optimization model?

3) What is the benefit of using a specific Algebraic modelling language over others (for instance GAMS Vs AMPL or OPL)?

$\endgroup$
  • 1
    $\begingroup$ Ease of writing the model is certainly a factor. Another factor you should not overlook is that a model in a modeling language is typically easier (perhaps much easier) to read and understand than a model in a general programming language. That makes it easier to find bugs, easier to maintain the model and easier to explain the model to others. $\endgroup$ – prubin Aug 24 at 20:48
  • $\begingroup$ @Prubin, thanks so much for your comment. I know, modelling languages like GAMS, OPL, ... are suitable to use in academic situations. But, the thing I don't know is that, have they had enough flexibility to solve real-world problems? and could we use them in the industry? $\endgroup$ – abbas omidi Aug 25 at 8:45
7
$\begingroup$

GAMS and AMPL are general purpose modelling languages and can he used to describe any type of nonlinear function, including some niche stuff like floor, ceil, max, etc (AMPL). I don't have experience with OPL so I can't comment on that. The purpose of these languages is twofold:

  1. They provide a solver interface for your math. Solvers typically require input in a matrix or computational graph format, and for some (e.g. IPOPT) users need to also provide derivatives as callbacks. AMPL/GAMS take care of that for us.
  2. They enable the modeller to describe the problem using set notation which is a very powerful way to describe complicated problems.

To answer your questions specifically:

  1. The difference among the languages is mainly in syntax and that they are typically tied to that vendor's product, i.e. you need AMPL to interpret AMPL models. For most cases users won't experience any limitations using one vs the other unless they are doing advanced stuff, e.g. generating defining variables/constraints (AMPL), or coding loops in their model (GAMS).
  2. No it is not necessary to know a programming language. Especially for AMPL, it pretty much looks like typing math.
  3. At the end of the day it depends on what platform you want to use and what solvers are available. GAMS has a workable GUI and many more solvers than AMPL, however AMPL is blazingly fast for large problems. In my opinion, the AMPL language is also much easier to read and to work with than the GAMS language is. I suggest that you download their demos and read some examples to get a feel for the two platforms and see which one works best for you.
$\endgroup$
  • 1
    $\begingroup$ thanks for the useful note. I have often used modelling language instead of general programming language. But, in the industry, many times, we would need to have a flexible program which can be used more than one time (for instance, every day to release a production schedule). I think such a program, needs some advanced features (for example, the capability to use by non-expert people or specific outputs that may be easy with using general programming). Would you know, can we do that with modelling language? $\endgroup$ – abbas omidi Aug 25 at 10:13
  • 2
    $\begingroup$ @abbasomidi In industrial settings, it is common that the model stays the same but the data (parameter values) change with each use. Modeling languages separate parameters from variables/constraints/objectives and can read the parameter values from data files (possibly supporting multiple file formats) or, I believe, from database connections (via SQL queries?). I think some have spreadsheet (read: Excel) connectors as well. To the modeling language vendors, this is an expected use case. I believe they also provide comparable output facilities. So as long as the model is static, no worries. $\endgroup$ – prubin Aug 26 at 14:27
  • $\begingroup$ @prubin, many thanks for the detailed explanation. :) $\endgroup$ – abbas omidi Aug 26 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.