COPT#
Cardinal Optimizer (COPT) incorporates a full suite of solvers for linear, convex quadratic, and second-order conic mixed-integer programming. It ranks at the top of benchmark tests on continuous linear programs, and has been fully extended to handle integer variables. The framework used by the driver supports automatic reformulation for many expression types; the modeling guide can be found here.
[Read More] [Modeling guide] [Options] [Changes] [Download COPT]
How to use it#
ampl: option solver copt; # change the solver
ampl: option copt_options 'option1=value1 option2=value2'; # specify options
ampl: solve; # solve the problem
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 copt # install COPT
# Activate your license (e.g., free ampl.com/ce or ampl.com/courses licenses):
$ python -m amplpy.modules activate <your-license-uuid>
How to use:
from amplpy import AMPL
ampl = AMPL()
...
ampl.solve(solver="copt", copt_options="option1=value1 option2=value2")
Learn more about what we have to offer to implement and deploy Optimization in Python.
Resources#
Solver options#
Full list of solver options:
More details on solver options: Features guide.
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;
COPT solve result codes can be obtained by running copt -!
or ampl: shell "copt -!";
:
Solve result table for COPT 7.1.3
0- 99 solved: optimal for an optimization problem,
feasible for a satisfaction problem
100-199 solved? solution candidate returned but error likely
150 solved? MP solution check failed (option sol:chk:fail)
200-299 infeasible
300-349 unbounded, feasible solution returned
350-399 unbounded, no feasible solution returned
400-449 limit, feasible: stopped, e.g., on iterations or Ctrl-C
450-469 limit, problem is either infeasible or unbounded.
Disable dual reductions or run IIS finder for definitive answer.
470-499 limit, no solution returned
500-999 failure, no solution returned
550 failure: numeric issue, no feasible solution
For general information, see MP result codes guide.
Changelog#
- COPT Changelog
- 20241228
- 20240724
- 20240617
- 20240604
- 20240531
- 20240529
- 20240429
- 20240410
- 20240320
- 20240115
- 20231117
- 20231103
- 20231017
- 20230919
- 20230831
- 20230817
- 20230726
- 20230724
- 20230621
- 20230616
- 20230428
- 20230424
- 20230330
- 20230207
- 20221228
- 20221222
- 20221211
- 20230207
- 20221012
- 20220928
- 20220715
- 20220615
- 20220526
- 20220511
- 20220411