15 public static void main(String argv[]) {
16 System.loadLibrary(
"conoptjni4");
18 String
name =
"square2";
21 Square2ModelData
model =
new Square2ModelData();
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.solutionStatus() != 1 ||
conopt.modelStatus() < 4 ||
conopt.modelStatus() > 5) {
59 s.
java_log(
name,
"Solver or Model status not as expected (1,4) or (1,5)");
81 public Square2ModelData() {
101 int[] index = {x0, x1};
102 double[] value = {1, 1};
103 int[] nlflag = {0, 0};
111 int[] index = {x0, x1};
112 double[] value = {0, 0};
113 int[] nlflag = {1, 1};
122 int[] index = {x0, x1};
123 double[] value = {0, 0};
124 int[] nlflag = {1, 1};
137 if (rowno == cons1) {}
139 else if (rowno == cons2) {
142 else if (rowno == cons3) {
154 assert x.length == jac.length;
156 if (rowno == cons1) {}
158 else if (rowno == cons2) {
162 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 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
double evaluateNonlinearTerm(double[] x, int rowno, boolean ignerr, int thread)
callback method for evaluating the nonlinear terms in a given row