COPT.CallbackFunction
— TypeCallbackFunction()
Set a generic COPT callback function.
Callback function should be of the form
callback(cb_data::CallbackData, cb_context::Cint)
Note: before accessing MOI.CallbackVariablePrimal
, you must call COPT.load_callback_variable_primal(cb_data, cb_context)
.
COPT.ConeOptimizer
— TypeConeOptimizer(env::Union{Nothing, Env} = nothing)
Create a new ConeOptimizer object. ConeOptimizer must be used in place of Optimizer for semi-definite programming (SDP) problems; i.e. for models with matrix variables.
You can share COPT Env
s between models by passing an instance of Env
as the first argument.
Set optimizer attributes using MOI.RawOptimizerAttribute
or JuMP.set_optimizer_atttribute
.
Example
using JuMP, COPT
const env = COPT.Env()
model = JuMP.Model(() -> COPT.ConeOptimizer(env)
set_optimizer_attribute(model, "LogToConsole", 0)
COPT.PassNames
By default, variable and constraint names are stored in the MOI wrapper, but are not passed to the inner COPT model object because doing so can lead to a large performance degradation. The downside of not passing names is that various log messages from COPT will report names like constraint "R1" and variable "C2" instead of their actual names. You can change this behavior using COPT.PassNames
to force COPT.jl to pass variable and constraint names to the inner COPT model object:
using JuMP, COPT
model = JuMP.Model(COPT.ConeOptimizer)
set_optimizer_attribute(model, COPT.PassNames(), true)
COPT.ConflictStatus
— TypeConflictStatus()
Return the raw status from COPT indicating the status of the last computed conflict. It returns an integer:
-1
ifcompute_conflict!
has not yet been called0
if no conflict was found1
if a conflict was found
COPT.Optimizer
— TypeOptimizer(env::Union{Nothing, Env} = nothing)
Create a new Optimizer object.
You can share COPT Env
s between models by passing an instance of Env
as the first argument.
Set optimizer attributes using MOI.RawOptimizerAttribute
or JuMP.set_optimizer_atttribute
.
Example
using JuMP, COPT
const env = COPT.Env()
model = JuMP.Model(() -> COPT.Optimizer(env)
set_optimizer_attribute(model, "LogToConsole", 0)
COPT.PassNames
By default, variable and constraint names are stored in the MOI wrapper, but are not passed to the inner COPT model object because doing so can lead to a large performance degradation. The downside of not passing names is that various log messages from COPT will report names like constraint "R1" and variable "C2" instead of their actual names. You can change this behavior using COPT.PassNames
to force COPT.jl to pass variable and constraint names to the inner COPT model object:
using JuMP, COPT
model = JuMP.Model(COPT.Optimizer)
set_optimizer_attribute(model, COPT.PassNames(), true)
COPT.PassNames
— TypePassNames() <: MOI.AbstractOptimizerAttribute
An optimizer attribute to control whether COPT.jl should pass names to the inner COPT model object. See the docstring of COPT.Optimizer
for more information.
COPT._farkas_variable_dual
— Method_farkas_variable_dual(model::Optimizer, col::Cint)
Return a Farkas dual associated with the variable bounds of col
.
Compute the Farkas dual as:
ā * x = λ' * A * x <= λ' * b = -β + sum(āᵢ * Uᵢ | āᵢ < 0) + sum(āᵢ * Lᵢ | āᵢ > 0)
The Farkas dual of the variable is ā, and it applies to the upper bound if ā < 0, and it applies to the lower bound if ā > 0.
COPT._get_variable_lower_bound
— Method_get_variable_lower_bound(model, info)
Get the current variable lower bound, ignoring a potential bound of 0.0
set by a second order cone constraint.
See also _set_variable_lower_bound
.
COPT._matching_sparsity_pattern
— Method_matching_sparsity_pattern(
f1::MOI.ScalarAffineFunction{Float64},
f2::MOI.ScalarAffineFunction{Float64}
)
Internal function, not intended for external use.
Determines whether functions f1
and f2
have the same sparsity pattern w.r.t. their constraint columns. Assumes both functions are already in canonical form.
COPT._replace_with_different_sparsity!
— Method_replace_with_different_sparsity!(
model::Optimizer,
previous::MOI.ScalarAffineFunction,
replacement::MOI.ScalarAffineFunction, row::Int
)
Internal function, not intended for external use.
Change the linear constraint function at index `row` in `model` from
previous
to replacement
. This function assumes that previous
and replacement
may have different sparsity patterns.
This function (and _replace_with_matching_sparsity!
above) are necessary because in order to fully replace a linear constraint, we have to zero out the current matrix coefficients and then set the new matrix coefficients. When the sparsity patterns match, the zeroing-out step can be skipped.
COPT._replace_with_matching_sparsity!
— Method_replace_with_matching_sparsity!(
model::Optimizer,
previous::MOI.ScalarAffineFunction,
replacement::MOI.ScalarAffineFunction, row::Int
)
Internal function, not intended for external use.
Change the linear constraint function at index row
in model
from previous
to replacement
. This function assumes that previous
and replacement
have exactly the same sparsity pattern w.r.t. which variables they include and that both constraint functions are in canonical form (as returned by MOIU.canonical()
. Neither assumption is checked within the body of this function.
COPT._search_param_attr
— Method_search_param_attr(model::Union{Optimizer,ConeOptimizer}, name::AbstractString) -> Int
Returns the type of a COPT parameter or attribute, given its name. -1: unknown 0: double parameter 1: int parameter 2: double attribute 3: int attribute
COPT._set_variable_lower_bound
— Method_set_variable_lower_bound(model, info, value)
This function is used to indirectly set the lower bound of a variable.
We need to do it this way to account for potential lower bounds of 0.0 added by VectorOfVariables-in-SecondOrderCone constraints.
See also _get_variable_lower_bound
.
COPT.column
— Methodcolumn(model::Optimizer, c::MOI.ConstraintIndex{MOI.VariableIndex, <:Any})
Return the 1-indexed column associated with c
.
The C API requires 0-indexed columns.
COPT.column
— Methodcolumn(model::Optimizer, x::MOI.VariableIndex)
Return the 1-indexed column associated with x
.
The C API requires 0-indexed columns.
COPT.load_callback_variable_primal
— Methodload_callback_variable_primal(cb_data, cb_context)
Load the solution during a callback so that it can be accessed using MOI.CallbackVariablePrimal
.