Model::AddCone()

Add a cone constraint to a model, given its dimension.

Synopsis

Cone AddCone(

int dim,

int type,

char *pvtype,

const char *szPrefix)

Arguments

dim: dimension of the cone constraint.

type: type of the cone constraint.

pvtype: types of variables in the cone.

szPrefix: name prefix of variables in the cone.

Return

object of new cone constraint.

Model::AddCone()

Add a cone constraint to model.

Synopsis

Cone AddCone(const ConeBuilder &builder)

Arguments

builder: builder for new cone constraint.

Return

new cone constraint object.

Model::AddCone()

Add a cone constraint to model.

Synopsis

Cone AddCone(const VarArray &vars, int type)

Arguments

vars: variables that participate in the cone constraint.

type: type of the cone constraint.

Return

object of new cone constraint.

Model::AddConstr()

Add a linear constraint to model.

Synopsis

Constraint AddConstr(

const Expr &expr,

char sense,

double rhs,

const char *szName)

Arguments

expr: expression for the new contraint.

sense: sense for new linear constraint, other than range sense.

rhs: right hand side value for the new constraint.

szName: optional, name of new constraint.

Return

new constraint object.

Model::AddConstr()

Add a linear constraint to model.

Synopsis

Constraint AddConstr(

const Expr &lhs,

char sense,

const Expr &rhs,

const char *szName)

Arguments

lhs: left hand side expression for the new constraint.

sense: sense for new linear constraint, other than range sense.

rhs: right hand side expression for the new constraint.

szName: optional, name of new constraint.

Return

new constraint object.

Model::AddConstr()

Add a linear constraint to model.

Synopsis

Constraint AddConstr(

const Expr &expr,

double lb,

double ub,

const char *szName)

Arguments

expr: expression for the new constraint.

lb: lower bound for the new constraint.

ub: upper bound for the new constraint

szName: optional, name of new constraint.

Return

new constraint object.

Model::AddConstr()

Add a linear constraint to a model.

Synopsis

Constraint AddConstr(const ConstrBuilder &builder, const char *szName)

Arguments

builder: builder for the new constraint.

szName: optional, name of new constraint.

Return

new constraint object.

Model::AddConstrs()

Add linear constraints to model.

Synopsis

ConstrArray AddConstrs(

int count,

char *pSense,

double *pRhs,

const char *szPrefix)

Arguments

count: number of constraints added to model.

pSense: sense array for new linear constraints, other than range sense.

pRhs: right hand side values for new variables.

szPrefix: name prefix for new constraints.

Return

array of new constraint objects.

Model::AddConstrs()

Add linear constraints to a model.

Synopsis

ConstrArray AddConstrs(

int count,

double *pLower,

double *pUpper,

const char *szPrefix)

Arguments

count: number of constraints added to the model.

pLower: lower bounds of new constraints.

pUpper: upper bounds of new constraints.

szPrefix: name prefix for new constraints.

Return

array of new constraint objects.

Model::AddConstrs()

Add linear constraints to a model.

Synopsis

ConstrArray AddConstrs(

int count,

double *pLower,

double *pUpper,

const char *szNames,

size_t len)

Arguments

count: number of constraints added to the model.

pLower: lower bounds of new constraints.

pUpper: upper bounds of new constraints.

szNames: name buffer of new constraints.

len: length of the name buffer.

Return

array of new constraint objects.

Model::AddConstrs()

Add linear constraints to a model.

Synopsis

ConstrArray AddConstrs(const ConstrBuilderArray &builders, const char *szPrefix)

Arguments

builders: builders for new constraints.

szPrefix: name prefix for new constraints.

Return

array of new constraint objects.

Model::AddConstrs()

Add linear constraints to model.

Synopsis

ConstrArray AddConstrs(

const ConstrBuilderArray &builders,

const char *szNames,

size_t len)

Arguments

builders: builders for new constraints.

szNames: name buffer of new constraints.

len: length of the name buffer.

Return

array of new constraint objects.

Model::AddDenseMat()

Add a dense symmetric matrix to a model.

Synopsis

SymMatrix AddDenseMat(

int dim,

double *pVals,

int len)

Arguments

dim: dimension of the dense symmetric matrix.

pVals: array of non-zero elements, filled in column-wise up to len or max length of symmetric matrix.

len: length of value array.

Return

new symmetric matrix object.

Model::AddDenseMat()

Add a dense symmetric matrix to a model.

Synopsis

SymMatrix AddDenseMat(int dim, double val)

Arguments

dim: dimension of dense symmetric matrix.

val: value to fill dense symmetric matrix.

Return

new symmetric matrix object.

Model::AddDiagMat()

Add a diagonal matrix to a model.

Synopsis

SymMatrix AddDiagMat(int dim, double val)

Arguments

dim: dimension of diagonal matrix.

val: value to fill diagonal elements.

Return

new diagonal matrix object.

Model::AddDiagMat()

Add a diagonal matrix to a model.

Synopsis

SymMatrix AddDiagMat(

int dim,

double *pVals,

int len)

Arguments

dim: dimension of diagonal matrix.

pVals: array of values of diagonal elements.

len: length of value array.

Return

new diagonal matrix object.

Model::AddDiagMat()

Add a diagonal matrix to a model.

Synopsis

SymMatrix AddDiagMat(

int dim,

double val,

int offset)

Arguments

dim: dimension of diagonal matrix.

val: value to fill diagonal elements.

offset: shift distance against diagonal line.

Return

new diagonal matrix object.

Model::AddDiagMat()

Add a diagonal matrix to a model.

Synopsis

SymMatrix AddDiagMat(

int dim,

double *pVals,

int len,

int offset)

Arguments

dim: dimension of diagonal matrix.

pVals: array of values of diagonal elements.

len: length of value array.

offset: shift distance against diagonal line.

Return

new diagonal matrix object.

Model::AddEyeMat()

Add an identity matrix to a model.

Synopsis

SymMatrix AddEyeMat(int dim)

Arguments

dim: dimension of identity matrix.

Return

new identity matrix object.

Model::AddGenConstrIndicator()

Add a general constraint of type indicator to model.

Synopsis

GenConstr AddGenConstrIndicator(const GenConstrBuilder &builder)

Arguments

builder: builder for the general constraint.

Return

new general constraint object of type indicator.

Model::AddGenConstrIndicator()

Add a general constraint of type indicator to model.

Synopsis

GenConstr AddGenConstrIndicator(

Var binVar,

int binVal,

const ConstrBuilder &constr)

Arguments

binVar: binary indicator variable.

binVal: value for binary indicator variable that force a linear constraint to be satisfied(0 or 1).

constr: builder for linear constraint.

Return

new general constraint object of type indicator.

Model::AddGenConstrIndicator()

Add a general constraint of type indicator to model.

Synopsis

GenConstr AddGenConstrIndicator(

Var binVar,

int binVal,

const Expr &expr,

char sense,

double rhs)

Arguments

binVar: binary indicator variable.

binVal: value for binary indicator variable that force a linear constraint to be satisfied(0 or 1).

expr: expression for new linear contraint.

sense: sense for new linear constraint.

rhs: right hand side value for new linear constraint.

Return

new general constraint object of type indicator.

Model::AddLazyConstr()

Add a lazy constraint to model.

Synopsis

void AddLazyConstr(

const Expr &lhs,

char sense,

double rhs,

const char *szName)

Arguments

lhs: expression for lazy contraint.

sense: sense for lazy constraint.

rhs: right hand side value for lazy constraint.

szName: optional, name of lazy constraint.

Model::AddLazyConstr()

Add a lazy constraint to model.

Synopsis

void AddLazyConstr(

const Expr &lhs,

char sense,

const Expr &rhs,

const char *szName)

Arguments

lhs: left hand side expression for lazy contraint.

sense: sense for lazy constraint.

rhs: right hand side expression for lazy contraint.

szName: optional, name of lazy constraint.

Model::AddLazyConstr()

Add a lazy constraint to model.

Synopsis

void AddLazyConstr(const ConstrBuilder &builder, const char *szName)

Arguments

builder: builder for lazy contraint.

szName: optional, name of lazy constraint.

Model::AddLazyConstrs()

Add lazy constraints to model.

Synopsis

void AddLazyConstrs(const ConstrBuilderArray &builders, const char *szPrefix)

Arguments

builders: array of builders for lazy contraints.

szPrefix: name prefix of new lazy constraints.

Model::AddLmiConstr()

Add an LMI constraint to model.

Synopsis

LmiConstraint AddLmiConstr(const LmiExpr &expr, const char *szName)

Arguments

expr: LMI expression for new LMI contraint.

szName: optional, name of new LMI constraint.

Return

new LMI constraint object.

Model::AddOnesMat()

Add a dense symmetric matrix of value one to a model.

Synopsis

SymMatrix AddOnesMat(int dim)

Arguments

dim: dimension of dense symmetric matrix.

Return

new symmetric matrix object.

Model::AddPsdConstr()

Add a PSD constraint to model.

Synopsis

PsdConstraint AddPsdConstr(

const PsdExpr &expr,

char sense,

double rhs,

const char *szName)

Arguments

expr: PSD expression for new PSD contraint.

sense: sense for new PSD constraint.

rhs: double value at right side of the new PSD constraint.

szName: optional, name of new PSD constraint.

Return

new PSD constraint object.

Model::AddPsdConstr()

Add a PSD constraint to model.

Synopsis

PsdConstraint AddPsdConstr(

const PsdExpr &expr,

double lb,

double ub,

const char *szName)

Arguments

expr: expression for new PSD constraint.

lb: lower bound for ew PSD constraint.

ub: upper bound for new PSD constraint

szName: optional, name of new PSD constraint.

Return

new PSD constraint object.

Model::AddPsdConstr()

Add a PSD constraint to model.

Synopsis

PsdConstraint AddPsdConstr(

const PsdExpr &lhs,

char sense,

const PsdExpr &rhs,

const char *szName)

Arguments

lhs: PSD expression at left side of new PSD constraint.

sense: sense for new PSD constraint.

rhs: PSD expression at right side of new PSD constraint.

szName: optional, name of new PSD constraint.

Return

new PSD constraint object.

Model::AddPsdConstr()

Add a PSD constraint to a model.

Synopsis

PsdConstraint AddPsdConstr(const PsdConstrBuilder &builder, const char *szName)

Arguments

builder: builder for new PSD constraint.

szName: optional, name of new PSD constraint.

Return

new PSD constraint object.

Model::AddPsdVar()

Add a new PSD variable to model.

Synopsis

PsdVar AddPsdVar(int dim, const char *szName)

Arguments

dim: dimension of new PSD variable.

szName: name of new PSD variable.

Return

PSD variable object.

Model::AddPsdVars()

Add new PSD variables to model.

Synopsis

PsdVarArray AddPsdVars(

int count,

int *pDim,

const char *szPrefix)

Arguments

count: number of new PSD variables.

pDim: array of dimensions of new PSD variables.

szPrefix: name prefix of new PSD variables.

Return

array of PSD variable objects.

Model::AddPsdVars()

Add new PSD variables to model.

Synopsis

PsdVarArray AddPsdVars(

int count,

int *pDim,

const char *szNames,

size_t len)

Arguments

count: number of new PSD variables.

pDim: array of dimensions of new PSD variables.

szNames: name buffer of new PSD variables.

len: length of the name buffer.

Return

array of PSD variable objects.

Model::AddQConstr()

Add a quadratic constraint to model.

Synopsis

QConstraint AddQConstr(

const QuadExpr &expr,

char sense,

double rhs,

const char *szName)

Arguments

expr: quadratic expression for the new contraint.

sense: sense for new quadratic constraint.

rhs: double value at right side of the new quadratic constraint.

szName: optional, name of new quadratic constraint.

Return

new quadratic constraint object.

Model::AddQConstr()

Add a quadratic constraint to model.

Synopsis

QConstraint AddQConstr(

const QuadExpr &lhs,

char sense,

const QuadExpr &rhs,

const char *szName)

Arguments

lhs: quadratic expression at left side of the new quadratic constraint.

sense: sense for new quadratic constraint.

rhs: quadratic expression at right side of the new quadratic constraint.

szName: optional, name of new quadratic constraint.

Return

new quadratic constraint object.

Model::AddQConstr()

Add a quadratic constraint to a model.

Synopsis

QConstraint AddQConstr(const QConstrBuilder &builder, const char *szName)

Arguments

builder: builder for the new quadratic constraint.

szName: optional, name of new quadratic constraint.

Return

new quadratic constraint object.

Model::AddSos()

Add a SOS constraint to model.

Synopsis

Sos AddSos(const SosBuilder &builder)

Arguments

builder: builder for new SOS constraint.

Return

new SOS constraint object.

Model::AddSos()

Add a SOS constraint to model.

Synopsis

Sos AddSos(

const VarArray &vars,

const double *pWeights,

int type)

Arguments

vars: variables that participate in the SOS constraint.

pWeights: optional, weights for variables in the SOS constraint.

type: type of SOS constraint.

Return

new SOS constraint object.

Model::AddSparseMat()

Add a sparse symmetric matrix to a model.

Synopsis

SymMatrix AddSparseMat(

int dim,

int nElems,

int *pRows,

int *pCols,

double *pVals)

Arguments

dim: dimension of the sparse symmetric matrix.

nElems: number of non-zero elements in the sparse symmetric matrix.

pRows: array of row indexes of non-zero elements.

pCols: array of col indexes of non-zero elements.

pVals: array of values of non-zero elements.

Return

new symmetric matrix object.

Model::AddSymMat()

Given a symmetric matrix expression, add results matrix to model.

Synopsis

SymMatrix AddSymMat(const SymMatExpr &expr)

Arguments

expr: symmetric matrix expression object.

Return

results symmetric matrix object.

Model::AddUserCut()

Add a user cut to model.

Synopsis

void AddUserCut(

const Expr &lhs,

char sense,

double rhs,

const char *szName)

Arguments

lhs: expression for user cut.

sense: sense for user cut.

rhs: right hand side value for user cut.

szName: optional, name of user cut.

Model::AddUserCut()

Add a user cut to model.

Synopsis

void AddUserCut(

const Expr &lhs,

char sense,

const Expr &rhs,

const char *szName)

Arguments

lhs: left hand side expression for user cut.

sense: sense for user cut.

rhs: right hand side expression for user cut.

szName: optional, name of user cut.

Model::AddUserCut()

Add a user cut to model.

Synopsis

void AddUserCut(const ConstrBuilder &builder, const char *szName)

Arguments

builder: builder for user cut.

szName: optional, name of user cut.

Model::AddUserCuts()

Add user cuts to model.

Synopsis

void AddUserCuts(const ConstrBuilderArray &builders, const char *szPrefix)

Arguments

builders: array of builders for user cuts.

szPrefix: name prefix of new user cuts.

Model::AddVar()

Add a variable to model.

Synopsis

Var AddVar(

double lb,

double ub,

double obj,

char vtype,

const char *szName)

Arguments

lb: lower bound for new variable.

ub: upper bound for new variable.

obj: objective coefficient for new variable.

vtype: variable type for new variable.

szName: optional, name for new variable.

Return

new variable object.

Model::AddVar()

Add a variable and the associated non-zero coefficients as column.

Synopsis

Var AddVar(

double lb,

double ub,

double obj,

char vtype,

const Column &col,

const char *szName)

Arguments

lb: lower bound for new variable.

ub: upper bound for new variable.

obj: objective coefficient for new variable.

vtype: variable type for new variable.

col: column object for specifying a set of constraints to which the variable belongs.

szName: optional, name for new variable.

Return

new variable object.

Model::AddVars()

Add new variables to model.

Synopsis

VarArray AddVars(

int count,

char vtype,

const char *szPrefix)

Arguments

count: the number of variables to add.

vtype: variable types for new variables.

szPrefix: prefix part for names of new variables.

Return

array of new variable objects.

Model::AddVars()

Add new variables to model.

Synopsis

VarArray AddVars(

int count,

char vtype,

const char *szNames,

size_t len)

Arguments

count: the number of variables to add.

vtype: variable types for new variables.

szNames: name buffer for new variables.

len: length of name buffer.

Return

array of new variable objects.

Model::AddVars()

Add new variables to model.

Synopsis

VarArray AddVars(

int count,

double lb,

double ub,

double obj,

char vtype,

const char *szPrefix)

Arguments

count: the number of variables to add.

lb: lower bound for new variable.

ub: upper bound for new variable.

obj: objective coefficient for new variable.

vtype: variable types for new variables.

szPrefix: prefix part for names of new variables.

Return

array of new variable objects.

Model::AddVars()

Add new variables to model.

Synopsis

VarArray AddVars(

int count,

double lb,

double ub,

double obj,

char vtype,

const char *szNames,

size_t len)

Arguments

count: the number of variables to add.

lb: lower bound for new variable.

ub: upper bound for new variable.

obj: objective coefficient for new variable.

vtype: variable types for new variables.

szNames: name buffer for new variables.

len: length of name buffer.

Return

array of new variable objects.

Model::AddVars()

Add new variables to model.

Synopsis

VarArray AddVars(

int count,

double *plb,

double *pub,

double *pobj,

char *pvtype,

const char *szPrefix)

Arguments

count: the number of variables to add.

plb: lower bounds for new variables. if NULL, lower bounds are 0.0.

pub: upper bounds for new variables. if NULL, upper bounds are infinity or 1 for binary variables.

pobj: objective coefficients for new variables. if NULL, objective coefficients are 0.0.

pvtype: variable types for new variables. if NULL, variable types are continuous.

szPrefix: prefix part for names of new variables.

Return

array of new variable objects.

Model::AddVars()

Add new decision variables to a model.

Synopsis

VarArray AddVars(

int count,

double *plb,

double *pub,

double *pobj,

char *pvtype,

const char *szNames,

size_t len)

Arguments

count: the number of variables to add.

plb: lower bounds for new variables. if NULL, lower bounds are 0.0.

pub: upper bounds for new variables. if NULL, upper bounds are infinity or 1 for binary variables.

pobj: objective coefficients for new variables. if NULL, objective coefficients are 0.0.

pvtype: variable types for new variables. if NULL, variable types are continuous.

szNames: name buffer for new variables.

len: length of name buffer.

Return

array of new variable objects.

Model::AddVars()

Add new variables to model.

Synopsis

VarArray AddVars(

int count,

double *plb,

double *pub,

double *pobj,

char *pvtype,

const ColumnArray &cols,

const char *szPrefix)

Arguments

count: the number of variables to add.

plb: lower bounds for new variables. if NULL, lower bounds are 0.0.

pub: upper bounds for new variables. if NULL, upper bounds are infinity or 1 for binary variables.

pobj: objective coefficients for new variables. if NULL, objective coefficients are 0.0.

pvtype: variable types for new variables. if NULL, variable types are continuous.

cols: column objects for specifying a set of constraints to which each new variable belongs.

szPrefix: prefix part for names of new variables.

Return

array of new variable objects.

Model::Clear()

Clear all settings including problem itself.

Synopsis

void Clear()

Model::Clone()

Deep copy COPT model.

Synopsis

Model Clone()

Return

cloned model object.

Model::ComputeIIS()

Compute IIS for infeasible model.

Synopsis

void ComputeIIS()

Model::DelPsdObj()

delete PSD part of objective in model.

Synopsis

void DelPsdObj()

Model::DelQuadObj()

delete quadratic part of objective in model.

Synopsis

void DelQuadObj()

Model::FeasRelax()

Compute feasibility relaxation for infeasible model.

Synopsis

void FeasRelax(

VarArray &vars,

double *pColLowPen,

double *pColUppPen,

ConstrArray &cons,

double *pRowBndPen,

double *pRowUppPen)

Arguments

vars: an array of variables.

pColLowPen: penalties for lower bounds of variables.

pColUppPen: penalties for upper bounds of variables.

cons: an array of constraints.

pRowBndPen: penalties for right hand sides of constraints.

pRowUppPen: penalties for upper bounds of range constraints.

Model::FeasRelax()

Compute feasibility relaxation for infeasible model.

Synopsis

void FeasRelax(int ifRelaxVars, int ifRelaxCons)

Arguments

ifRelaxVars: whether to relax variables.

ifRelaxCons: whether to relax constraints.

Model::Get()

Query values of information associated with variables.

Synopsis

int Get(

const char *szName,

const VarArray &vars,

double *pOut)

Arguments

szName: name of information.

vars: a list of desired variables.

pOut: output array of information values.

Return

the number of valid variables. If failed, return -1.

Model::Get()

Query values of information associated with constraints.

Synopsis

int Get(

const char *szName,

const ConstrArray &constrs,

double *pOut)

Arguments

szName: name of information.

constrs: a list of desired constraints.

pOut: output array of information values.

Return

the number of valid constraints. If failed, return -1.

Model::Get()

Query values of information associated with quadratic constraints.

Synopsis

int Get(

const char *szName,

const QConstrArray &constrs,

double *pOut)

Arguments

szName: name of information.

constrs: a list of desired quadratic constraints.

pOut: output array of information values.

Return

the number of valid quadratic constraints. If failed, return -1.

Model::Get()

Query values of information associated with PSD constraints.

Synopsis

int Get(

const char *szName,

const PsdConstrArray &constrs,

double *pOut)

Arguments

szName: name of information.

constrs: a list of desired PSD constraints.

pOut: output array of information values.

Return

the number of valid PSD constraints. If failed, return -1.

Model::GetCoeff()

Get the coefficient of variable in a linear constraint.

Synopsis

double GetCoeff(const Constraint &constr, const Var &var)

Arguments

constr: The requested constraint.

var: The requested variable.

Return

The requested coefficient.

Model::GetCol()

Get a column object that have a list of constraints in which the variable participates.

Synopsis

Column GetCol(const Var &var)

Arguments

var: a variable object.

Return

a column object associated with a variable.

Model::GetColBasis()

Get status of column basis.

Synopsis

int GetColBasis(int *pBasis)

Arguments

pBasis: integer pointer to basis status.

Return

number of columns.

Model::GetCone()

Get a cone constraint of given index in model.

Synopsis

Cone GetCone(int idx)

Arguments

idx: index of the desired cone constraint.

Return

the desired cone constraint object.

Model::GetConeBuilders()

Get builders of all cone constraints in model.

Synopsis

ConeBuilderArray GetConeBuilders()

Return

array object of all cone constraint builders.

Model::GetConeBuilders()

Get builders of given cone constraints in model.

Synopsis

ConeBuilderArray GetConeBuilders(const ConeArray &cones)

Arguments

cones: array of cone constraints.

Return

array object of desired cone constraint builders.

Model::GetCones()

Get all cone constraints in model.

Synopsis

ConeArray GetCones()

Return

array object of cone constraints.

Model::GetConstr()

Get a constraint of given index in model.

Synopsis

Constraint GetConstr(int idx)

Arguments

idx: index of the desired constraint.

Return

the desired constraint object.

Model::GetConstrBuilder()

Get builder of a constraint in model, including variables and associated coefficients, sense and RHS.

Synopsis

ConstrBuilder GetConstrBuilder(Constraint constr)

Arguments

constr: a constraint object.

Return

constraint builder object.

Model::GetConstrBuilders()

Get builders of all constraints in model.

Synopsis

ConstrBuilderArray GetConstrBuilders()

Return

array object of constraint builders.

Model::GetConstrByName()

Get a constraint of given name in model.

Synopsis

Constraint GetConstrByName(const char *szName)

Arguments

szName: name of the desired constraint.

Return

the desired constraint object.

Model::GetConstrLowerIIS()

Get IIS status of lower bounds of constraints.

Synopsis

int GetConstrLowerIIS(const ConstrArray &constrs, int *pLowerIIS)

Arguments

constrs: Array of constraints.

pLowerIIS: IIS status of lower bounds of constraints.

Return

Number of constraints.

Model::GetConstrs()

Get all constraints in model.

Synopsis

ConstrArray GetConstrs()

Return

array object of constraints.

Model::GetConstrUpperIIS()

Get IIS status of upper bounds of constraints.

Synopsis

int GetConstrUpperIIS(const ConstrArray &constrs, int *pUpperIIS)

Arguments

constrs: Array of constraints.

pUpperIIS: IIS status of upper bounds of constraints.

Return

Number of constraints.

Model::GetDblAttr()

Get value of a COPT double attribute.

Synopsis

double GetDblAttr(const char *szAttr)

Arguments

szAttr: name of double attribute.

Return

value of double attribute.

Model::GetDblParam()

Get value of a COPT double parameter.

Synopsis

double GetDblParam(const char *szParam)

Arguments

szParam: name of integer parameter.

Return

value of double parameter.

Model::GetGenConstrIndicator()

Get builder of given general constraint of type indicator.

Synopsis

GenConstrBuilder GetGenConstrIndicator(const GenConstr &indicator)

Arguments

indicator: a general constraint of type indicator.

Return

builder object of general constraint of type indicator.

Model::GetIndicatorIIS()

Get IIS status of indicator constraints.

Synopsis

int GetIndicatorIIS(const GenConstrArray &genconstrs, int *pIIS)

Arguments

genconstrs: Array of indicator constraints.

pIIS: IIS status of indicator constraints.

Return

Number of indicator constraints.

Model::GetIntAttr()

Get value of a COPT integer attribute.

Synopsis

int GetIntAttr(const char *szAttr)

Arguments

szAttr: name of integer attribute.

Return

value of integer attribute.

Model::GetIntParam()

Get value of a COPT integer parameter.

Synopsis

int GetIntParam(const char *szParam)

Arguments

szParam: name of integer parameter.

Return

value of integer parameter.

Model::GetLmiCoeff()

Get the symmetric matrix of variable in LMI constraint.

Synopsis

SymMatrix GetLmiCoeff(const LmiConstraint &constr, const Var &var)

Arguments

constr: The desired LMI constraint.

var: The desired variable.

Return

The associated coefficient matrix.

Model::GetLmiConstr()

Get LMI constraint of given index in model.

Synopsis

LmiConstraint GetLmiConstr(int idx)

Arguments

idx: index of desired LMI constraint.

Return

LMI constraint object.

Model::GetLmiConstrByName()

Get LMI constraint of given name in model.

Synopsis

LmiConstraint GetLmiConstrByName(const char *szName)

Arguments

szName: name of desired LMI constraint.

Return

LMI constraint object.

Model::GetLmiConstrs()

Get all LMI constraints in model.

Synopsis

LmiConstrArray GetLmiConstrs()

Return

array object of LMI constraints.

Model::GetLmiRhs()

Get the symmetric matrix of constant of LMI constraint.

Synopsis

SymMatrix GetLmiRhs(const LmiConstraint &constr)

Arguments

constr: The desired LMI constraint.

Return

matrix of constant term.

Model::GetLmiRow()

Get variables and associated symmetric matrices that participate in a LMI constraint.

Synopsis

LmiExpr GetLmiRow(const LmiConstraint &constr)

Arguments

constr: given LMI constraint object.

Return

pointer to LMI expression object of LMI constraint.

Model::GetLpSolution()

Get LP solution.

Synopsis

void GetLpSolution(

double *pValue,

double *pSlack,

double *pRowDual,

double *pRedCost)

Arguments

pValue: optional, double pointer to solution values.

pSlack: optional, double poitner to slack values.

pRowDual: optional, double pointer to dual values.

pRedCost: optional, double pointer to reduced costs.

Model::GetObjective()

Get linear expression of objective for model.

Synopsis

Expr GetObjective()

Return

a linear expression object.

Model::GetParamAttrType()

Get type of a COPT parameter or attribute.

Synopsis

int GetParamAttrType(const char *szName)

Arguments

szName: name of parameter or attribute.

Return

type of parameter or attribute.

Model::GetParamInfo()

Get current, default, minimum, maximum of COPT integer parameter.

Synopsis

void GetParamInfo(

const char *szParam,

int *pnCur,

int *pnDef,

int *pnMin,

int *pnMax)

Arguments

szParam: name of integer parameter.

pnCur: out, current value of integer parameter.

pnDef: out, default value of integer parameter.

pnMin: out, minimum value of integer parameter.

pnMax: out, maximum value of integer parameter.

Model::GetParamInfo()

Get current, default, minimum, maximum of COPT double parameter.

Synopsis

void GetParamInfo(

const char *szParam,

double *pdCur,

double *pdDef,

double *pdMin,

double *pdMax)

Arguments

szParam: name of double parameter.

pdCur: out, current value of double parameter.

pdDef: out, default value of double parameter.

pdMin: out, minimum value of double parameter.

pdMax: out, maximum value of double parameter.

Model::GetPoolObjVal()

Get the iSol-th objective value in solution pool.

Synopsis

double GetPoolObjVal(int iSol)

Arguments

iSol: Index of solution.

Return

The requested objective value.

Model::GetPoolSolution()

Get the iSol-th solution in solution pool.

Synopsis

int GetPoolSolution(

int iSol,

const VarArray &vars,

double *pColVals)

Arguments

iSol: Index of solution.

vars: The requested variables.

pColVals: Pointer to the requested solutions.

Return

The length of requested solution array.

Model::GetPsdCoeff()

Get the symmetric matrix of PSD variable in a PSD constraint.

Synopsis

SymMatrix GetPsdCoeff(const PsdConstraint &constr, const PsdVar &var)

Arguments

constr: The desired PSD constraint.

var: The desired PSD variable.

Return

The associated coefficient matrix.

Model::GetPsdConstr()

Get PSD constraint of given index in model.

Synopsis

PsdConstraint GetPsdConstr(int idx)

Arguments

idx: index of desired PSD constraint.

Return

PSD constraint object.

Model::GetPsdConstrBuilder()

Get builder of a PSD constraint in model, including PSD variables, sense and associated symmtric matrix.

Synopsis

PsdConstrBuilder GetPsdConstrBuilder(const PsdConstraint &constr)

Arguments

constr: PSD constraint object.

Return

pointer to PSD constraint builder object.

Model::GetPsdConstrBuilders()

Get builders of all PSD constraints in model.

Synopsis

PsdConstrBuilderArray GetPsdConstrBuilders()

Return

pointer to array object of PSD constraint builders.

Model::GetPsdConstrByName()

Get PSD constraint of given name in model.

Synopsis

PsdConstraint GetPsdConstrByName(const char *szName)

Arguments

szName: name of desired PSD constraint.

Return

PSD constraint object.

Model::GetPsdConstrs()

Get all PSD constraints in model.

Synopsis

PsdConstrArray GetPsdConstrs()

Return

pointer to array object of PSD constraints.

Model::GetPsdObjective()

Get PSD objective of model.

Synopsis

PsdExpr GetPsdObjective()

Return

a PSD expression object.

Model::GetPsdRow()

Get PSD variables and associated symmetric matrices that participate in a PSD constraint.

Synopsis

PsdExpr GetPsdRow(const PsdConstraint &constr)

Arguments

constr: PSD constraint object.

Return

pointer to PSD expression object of the PSD constraint.

Model::GetPsdRow()

Get PSD variables, associated symmetric matrix, LB/UB that participate in a PSD constraint.

Synopsis

PsdExpr GetPsdRow(

const PsdConstraint &constr,

double *pLower,

double *pUpper)

Arguments

constr: a PSD constraint object.

pLower: pointer to double value of lower bound.

pUpper: pointer to double value of upper bound.

Return

pointer to PSD expression object of the PSD constraint.

Model::GetPsdVar()

Get a PSD variable of given index in model.

Synopsis

PsdVar GetPsdVar(int idx)

Arguments

idx: index of the desired PSD variable.

Return

the desired PSD variable object.

Model::GetPsdVarByName()

Get a PSD variable of given name in model.

Synopsis

PsdVar GetPsdVarByName(const char *szName)

Arguments

szName: name of the desired PSD variable.

Return

the desired PSD variable object.

Model::GetPsdVars()

Get all PSD variables in model.

Synopsis

PsdVarArray GetPsdVars()

Return

array object of PSD variables.

Model::GetQConstr()

Get a quadratic constraint of given index in model.

Synopsis

QConstraint GetQConstr(int idx)

Arguments

idx: index of the desired quadratic constraint.

Return

the desired quadratic constraint object.

Model::GetQConstrBuilder()

Get builder of a constraint in model, including variables and associated coefficients, sense and RHS.

Synopsis

QConstrBuilder GetQConstrBuilder(const QConstraint &constr)

Arguments

constr: a constraint object.

Return

constraint builder object.

Model::GetQConstrBuilders()

Get builders of all constraints in model.

Synopsis

QConstrBuilderArray GetQConstrBuilders()

Return

array object of constraint builders.

Model::GetQConstrByName()

Get a quadratic constraint of given name in model.

Synopsis

QConstraint GetQConstrByName(const char *szName)

Arguments

szName: name of the desired constraint.

Return

the desired quadratic constraint object.

Model::GetQConstrs()

Get all quadratic constraints in model.

Synopsis

QConstrArray GetQConstrs()

Return

array object of quadratic constraints.

Model::GetQuadObjective()

Get quadratic objective of model.

Synopsis

QuadExpr GetQuadObjective()

Return

a quadratic expression object.

Model::GetQuadRow()

Get two variables and associated coefficients that participate in a quadratic constraint.

Synopsis

QuadExpr GetQuadRow(const QConstraint &constr)

Arguments

constr: a quadratic constraint object.

Return

quadratic expression object of the constraint.

Model::GetQuadRow()

Get two variables and associated coefficients that participate in a quadratic constraint.

Synopsis

QuadExpr GetQuadRow(

const QConstraint &constr,

char *pSense,

double *pBound)

Arguments

constr: a quadratic constraint object.

pSense: sense of quadratic constraint.

pBound: right hand side of quadratic constraint.

Return

quadratic expression object of the constraint.

Model::GetRow()

Get variables that participate in a constraint, and the associated coefficients.

Synopsis

Expr GetRow(const Constraint &constr)

Arguments

constr: a constraint object.

Return

expression object of the constraint.

Model::GetRowBasis()

Get status of row basis.

Synopsis

int GetRowBasis(int *pBasis)

Arguments

pBasis: integer pointer to basis status.

Return

number of rows.

Model::GetSolution()

Get MIP solution.

Synopsis

void GetSolution(double *pValue)

Arguments

pValue: double pointer to solution values.

Model::GetSos()

Get a SOS constraint of given index in model.

Synopsis

Sos GetSos(int idx)

Arguments

idx: index of the desired SOS constraint.

Return

the desired SOS constraint object.

Model::GetSosBuilders()

Get builders of all SOS constraints in model.

Synopsis

SosBuilderArray GetSosBuilders()

Return

array object of SOS constraint builders.

Model::GetSosBuilders()

Get builders of given SOS constraints in model.

Synopsis

SosBuilderArray GetSosBuilders(const SosArray &soss)

Arguments

soss: array of SOS constraints.

Return

array object of desired SOS constraint builders.

Model::GetSOSIIS()

Get IIS status of SOS constraints.

Synopsis

int GetSOSIIS(const SosArray &soss, int *pIIS)

Arguments

soss: Array of SOS constraints.

pIIS: IIS status of SOS constraints.

Return

Number of SOS constraints.

Model::GetSoss()

Get all SOS constraints in model.

Synopsis

SosArray GetSoss()

Return

array object of SOS constraints.

Model::GetSymMat()

Get a symmetric matrix of given index in model.

Synopsis

SymMatrix GetSymMat(int idx)

Arguments

idx: index of the desired symmetric matrix.

Return

the desired symmetric matrix object.

Model::GetVar()

Get a variable of given index in model.

Synopsis

Var GetVar(int idx)

Arguments

idx: index of the desired variable.

Return

the desired variable object.

Model::GetVarByName()

Get a variable of given name in model.

Synopsis

Var GetVarByName(const char *szName)

Arguments

szName: name of the desired variable.

Return

the desired variable object.

Model::GetVarLowerIIS()

Get IIS status of lower bounds of variables.

Synopsis

int GetVarLowerIIS(const VarArray &vars, int *pLowerIIS)

Arguments

vars: Array of variables

pLowerIIS: IIS status of lower bounds of variables.

Return

Number of variables.

Model::GetVars()

Get all variables in model.

Synopsis

VarArray GetVars()

Return

variable array object.

Model::GetVarUpperIIS()

Get IIS status of upper bounds of variables.

Synopsis

int GetVarUpperIIS(const VarArray &vars, int *pUpperIIS)

Arguments

vars: Array of variables

pUpperIIS: IIS status of upper bounds of variables.

Return

Number of variables.

Model::Interrupt()

Interrupt optimization of current problem.

Synopsis

void Interrupt()

Model::LoadMipStart()

Load final initial values of variables to the problem.

Synopsis

void LoadMipStart()

Model::LoadTuneParam()

Load specified tuned parameters into model.

Synopsis

void LoadTuneParam(int idx)

Arguments

idx: Index of tuned parameters.

Model::Read()

Read problem, solution, basis, MIP start or COPT parameters from file.

Synopsis

void Read(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadBasis()

Read basis from file.

Synopsis

void ReadBasis(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadBin()

Read problem in COPT binary format from file.

Synopsis

void ReadBin(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadCbf()

Read problem in CBF format from file.

Synopsis

void ReadCbf(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadLp()

Read problem in LP format from file.

Synopsis

void ReadLp(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadMps()

Read problem in MPS format from file.

Synopsis

void ReadMps(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadMst()

Read MIP start information from file.

Synopsis

void ReadMst(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadParam()

Read COPT parameters from file.

Synopsis

void ReadParam(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadSdpa()

Read problem in SDPA format from file.

Synopsis

void ReadSdpa(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadSol()

Read solution from file.

Synopsis

void ReadSol(const char *szFileName)

Arguments

szFileName: an input file name.

Model::ReadTune()

Read tuning parameters from file.

Synopsis

void ReadTune(const char *szFileName)

Arguments

szFileName: an input file name.

Model::Remove()

Remove a list of variables from model.

Synopsis

void Remove(VarArray &vars)

Arguments

vars: an array of variables.

Model::Remove()

Remove a list of constraints from model.

Synopsis

void Remove(ConstrArray &constrs)

Arguments

constrs: an array of constraints.

Model::Remove()

Remove a list of SOS constraints from model.

Synopsis

void Remove(SosArray &soss)

Arguments

soss: an array of SOS constraints.

Model::Remove()

Remove a list of gernal constraints from model.

Synopsis

void Remove(GenConstrArray &genConstrs)

Arguments

genConstrs: an array of general constraints.

Model::Remove()

Remove a list of Cone constraints from model.

Synopsis

void Remove(ConeArray &cones)

Arguments

cones: an array of Cone constraints.

Model::Remove()

Remove a list of quadratic constraints from model.

Synopsis

void Remove(QConstrArray &qconstrs)

Arguments

qconstrs: an array of quadratic constraints.

Model::Remove()

Remove a list of PSD variables from model.

Synopsis

void Remove(PsdVarArray &vars)

Arguments

vars: an array of PSD variables.

Model::Remove()

Remove a list of PSD constraints from model.

Synopsis

void Remove(PsdConstrArray &constrs)

Arguments

constrs: an array of PSD constraints.

Model::Remove()

Remove a list of LMI constraints from model.

Synopsis

void Remove(LmiConstrArray &constrs)

Arguments

constrs: an array of LMI constraints.

Model::Reset()

Reset solution of problem only.

Synopsis

void Reset()

Model::ResetAll()

Reset solution of problem, and additional information such as MIP start, etc.

Synopsis

void ResetAll()

Model::ResetParam()

Reset parameters to default settings.

Synopsis

void ResetParam()

Model::Set()

Set values of information associated with variables.

Synopsis

void Set(

const char *szName,

const VarArray &vars,

double *pVals,

int len)

Arguments

szName: name of double information.

vars: a list of desired variables.

pVals: array of information values.

len: length of value array.

Model::Set()

Set values of information associated with constraints.

Synopsis

void Set(

const char *szName,

const ConstrArray &constrs,

double *pVals,

int len)

Arguments

szName: name of double information.

constrs: a list of desired constraints.

pVals: array of information values.

len: length of value array.

Model::Set()

Set values of information associated with PSD constraints.

Synopsis

void Set(

const char *szName,

const PsdConstrArray &constrs,

double *pVals,

int len)

Arguments

szName: name of double information.

constrs: a list of desired PSD constraints.

pVals: array of values of information.

len: length of value array.

Model::SetBasis()

Set column and row basis status to model.

Synopsis

void SetBasis(int *pColBasis, int *pRowBasis)

Arguments

pColBasis: pointer to status of column basis.

pRowBasis: pointer to status of row basis.

Model::SetCallback()

Set user callback to COPT model.

Synopsis

void SetCallback(ICallback *pcb, int cbctx)

Arguments

pcb: pointer to user callback object.

cbctx: COPT callback context, see definition in copt.h

Model::SetCoeff()

Set the coefficient of a variable in a linear constraint.

Synopsis

void SetCoeff(

const Constraint &constr,

const Var &var,

double newVal)

Arguments

constr: The requested constraint.

var: The requested variable.

newVal: New coefficient.

Model::SetCoeffs()

Set a list of coefficients in the model.

Synopsis

void SetCoeffs(

const ConstrArray &constrs,

const VarArray &vars,

double *vals,

int len)

Arguments

constrs: A list of constraints for coefficients to be set.

vars: A list of vars for coefficients to be set.

vals: New values for coefficients.

len: Length of values.

Model::SetDblParam()

Set value of a COPT double parameter.

Synopsis

void SetDblParam(const char *szParam, double dVal)

Arguments

szParam: name of integer parameter.

dVal: double value.

Model::SetIntParam()

Set value of a COPT integer parameter.

Synopsis

void SetIntParam(const char *szParam, int nVal)

Arguments

szParam: name of integer parameter.

nVal: integer value.

Model::SetLmiCoeff()

Set the coefficient matrix of a variable in LMI constraint.

Synopsis

void SetLmiCoeff(

const LmiConstraint &constr,

const Var &var,

const SymMatrix &mat)

Arguments

constr: The desired LMI constraint.

var: The desired variable.

mat: new coefficient matrix.

Model::SetLmiRhs()

Set constant matrix of LMI constraint.

Synopsis

void SetLmiRhs(const LmiConstraint &constr, const SymMatrix &mat)

Arguments

constr: The desired LMI constraint.

mat: new constant matrix.

Model::SetLpSolution()

Set LP solution.

Synopsis

void SetLpSolution(

double *pValue,

double *pSlack,

double *pRowDual,

double *pRedCost)

Arguments

pValue: double pointer to solution values.

pSlack: double poitner to slack values.

pRowDual: double pointer to dual values.

pRedCost: double pointer to reduced costs.

Model::SetMipStart()

Set initial values for variables of given number, starting from the first one.

Synopsis

void SetMipStart(int count, double *pVals)

Arguments

count: the number of variables to set.

pVals: pointer to initial values of variables.

Model::SetMipStart()

Set initial value for the specified variable.

Synopsis

void SetMipStart(const Var &var, double val)

Arguments

var: an interested variable.

val: initial value of the variable.

Model::SetMipStart()

Set initial values for an array of variables.

Synopsis

void SetMipStart(const VarArray &vars, double *pVals)

Arguments

vars: a list of interested variables.

pVals: pointer to initial values of variables.

Model::SetNames()

Set names for given variables in model.

Synopsis

void SetNames(

const VarArray &vars,

const char *szNames,

size_t len)

Arguments

vars: array object of variables.

szNames: name buffer for variables.

len: length of name buffer.

Model::SetNames()

Set names for given constraints in model.

Synopsis

void SetNames(

const ConstrArray &cons,

const char *szNames,

size_t len)

Arguments

cons: array object of constraints.

szNames: name buffer for constraints.

len: length of name buffer.

Model::SetNames()

Set names for given quadratic constraints in model.

Synopsis

void SetNames(

const QConstrArray &cons,

const char *szNames,

size_t len)

Arguments

cons: array object of quadratic constraints.

szNames: name buffer for quadratic constraints.

len: length of name buffer.

Model::SetNames()

Set names for given PSD variables in model.

Synopsis

void SetNames(

const PsdVarArray &vars,

const char *szNames,

size_t len)

Arguments

vars: array object of PSD variables.

szNames: name buffer for PSD variables.

len: length of name buffer.

Model::SetNames()

Set names for given PSD constraints in model.

Synopsis

void SetNames(

const PsdConstrArray &cons,

const char *szNames,

size_t len)

Arguments

cons: array object of PSD constraints.

szNames: name buffer for PSD constraints.

len: length of name buffer.

Model::SetNames()

Set names for given LMI constraints in model.

Synopsis

void SetNames(

const LmiConstrArray &cons,

const char *szNames,

size_t len)

Arguments

cons: array object of LMI constraints.

szNames: name buffer for LMI constraints.

len: length of name buffer.

Model::SetObjConst()

Set objective constant.

Synopsis

void SetObjConst(double constant)

Arguments

constant: constant value to set.

Model::SetObjective()

Set objective for model.

Synopsis

void SetObjective(const Expr &expr, int sense)

Arguments

expr: expression of the objective.

sense: optimization sense. optional, default value 0 does not change COPT sense.

Model::SetObjSense()

Set objective sense for model.

Synopsis

void SetObjSense(int sense)

Arguments

sense: the objective sense.

Model::SetPsdCoeff()

Set the coefficient matrix of a PSD variable in a PSD constraint.

Synopsis

void SetPsdCoeff(

const PsdConstraint &constr,

const PsdVar &var,

const SymMatrix &mat)

Arguments

constr: The desired PSD constraint.

var: The desired PSD variable.

mat: new coefficient matrix.

Model::SetPsdObjective()

Set PSD objective for model.

Synopsis

void SetPsdObjective(const PsdExpr &expr, int sense)

Arguments

expr: PSD expression of the objective.

sense: optimization sense. optional, default value 0 does not change COPT sense.

Model::SetQuadObjective()

Set quadratic objective for model.

Synopsis

void SetQuadObjective(const QuadExpr &expr, int sense)

Arguments

expr: quadratic expression of the objective.

sense: optimization sense. optional, default value 0 does not change COPT sense.

Model::SetSlackBasis()

Set slack basis to model.

Synopsis

void SetSlackBasis()

Model::SetSolverLogCallback()

Set log callback for COPT.

Synopsis

void SetSolverLogCallback(ILogCallback *pcb)

Arguments

pcb: pointer to ILogCallback object.

Model::SetSolverLogFile()

Set log file for COPT.

Synopsis

void SetSolverLogFile(const char *szLogFile)

Arguments

szLogFile: log file name.

Model::Solve()

Solve the model as MIP.

Synopsis

void Solve()

Model::SolveLp()

Solve the model as LP.

Synopsis

void SolveLp()

Model::Tune()

Tune model.

Synopsis

void Tune()

Model::Write()

Output problem, solution, basis, MIP start or modified COPT parameters to file.

Synopsis

void Write(const char *szFileName)

Arguments

szFileName: an output file name.

Model::WriteBasis()

Output optimal basis to a file of type ‘.bas’.

Synopsis

void WriteBasis(const char *szFileName)

Arguments

szFileName: an output file name.

Model::WriteBin()

Output problem to a file as COPT binary format.

Synopsis

void WriteBin(const char *szFileName)

Arguments

szFileName: an output file name.

Model::WriteIIS()

Output IIS to file.

Synopsis

void WriteIIS(const char *szFileName)

Arguments

szFileName: Output file name.

Model::WriteLp()

Output problem to a file as LP format.

Synopsis

void WriteLp(const char *szFileName)

Arguments

szFileName: an output file name.

Model::WriteMps()

Output problem to a file as MPS format.

Synopsis

void WriteMps(const char *szFileName)

Arguments

szFileName: an output file name.

Model::WriteMpsStr()

Output problem to a buffer as MPS format.

Synopsis

ProbBuffer WriteMpsStr()

Return

output problem buffer.

Model::WriteMst()

Output MIP start information to a file of type ‘.mst’.

Synopsis

void WriteMst(const char *szFileName)

Arguments

szFileName: an output file name.

Model::WriteParam()

Output modified COPT parameters to a file of type ‘.par’.

Synopsis

void WriteParam(const char *szFileName)

Arguments

szFileName: an output file name.

Model::WritePoolSol()

Output selected pool solution to a file of type ‘.sol’.

Synopsis

void WritePoolSol(int iSol, const char *szFileName)

Arguments

iSol: index of pool solution.

szFileName: an output file name.

Model::WriteRelax()

Output feasibility relaxation problem to file.

Synopsis

void WriteRelax(const char *szFileName)

Arguments

szFileName: Output file name.

Model::WriteSol()

Output solution to a file of type ‘.sol’.

Synopsis

void WriteSol(const char *szFileName)

Arguments

szFileName: an output file name.

Model::WriteTuneParam()

Output specified tuned parameters to a file of type ‘.par’.

Synopsis

void WriteTuneParam(int idx, const char *szFileName)

Arguments

idx: Index of tuned parameters.

szFileName: Output file name.