15 public static void main(String argv[]){
16 System.loadLibrary(
"conopt4_java");
18 String
name =
"tutoriali";
21 TutiModelData
model =
new TutiModelData();
31 int license_int_1 = Integer.parseInt(System.getenv(
"LICENSE_INT_1"));
32 int license_int_2 = Integer.parseInt(System.getenv(
"LICENSE_INT_2"));
33 int license_int_3 = Integer.parseInt(System.getenv(
"LICENSE_INT_3"));
38 }
catch (Exception e) {
39 System.out.println(
"Unable to set license: " + e.getMessage());
48 conopt.objectiveValue(), 0.572943, 0.000001);
73 public TutiModelData() {
79 private void setConstants() {
101 int[] index = {0, 1, 2, 3};
102 double[] value = {-1, -1, 0, 0};
103 int[] nlflag = {0, 0, 1, 1};
110 int[] index = {0, 1, 2};
111 double[] value = {0, 0, -1};
112 int[] nlflag = {1, 1, 0};
118 int[] index = {2, 3};
119 double[] value = {1, 2};
120 int[] nlflag = {0, 0};
136 int numthread,
boolean ignerr)
143 hold1 = (Al*Math.pow(L, (-Rho)) + Ak*Math.pow(K, (-Rho)) +
144 Ainp*Math.pow(Inp, (-Rho)));
145 hold2 = Math.pow(hold1,( -1./Rho ));
146 hold3 = hold2 / hold1;
174 assert x.length == jac.length;
183 jac[0] = hold3 * Al * Math.pow(L ,(-Rho-1.));
184 jac[1] = hold3 * Ainp * Math.pow(Inp,(-Rho-1.));
static final ConstraintType Eq
static final ConstraintType Free
A class that can be extended to build and solve a model using Conopt.
static final ObjectiveElement Constraint
static final Sense Maximize
static int checkSolve(String name, int model_status, int solution_status, double objective, double expected_objective, double tol)
static void main(String argv[])
void setObjectiveElement(ObjectiveElement elem, int elemindex)
void setOptimizationSense(Sense sense)
int addVariable(double lower, double upper, double curr, int varstatus)
int addConstraint(ConstraintType constype, double rhs, int slackstatus)
void buildModel()
adds variables and constraints to the model
void evaluateNonlinearJacobian(double[] x, double[] jac, int rowno, int[] jacnum, boolean ignerr, int thread)
callback method for evaluating the jacobian for the nonlinear terms in a given row
void initFDEvaluation(double[] x, int[] rowlist, EvaluationMode mode, int numthread, boolean ignerr)
callback method for initialising the first derivative evaluation.
double evaluateNonlinearTerm(double[] x, int rowno, boolean ignerr, int thread)
callback method for evaluating the nonlinear terms in a given row
static final double CONOPT_INF