I want to write mathematical optimization software. At university, they taught me how to use AMPL+CPLEX/SCIP/MINOS/Couenne etc.. and that was good enough. But I cannot afford the cost of AMPL for my personal use and I don't want to have any limitation in the size of the problem.

  • Is there any real free alternative to AMPL?
  • If I write C++ code which uses opensource optimizator libraries like Couenne, can I use that software to make money? (For example, I saw that the Android camera uses an open source LMS optimizer.)

4 Answers 4


Is there any free alternative to AMPL?

(Edit: I spoke too soon; thanks to mlubin for pointing this out.) If you don't care too much about convenience, there are open-source formats for specifying nonlinear programs (the SIF and NOP formats), but then you have to translate that format into a form your solver can actually use. Since the CUTEr/CUTEst test sets use the SIF format, you might be able to leverage any interface a given solver has with those test sets and adapt it to reading whatever SIF files you want to produce.

As far as popular modeling frameworks go, GAMS has a free trial version, but the number of decision variables allowed in a formulation is capped. NEOS has GAMS and AMPL interfaces, so you could submit jobs on NEOS and then retrieve the results via, for instance, e-mail.

There are free modeling frameworks out there, like PuLP (lightweight, used for LPs; I used it in my thesis) and Pyomo, so you might be able to use those. Miles (mlubin) talks about a Julia-based framework in his answer. A partial list of frameworks can be found in this preprint.

You can also write solver-specific code. Couenne, for instance, is freely available, and you can use its native API to solve problems. Of course, repeating this process for every solver you might want to use is inconvenient.

If I write C++ code which uses open source optimizers like Couenne, can I use that software to make money?

IANAL, and it depends on the license. Couenne, for instance, is licensed under the Eclipse Public License (EPL). It doesn't prohibit you from using the software for commercial purpose (for instance, in designing a device). A quick read of the license (again, I should emphasize, IANAL) suggests that you can sell commercial software based on Couenne, and that if you include the Couenne source code as part of that software, then you must also provide the Couenne source code or tell people how they can obtain it.

Similarly, BSD- and GPL-licensed software may be sold commercially, provided you comply with the terms of the respective licenses. In the case of the GPL, you must also provide the source code freely.


Is there any real free alternative to AMPL?

Yes! (Sorry to contradict you, Geoff.) There is a real free alternative to AMPL. JuMP is a free and open-source modeling language built on top of Julia. It is capable of modeling large-scale linear, mixed-integer, and most recently nonlinear programming problems. SCIP support will be coming soon, along with mixed-integer nonlinear programming. Check out the documentation and let us know if there's any way we can help out. Julia is still a young language, so you shouldn't expect the stability of C++ or AMPL, but if you're willing to be an early adopter, you get a combination of performance and features that historically hasn't been available in free software.

If I write C++ code which uses opensource optimizator libraries like Couenne, can I use that software to make money?

JuMP is LGPL licensed, which means that you can use it as part of a closed-source commercial product if you comply with the terms of the license. JuMP depends on solvers (both commercial and open-source) which have their own respective licences.

Edit by yeesian:

Looks interesting, thank you! I'll wait to test it (or to know other users' feedbacks) before accept this answer, though.

There are some simple examples available, for urban planning, sudoku, and travelling salesman. It has also been used in the MIT course 15.S60 "Software Tools for Operations Research" (github repo) too. For an updated list of solvers supported, check the JuliaOpt website.

  • $\begingroup$ Looks interesting, thank you! I'll wait to test it (or to know other users' feedbacks) before accept this answer, though. $\endgroup$
    – HAL9000
    May 7, 2014 at 17:52
  • $\begingroup$ Happy to be contradicted if it means there are other modeling frameworks out there. For LPs, PuLP and Coopr provide an abstraction layer to solvers, but given that the OP mentioned Couenne, I figured they wanted something capable of handling at least NLPs. $\endgroup$ May 7, 2014 at 18:37
  • $\begingroup$ I'll mention that Coopr/Pyomo is capable of modeling NLP and probably calling Couenne as well, because they directly write out to AMPL's NL format that many solvers can use. $\endgroup$
    – mlubin
    May 7, 2014 at 18:46
  • $\begingroup$ Cool! I must have stopped skimming the Pyomo docs before they described the nonlinear functionality; I used PuLP in my thesis. $\endgroup$ May 7, 2014 at 19:01

If you haven't already, check out DAKOTA. Very extensive optimization capabilities and well supported. It's free under the LGPL license, which means you can use it in a commercial application subject to some constraints (I believe you have to dynamically and not statically link, and still allow for modification of that LGPL part, but obviously consult with a lawyer if this is an important issue for you.)


It was already mentioned but you should have a look at Pyomo-Coopr as a modelling language similar to AMPL (but using Python) that have interfaces to a variety of third-party solvers.


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.