57 COI_API int checkModelAndParameters();
224 virtual int Option(
int ncall,
double* rval,
int* ival,
int* lval,
char* name,
void* usrmem)
230 virtual int TriOrd(
int mode,
int type,
int status,
int rowno,
int colno,
int inf,
double value,
double resid,
433 coiHandle_t cntVect_;
436 ConoptSolution* solution_;
437 ConoptStatus* status_;
449#pragma warning( push )
451#pragma warning( disable: 1744 )
555 return consindex_[a] < consindex_[b];
644 virtual int readMatrix(
double lower[],
double curr[],
double upper[],
int vsta[],
int type[],
double rhs[],
645 int esta[],
int colsta[],
int rowno[],
double value[],
int nlflag[],
int numvar,
int numcon,
int numnz);
657 unsigned int numcons,
681 const std::vector<int>& varindex,
682 const std::vector<double>& value,
683 const std::vector<int>& nlflag,
707 const std::vector<int>& consindex,
708 const std::vector<double>& value,
709 const std::vector<int>& nlflag,
821 const std::vector<int>& rownum,
822 const std::vector<int>& colnum
844 virtual int FDEval(
const double x[],
double* g,
double jac[],
int rowno,
const int jacnum[],
int mode,
int ignerr,
845 int* errcnt,
int numvar,
int numjac,
int thread)
864 virtual int FDEvalIni(
const double x[],
const int rowlist[],
int mode,
int listsize,
int numthread,
int ignerr,
865 int* errcnt,
int numvar)
895 virtual int FDInterval(
const double xmin[],
const double xmax[],
double* gmin,
double* gmax,
double jmin[],
896 double jamx[],
int rowno,
const int jacnum[],
int mode,
double pinf,
int numvar,
int numjac)
906 virtual int SDLagrSize(
int* nodrv,
int numvar,
int numcon,
int* nhess,
int maxhess)
921 virtual int SDLagrVal(
const double x[],
const double u[],
const int hsrw[],
const int hscl[],
double hsvl[],
922 int* nodrv,
int numvar,
int numcon,
int nhess)
934 virtual int SDDirLagr(
const double x[],
const double dx[],
const double u[],
double d2g[],
int newpt,
int* nodrv,
935 int numvar,
int numcon)
947 virtual int SDDir(
const double x[],
const double dx[],
double d2g[],
int rowno,
const int jacnum[],
int* nodrv,
948 int numvar,
int numjac,
int thread)
962 virtual int SDDirIni(
const double x[],
const double dx[],
const int rowlist[],
int listsize,
int numthread,
963 int newpt,
int* nodrv,
int numvar)
992 constraints_.clear();
1009 unsigned int numvar_;
1010 unsigned int numcons_;
1011 unsigned int numnz_;
1012 unsigned int numnlnz_;
1023 std::vector<ConoptVariable> variables_;
1024 std::vector<ConoptConstraint> constraints_;
1026 std::vector<int> hessrownum_;
1027 std::vector<int> hesscolnum_;
1031#pragma warning( pop )
1039#pragma warning( push )
1041#pragma warning( disable: 1744 )
1090 ConoptMessageHandler();
1095 virtual ~ConoptMessageHandler();
1111 const std::vector<std::string>& msgv
1149 const std::string& msg
1181#pragma warning( pop )
The message handler class.
virtual int progress(const ConoptAlgProgress &progressdata)
const std::vector< int > & getSDLagrangianColumnNumbers() const
returns the column numbers in the second derivative of the lagrangian structure
const std::vector< int > & getSDLagrangianRowNumbers() const
returns the row numbers in the second derivative of the lagrangian structure
static constexpr double Infinity
program fvforall
Main program. A simple setup and call of CONOPT.
program fvinclin
Main program. A simple setup and call of CONOPT.
void setMessageHandler(ConoptMessageHandler &msghandler)
sets the message handler to the user supplied handler.
int sendMessage(std::string msg)
sends a message to the message handler
void setVerbosityLevel(int verblevel)
sets the verbosity level for messaging
void loadModel(ConoptModelData &modeldata)
loads the model and stores the pointer in the interface
virtual ~ConoptModelData()
Conopt(std::string modelName="conopt-model")
ConoptObjectiveElement
the element that is used for the objective function
int addVariable(double lower, double upper, double curr=0, int varstatus=-1)
adds a variable to the model. The non-zero coefficients are added later.
int addVariable(double lower, double upper, const std::vector< int > &consindex, const std::vector< double > &value, const std::vector< int > &nlflag, double curr=0, int varstatus=-1)
adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
ConoptSense
the objective sense
void setObjectiveElement(ConoptObjectiveElement elem, int elemindex)
sets the index for the objective variable or constraint
int addConstraint(ConoptConstraintType constype, double rhs, int slackstatus=-1)
adds a constraint to the problem. The non-zero coefficients are added later
ConoptConstraintType
the constraint type
int addConstraint(ConoptConstraintType constype, double rhs, const std::vector< int > &varindex, const std::vector< double > &value, const std::vector< int > &nlflag, int slackstatus=-1)
adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
void setOptimizationSense(ConoptSense sense)
sets the optimisation direction.
virtual int readMatrix(double lower[], double curr[], double upper[], int vsta[], int type[], double rhs[], int esta[], int colsta[], int rowno[], double value[], int nlflag[], int numvar, int numcon, int numnz)
loads the structure of the model into CONOPT.
void setProblemDimension(unsigned int numvar, unsigned int numcons, unsigned int numnz, unsigned int numnlnz)
sets the problem dimension. This is called if the user wants to implement a custom readMatrix() metho...
void setInitialStatusOption(int inistat)
the setting to indicate how the initial status of the variables and slack variables will be handled.
void setSDLagrangianStructure(const std::vector< int > &rownum, const std::vector< int > &colnum)
sets the structure of the second derivatives of the Lagrangian
void setSDEvaluationType(ConoptSDEvaluationType sdevaltype)
informs CONOPT of the method for evaluating the second derivative
ConoptSDEvaluationType
the evaluation type for the directional second derivatives
virtual int SDDirLagr(const double x[], const double dx[], const double u[], double d2g[], int newpt, int *nodrv, int numvar, int numcon)
computes the directional second derivative for the Lagrangian
virtual int SDDir(const double x[], const double dx[], double d2g[], int rowno, const int jacnum[], int *nodrv, int numvar, int numjac, int thread)
computes the directional second derivative for a single constraint
virtual int SDDirIni(const double x[], const double dx[], const int rowlist[], int listsize, int numthread, int newpt, int *nodrv, int numvar)
called by CONOPT before a sequence of 2DDir calls each time either the point or the direction changes...
virtual int SDDirEnd(int *nodrv)
called by CONOPT after a sequence of 2DDir calls each time either the point or the direction changes.
virtual int SDLagrVal(const double x[], const double u[], const int hsrw[], const int hscl[], double hsvl[], int *nodrv, int numvar, int numcon, int nhess)
Computes and returns the numerical values of the Hessian.
virtual int FDEval(const double x[], double *g, double jac[], int rowno, const int jacnum[], int mode, int ignerr, int *errcnt, int numvar, int numjac, int thread)
defines the nonlinearities of the model by returning numerical values.
virtual int FDEvalEnd(int ignerr, int *errcnt)
an optional function that will be called at the end of the function evaluation stage.
virtual int FDEvalIni(const double x[], const int rowlist[], int mode, int listsize, int numthread, int ignerr, int *errcnt, int numvar)
an optional function that can be used to improve the efficiency of the function evaulations.
virtual int FDInterval(const double xmin[], const double xmax[], double *gmin, double *gmax, double jmin[], double jamx[], int rowno, const int jacnum[], int mode, double pinf, int numvar, int numjac)
defines intervals for the nonlinearities of the model, again by returning numerical values.
virtual int errorMessage(int rowno, int colno, int posno, const std::string &msg)
virtual method for handling error messages.
void setVerbosityLevel(ConoptVerbosityLevel verblevel)
sets the verbosity level for messaging.
int sendMessage(const std::string &msg)
sends a message to the message handler
virtual int message(int smsg, int dmsg, int nmsg, const std::vector< std::string > &msgv)
virtual method for handling the messages.
ConoptVerbosityLevel
the verbosity level of the message handler
int numCons() const
returns the number of constraints in the model
ConoptVariable & getVariable(int index)
returns a reference to the variable object
int numVar() const
returns the number of variables in the model
int numHessianNonzeros() const
returns the number of non-zeros in the Hessian
ConoptConstraint & getConstraint(int index)
returns a reference to the constraint object
const ConoptConstraint & getConstraint(int index) const
returns a reference to the constraint object
const ConoptVariable & getVariable(int index) const
returns a reference to the variable object
int setThreadS(int threads)
number of threads allowed internally in CONOPT.
int disCont(int discont)
allow discontinuous functions and derivatives.
int fVforAll(int fvforall)
call the FDEval for all constraints, including linear constraints.
int fVincLin(int fvinclin)
include the linear terms in function evaluations.
int allowEmptyRow(int emptyrow)
allow empty rows.
int squareModel(int square)
square models.
int setErrLim(int errlim)
define the Error Limit.
int allowEmptyCol(int emptycol)
allow empty columns.
int setThreadF(int threadf)
number of threads allowed for simultaneous FDEval calls.
int setItLim(int itlim)
define the Iteration Limit.
int setThread2D(int thread2d)
number of threads allowed for simultaneous 2DDir calls.
int debug2D(int debug2d)
turn debugging of 2nd derivatives on and off.
int setLicense(int licint1, int licint2, int licint3, std::string licstring)
define the License Information.
int setThreadC(int threadc)
check for thread compatibility.
int setResLim(double reslim)
define resource limit.
int clearM(int clearm)
ClearM.
int setMaxSup(int maxsup)
limit on superbasics.
int setMaxHeap(double maxheap)
define Limit on Heap Memory.
int debugFV(int debugfv)
turn Debugging of FDEval on and off.
const std::vector< double > & getConstraintMarginals()
returns the constraint marginals
const std::vector< int > & getVariableBasisStatus()
returns the variable basis status
const std::vector< int > & getConstraintBasisStatus()
returns the constraint basis status
const std::vector< double > & getConstraintValues()
returns the constraint values
const std::vector< double > & getVariableMarginals()
returns the variable marginals
int solutionStatus()
return the solution status
double objectiveValue()
returns the objective value
int modelStatus()
returns the model status
const std::vector< int > & getConstraintStatus()
returns the constraint status
const std::vector< int > & getVariableStatus()
returns the variable status
int iterations()
returns the number of iterations
const std::vector< double > & getVariableValues()
returns the variable values
static std::array< int, 3 > version()
returns the version number.
coiHandle_t controlVector()
returns the control vector pointer.
void printStatus()
prints the status of the optimisation
int solve()
method for starting the solving process of CONOPT.
int getRangeErrors()
returns the range errors that were encountered.
int getMaxThreads()
returns the maximum number of threads that can be used by CONOPT.
std::string getName()
returns the model name
double getMaxHeapUsed()
After a model has been solved this method will return the amount of heap memory used.
program square
Main program. A simple setup and call of CONOPT.
ConoptConstraintType constype
ConoptConstraint(int idx, ConoptConstraintType type, double bound, int slackstat)
std::vector< int > sortorder_
void addNonzero(int conindex, double value, int nlflag)
adds a non-zero to the variable data
std::vector< int > consindex_
void sortNonzeros()
sorts the non-zeros by constraint index.
ConoptVariable(int idx, double low, double up, double cur=0, int varstat=-1)
std::vector< int > nlflag_
std::vector< double > value_