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});
86 int FDEval(
const double x[],
double* g,
double jac[],
int rowno,
const int jacnum[],
int mode,
int ignerr,
87 int* errcnt,
int numvar,
int numjac,
int thread)
123 if ( mode == 1 || mode == 3 )
128 if ( mode == 2 || mode == 3 ) {
136 else if ( rowno == 1 ) {
145 if ( mode == 1 || mode == 3 )
150 if ( mode == 2 || mode == 3 ) {
167 int SDLagrVal(
const double x[],
const double u[],
const int hsrw[],
const int hscl[],
double hsvl[],
168 int* nodrv,
int numvar,
int numcon,
int nhess)
211 hsvl[0] = hold4 * (-
Rho) * pow(
Al*pow(
L,-
Rho-1.0),2) +
213 hsvl[1] = hold4 * (-
Rho) * (
Al*pow(
L,-
Rho-1.0)) *
220 for ( i = 0; i < 3; i++ )
221 hsvl[i] = hsvl[i] * u[1];
258#if defined(LICENSE_INT_1) && defined(LICENSE_INT_2) && defined(LICENSE_INT_3) && defined(LICENSE_TEXT)
259 std::string license = LICENSE_TEXT;
264 conopt.
sendMessage(
"Skipping COI_Solve due to setup errors. COI_Error = " + std::to_string(
COI_Error));
272 cpp_log(conopt,
"Incorrect Model or Solver Status", -1);
274 cpp_log(conopt,
"Incorrect objective returned", -1);
CONOPT C++ interface header file. This is the main object for the CONOPT C++ interface.
COI_API int sendMessage(std::string msg)
sends a message to the message handler
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 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.
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 setSDLagrangianStructure(const std::vector< int > &rownum, const std::vector< int > &colnum)
sets the structure of the second derivatives of the Lagrangian
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)