General Constants
There are three types of constants.
Constructing models, such as optimization directions, constraint senses or variable types.
Accessing solution results, such as API return code, basis status and LP status.
Monitoring optimization progress, such as callback context.
Version information
VERSION_MAJOR
The major version number.
VERSION_MINOR
The minor version number.
VERSION_TECHNICAL
The technical version number.
Optimization directions
For different optimization scenarios, it may be required to either maximize or minimize the objective function. There are two optimization directions:
MINIMIZE
For minimizing the objective function.
MAXIMIZE
For maximizing the objective function.
The optimization direction is automatically set when reading in a problem from file. Besides, COPT provides relevant functions, allowing user to explicitly set. Functions for different APIs are listed below:
Programming API 
Function 

C 

C++ 

C# 

Java 

Python 

NOTE: The function names, calling methods and parameter names in different programming interfaces are slightly different. For details, please refer to the API parameters of each programming language.
Infinity and undefined value
Infinity
In COPT, the infinite bound is represented by a large value, whose default value is also available as a constant:
INFINITY
The default value (
1e30
) of the infinite bound.
Undefined Value
In COPT, the undefined value is represented by another large value. For example, the default solution value of MIP start is set to a constant:
UNDEFINED
Undefined value(
1e40`
).
Constraint senses
Traditionally, for optimization models, constraints are defined using senses. The most common constraint senses are:
LESS_EQUAL
For constraint in the form of \(g(x) \leq b\)
GREATER_EQUAL
For constraint in the form of \(g(x) \geq b\)
EQUAL
For constraint in the form of \(g(x) = b\)
In additional, there are two less used constraint senses:
FREE
For unconstrained expression
RANGE
For constraints with both lower and upper bounds in the form of \(l \leq g(x) \leq u\).
NOTE: Using constraint senses is supported by COPT but not recommended. We recommend defining constraints using explicit lower and upper bounds.
Variable types
Variable types are used for defining whether a variable is continuous or integral.
CONTINUOUS
Noninteger continuous variables
BINARY
Binary variables
INTEGER
Integer variables
SOS constraint types
SOS constraint (Special Ordered Set) is a kind of special constraint that places restrictions on the values that a set of variables can take. COPT currently support two types of SOS constraints:
SOS_TYPE1
SOS1 constraint
At most one variable in the constraint is allowed to take a nonzero value.
SOS_TYPE2
SOS2 constraint
At most two variables in the constraint are allowed to take nonzero value, and those nonzero variables must be contiguous.
NOTE: Variables in SOS constraints are allowed to be continuous, binary and integer.
Indicator constraint types
Indicator constraint is a kind of logical constraints in COPT, used to describe the relationship between the value of the binary variable \(y\) and whether the linear constraint \(a^{T}x \leq b\) is satisfied. Currently, COPT supports three types of indicator constraints:
INDICATOR_IF
IfThen:
If \(y=f\) , then the linear constraint \(a^{T}x \leq b\) is satisfied.
If \(y\ne f\) , then the linear constraint \(a^{T}x \leq b\) is invalid (may be violated).
INDICATOR_ONLYIF
OnlyIf:
If the linear constraint \(a^{T}x \leq b\) is satisfied, then \(y=f\) .
If the linear constraint \(a^{T}x \leq b\) is not satisfied, then \(y\) can be 0 or 1.
INDICATOR_IFANDONLYIF
IfandOnlyIf:
The linear constraint \(a^{T}x \leq b\) and \(y=f\) must be satisfied simultaneously or not satisfied simultaneously.
SOC constraint types
The SecondOrderCone (SOC) constraint is a special type of quadratic constraints. COPT supports two types of SOC constraints:
CONE_QUAD
: Regular SecondOrderCone
CONE_RQUAD
: Rotated SecondOrderCone
Exponential Cone type
COPT supports two types of exponential cone contraints:
EXPCONE_PRIMAL
: Primal exponential cone
EXPCONE_DUAL
: Dual exponential cone
Quadratic objective function
Besides linear objective function, COPT also supports general convex quadratic objective function.
The mathematical form is:
Where, \(x\) is an array of variables, \(Q\) is the quadratic part of the quadratic objective funtion and \(c\) is the linear part.
Quadratic constraint
Besides the special type of quadratic constraint, SecondOrderCone (SOC) constraint, COPT also supports general convex quadratic constraint.
The mathematical form is:
Where, \(x\) is an array of variables, \(Q\) is the quadratic part of the quadratic constraint and \(c\) is the linear part.
Basis status
For an LP problem with \(n\) variables and \(m\) constraints, the constraints are treated as slack variables internally, resulting in \(n+m\) variables. When solving an LP problem using the simplex method, the simplex method fixes \(n\) variables at one of their bounds, and then computes solutions for the other \(m\) variables. The \(m\) variables with computed solution are called basic variables, and the other \(n\) variables are called nonbasic variables. The simplex progress and its final solution can be defined using the basis status of all the variables and constraints. The basis status supported by COPT are listed below:
Basis status codes 
Value 
Description 


0 
The variable is nonbasic at its lower bound 

1 
The variable is basic 

2 
The variable is nonbasic at its upper bound 

3 
The variable is nonbasic but not any of its bounds 

4 
The variable is nonbasic and fixed at its bound 
Solution status
Possible solution status values are listed below:
Status Codes 
Value 
Description 


0 
The solving process is not started yet 

1 
Optimal values founded 

2 
The model is infeasible 

3 
The objective is unbounded 

4 
The model is infeasible or unbounded 

5 
Numerical trouble encountered 

6 
Solving process not finished within node limit 

7 
The solution is imprecise 

8 
Solving process not finished within time limit 

9 
The solving process is stopped but solver cannot provide a solution because of numerical issues 

10 
The solving process is stopped by user interrupt 
Notes
In the Python API, solution status are defined in COPT’s General Constants Class. They can be accessed via the
"COPT."
prefix orModel.status
;In the Constant class of the Java API and C# API, the constants about the solution status are defined in the
Status
class;The linear programming solution status can be obtained through the attribute
"LpStatus"
, and the integer programming solution status can be obtained through the attribute"MipStatus"
.The LPrelaxation status of the current node can be obtained through the Callback information
"NodeStatus"
. The return value is as above, except forNODELIMIT
,UNSTARTED
,INF_OR_UNB
.
Client configuration
For floating and cluster clients, user are allowed to set client configuration parameters, currently available settings are:
CLIENT_CLUSTER
IP address of cluster server.
CLIENT_FLOATING
IP address of token server.
CLIENT_PASSWORD
Password of cluster server.
CLIENT_PORT
Connection port of token server.
CLIENT_WAITTIME
Wait time of client.
Notes:
The client configuration related parameters here are only supported to be set within EnvrConfig
.
Callback context
CBCONTEXT_INCUMBENT
Invokes the callback after a new incumbent was found.
CBCONTEXT_MIPRELAX
Invokes the callback when a new LPrelaxation solution is found.
CBCONTEXT_MIPSOL
Invokes the callback when a new MIP candidate solution is found.
CBCONTEXT_MIPNODE
Invokes the callback when a MIP node is finished and LPrelaxation has been solved.
Methods for accessing constants
In different programming interfaces, the ways of accessing constants are slightly different. In the C language interface,
the constant name is prefixed with "COPT_"
(like COPT_MAXIMIZE
). For details, please refer to the corresponding
chapters for each programming language API:
C API: C API Reference: Constants
C++ API: C++ API Reference: Constants
Java API: Java API Reference: General Constants
Python API: Python API Reference: General Constants