SolverStudio & CMPL

SolverStudio supports the COIN-OR CMPL language developed by Thomas Schleiff and Mike Steglich. Mike has an excellent text,  “Logistik-Entscheidungen” (Steglich, Feige, Klaus, De Grutyer Studium, 2016), that details (in German) SolverStudio’s use with CMPL.

To quote the CMPL page:

CMPL (<Coliop|Coin> Mathematical Programming Language) is a mathematical programming language and a system for mathematical programming and optimisation of linear optimisation problems.

The CMPL syntax is similar in formulation to the original mathematical model but also includes syntactic elements from modern programming languages. CMPL is intended to combine the clarity of mathematical models with the flexibility of programming languages.

CMPL executes CBC (default), GLPK, SCIP, Gurobi and CPLEX directly to solve the generated model instance. Because it is also possible to transform the mathematical problem into MPS, Free-MPS or OSiL files, alternative solvers can be used.

CMPL is an open source project licensed under GPLv3. It is written in C++ and is available for most of the relevant operating systems (Windows, OS X, Linux and Raspbian).

The CMPL distribution contains Coliop which is an (simple) IDE (Integrated Development Environment) for CMPL. Coliop is an open source project licensed under GPLv3. It is written in Java and is an integral part of the CMPL distribution.

The CMPL package also contains pyCMPL, jCMPL and CMPLServer.

pyCMPL is the CMPL application programming interface (API) for Python and an interactive shell and jCMPL is CMPL’s Java API. The main idea of this APIs is to define sets and parameters within the user application, to start and control the solving process and to read the solution(s) into the application if the problem is feasible. All variables, objective functions and constraints are defined in CMPL. These functionalities can be used with a local CMPL installation or a CMPLServer.

CMPLServer is an XML-RPC-based web service for distributed and grid optimisation that can be used with CMPL, pyCMPL and jCMPL. It is reasonable to solve large models remotely on the CMPLServer that is installed on a high performance system. CMPL provides four XML-based file formats for the communication between a CMPLServer and its clients. (CmplInstance, CmplSolutions, CmplMessages, CmplInfo).

pyCMPL, jCMPL and CMPLServer are licensed under LGPLv3.

CMPL, Coliop, pyCMPL, jCMPL and CMPLServer are COIN-OR projects initiated by the Technical University of Applied Sciences Wildau and the Institute for Operations Research and Business Management at the Martin Luther University Halle-Wittenberg.

5 thoughts on “SolverStudio & CMPL

  1. You have to rewrite your constraint to be linear. For each stew, your constraint is sum(ingredient(i)*veggie_content(i))/sum(ingredient(i)) <= veggie_limit(i). it can be rearrange to sum( ingredient(i)*(veggie_content(i)-veggie_limit(i)))<=0
  2. Thanks for the reply Mike! I have having a hard time getting this “simple” problem to run: Have the option to make any or all of these stews: Veggie, Hearty or Meaty with the following attributes: • Veggie price is $25/lbs with a max veggie content of 999 • Hearty price is $30/lbs and a max veggie content of 850 • Meaty price is $35/lbs and a max veggie content of 775 I have four 4 bases to include and must use all of each: • Noodle Medley has 850 veggies/lbs and a total of 100 lbs • Beef Broth has 770 veggies/lbs and a total of 50 lbs • Rice pilaf has 825 veggies/lbs and a total of 200 lbs • Tomato Goulash has 900 veggies/lbs and a total of 150 lbs Trying to create maximum profit but stay under the max veggies. How can I structure the constraints (or parameters) to ensure each stew is under the max veggie content, this is the current equation: For each stew sum lbs for 4 bases allocated to that stew and divide by veggies/lbs for each to return the weighted average veggie/lbs Thanks in advance for your help.
    • Without diving to deep in your example I would like to suggest to take a look at the diet problem which sounds a little bit similar. Please take a look at: http://cmpl.th-wildau.de/examples.php https://neos-guide.org/content/diet-problem
  3. Dear Jason, unfortunately, you cannot use division directly in an objective function or constraint. Please see pages 33-34 in the manual. An indirect way for parameters (e.g. a) is to assign a new parameter with the the reciprocal (eg. b:=1/a) within the parameters section. The new parameter can be multiplied in the objective function or a constraint. If you want do divide a variable then it is a little bit more complicated. If you give me an impression for what exactly you want to use a division in this way I could give you some hints. Thanks, Mike
  4. How can I use division in either the objectives or constraints? It must be possible somehow If I open up the CMPL Transportation example and simply change * to / in the objectives formula I get "syntax error, unexpected '/', expecting '}'". I've looked for examples, support groups for the answer but I can't find anything. I've also tried putting the word div in place and same behaviour.

Leave a Reply

Your email address will not be published. Required fields are marked *