85 {-1, -1, 0, 0}, {0, 0, 1, 1});
91 ConoptConstraintType::Eq, 0.0, {
varl,
varinp,
varout}, {0, 0, -1}, {1, 1, 0});
109 int FDEvalIni(
const double x[],
const int rowlist[],
int mode,
int listsize,
int numthread,
110 int ignerr,
int *errcnt,
int numvar)
override
137 int FDEval(
const double x[],
double *g,
double jac[],
int rowno,
const int jacnum[],
int mode,
138 int ignerr,
int *errcnt,
int numvar,
int numjac,
int thread)
override
150 if (mode == 1 || mode == 3)
155 if (mode == 2 || mode == 3)
169 if (mode == 1 || mode == 3)
174 if (mode == 2 || mode == 3)
206 conopt.setMessageHandler(msghandler);
212 conopt.loadModel(modeldata);
214#if defined(CONOPT_LICENSE_INT_1) && defined(CONOPT_LICENSE_INT_2) && defined(CONOPT_LICENSE_INT_3) && defined(CONOPT_LICENSE_TEXT)
215 std::string license = CONOPT_LICENSE_TEXT;
216 COI_Error +=
conopt.setLicense(CONOPT_LICENSE_INT_1, CONOPT_LICENSE_INT_2, CONOPT_LICENSE_INT_3, license);
221 conopt.sendMessage(
"Skipping COI_Solve due to setup errors. COI_Error = " + std::to_string(
COI_Error));
227 conopt.sendMessage(
"After solving. COI_Error = " + std::to_string(
COI_Error));
228 if (
conopt.modelStatus() != 2 ||
conopt.solutionStatus() != 1)
230 else if (fabs(
conopt.objectiveValue() - 0.572943) > 0.000001)
static constexpr double Infinity
CONOPT C++ interface header file. This is the main object for the CONOPT C++ interface.
void buildModel()
adds the variables and constraints for the problem
int main(int argc, char **argv)
Main program. A simple setup and call of CONOPT.
int FDEvalIni(const double x[], const int rowlist[], int mode, int listsize, int numthread, int ignerr, int *errcnt, int numvar) override
an optional function that can be used to improve the efficiency of the function evaulations.
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) override
defines the nonlinearities of the model by returning numerical values.
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.
void cpp_log(Conopt &conopt, std::string msg, int code)
std::string getProgramName(char *execname)