60 addConstraint(
ConoptConstraintType::Free, -0.1, {0, 1, 2, 3}, {-1, -1, 0, 0}, {0, 0, 1, 1});
65 addConstraint(
ConoptConstraintType::Eq, 0.0, {0, 1, 2}, {0, 0, -1}, {1, 1, 0});
83 int FDEval(
const double x[],
double* g,
double jac[],
int rowno,
const int jacnum[],
int mode,
int ignerr,
84 int* errcnt,
int numvar,
int numjac,
int thread)
120 if ( mode == 1 || mode == 3 )
125 if ( mode == 2 || mode == 3 ) {
133 else if ( rowno == 1 ) {
142 if ( mode == 1 || mode == 3 )
147 if ( mode == 2 || mode == 3 ) {
188#if defined(LICENSE_INT_1) && defined(LICENSE_INT_2) && defined(LICENSE_INT_3) && defined(LICENSE_TEXT)
189 std::string license = LICENSE_TEXT;
201 cpp_log(conopt,
"Incorrect Model or Solver Status", -1);
205 cpp_log(conopt,
"Incorrect objective returned", -1);
CONOPT C++ interface header file. This is the main object for the CONOPT C++ interface.
COI_API void setMessageHandler(ConoptMessageHandler &msghandler)
sets the message handler to the user supplied handler.
COI_API void loadModel(ConoptModelData &modeldata)
loads the model and stores the pointer in the interface
int main(int argc, char **argv)
Main program. A simple setup and call of CONOPT.
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.
void buildModel()
adds the variables and constraints for the problem
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.
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
void setOptimizationSense(ConoptSense sense)
sets the optimisation direction.
COI_API int setLicense(int licint1, int licint2, int licint3, std::string licstring)
define the License Information.
COI_API int modelStatus()
returns the model status
COI_API double objectiveValue()
returns the objective value
COI_API int solutionStatus()
return the solution status
COI_API void printStatus()
prints the status of the optimisation
COI_API int solve()
method for starting the solving process of CONOPT.
void cpp_log(ConoptCpp &conopt, std::string msg, int code)
std::string getProgramName(char *execname)