CONOPT#
A proven choice for highly nonlinear problems, CONOPT’s efficient and reliable multi-method architecture handles a broad range of models. Specialized techniques achieve feasibility quickly, while powerful preprocessing tools reduce problem size and suggest formulation improvements.
Product Page | Features | Options | Changes
Download CONOPT | Start a CONOPT Trial Now!
How to use it#
How to install using amplpy:
# Install Python API for AMPL:
$ python -m pip install amplpy --upgrade
# Install AMPL & solver modules:
$ python -m amplpy.modules install conopt # install CONOPT
# Activate your license (e.g., free ampl.com/ce or ampl.com/academia licenses):
$ python -m amplpy.modules activate <your-license-uuid>
How to use:
from amplpy import AMPL
ampl = AMPL()
...
ampl.solve(solver="conopt", conopt_options="option1=value1 option2=value2")
Learn more about what we have to offer to implement and deploy Optimization in Python.
ampl: option solver conopt; # change the solver
ampl: option conopt_options 'option1=value1 option2=value2'; # specify options
ampl: solve; # solve the problem
Features#
Algorithms#
Generalized reduced gradient (local)
CONOPT is an active-set method (GRG with SLP and SQP phases, flg_slpmode,
flg_sqpmode); it returns local optima, and it treats integer variables
as continuous. Limits: maxftime (seconds), iterlim. flg_convex=1
declares the model convex.
Modeling with MP expressions#
MP expressions: logic, counting, complementarity (MP2NL)
Natively, CONOPT solves smooth nonlinear models with continuous variables. MP’s expressions (==>, or, atmost, count, alldiff, piecewise-linear terms, …) and complements are not part of its native model type: through MP2NL, MP reformulates them into it first.
The CONOPT driver includes the MP2NL bridge: set mp2nl=1 in conopt_options. MP’s own options (cvt:..., sol:chk:...) then go into the AMPL option mp_options.
CONOPT is a continuous solver: it relaxes the binary variables that MP uses for logical constraints, and the result can violate the logic (MP’s solution check then reports it). Use it for constructs that need no binaries, such as complementarity with a smooth reformulation (cvt:compl=1 or 2); use an MINLP solver for models with logic.
ampl.solve(solver="conopt", conopt_options="mp2nl=1", mp_options="cvt:compl=1")
ampl: option solver conopt;
ampl: option conopt_options 'mp2nl=1';
ampl: option mp_options 'cvt:compl=1';
ampl: solve;
More: Meta-driver MP2NL.
Options#
Full list of solver options:
Retrieving solutions#
The outcome of the last optimization is stored in the AMPL parameter solve_result_num and the relative message in
solve_result.
display solve_result_num, solve_result;
CONOPT solve result codes:
Solve result table (AMPL default ranges)
0- 99 solved: optimal for an optimization problem, feasible for a satisfaction problem
100-199 solved? solution candidate returned but error likely
200-299 infeasible
300-399 unbounded
400-499 limit
500-999 failure, no solution returned
Changelog#
- CONOPT Changelog
- 20261029
- 20251022
- 20251021
- 20251017
- 20250527
- 20250312
- 20240710
- 20240418
- 20240201
- 20211109
- 20210410.1
- 20210410
- 20201029
- 20201018
- 20201005
- 20190908
- 20190715
- 20190315
- 20181221
- 20181221
- 20181210
- 20181120
- 20180609
- 20180525
- 20180519
- 20180503
- 20180402
- 20180314
- 20180302
- 20180121
- 20171129
- 20170801
- 20170619
- 20170515
- 20170511
- 20160831
- 20160608
- 20160329
- 20160126
- 20151208
- 20150814
- 20150630
- 20150602
- 20150524
- 20150424
- 20150122
- 20141124
- 20141013
- 20141004
- 20140409
- 20131023
- 20131018
- 20130823
- 20130419
- 20130320
- 20120320
- 20120126
- 20120120
- 20120117
- 20111229
- 20111220
- 20111107
- 20111003
- 20110527
- 20110426
- 20110315
- 20110125