15 public static void main(String argv[]) {
16 System.loadLibrary(
"conoptjni4");
18 String
name =
"square";
21 SquareModelData
model =
new SquareModelData();
38 int license_int_1 = Integer.parseInt(System.getenv(
"CONOPT_LICENSE_INT_1"));
39 int license_int_2 = Integer.parseInt(System.getenv(
"CONOPT_LICENSE_INT_2"));
40 int license_int_3 = Integer.parseInt(System.getenv(
"CONOPT_LICENSE_INT_3"));
41 String
license_text = System.getenv(
"CONOPT_LICENSE_TEXT");
45 }
catch (Exception e) {
46 System.out.println(
"Unable to set license: " + e.getMessage());
58 else if (
conopt.modelStatus() != 16 ||
conopt.solutionStatus() != 1) {
59 s.
java_log(
name,
"Solver or Model status not as expected (1,16)");
80 public SquareModelData() {
98 int[] index = {x0, x1};
99 double[] value = {1, 1};
100 int[] nlflag = {0, 0};
107 int[] index = {x0, x1};
108 double[] value = {0, 0};
109 int[] nlflag = {1, 1};
122 if (rowno == cons1) {}
124 else if (rowno == cons2) {
136 assert x.length == jac.length;
138 if (rowno == cons1) {}
140 else if (rowno == cons2) {
static final ConstraintType Eq
A class that can be extended to build and solve a model using Conopt.
static void main(String argv[])
static void java_log(final String name, final String message)
addConstraint(self, *args)
Overload 1: adds a constraint to the problem.
addVariable(self, *args)
Overload 1: adds a variable 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 buildModel()
adds variables and constraints to the model
double evaluateNonlinearTerm(double[] x, int rowno, boolean ignerr, int thread)
callback method for evaluating the nonlinear terms in a given row