13sys.path.append(
'../common/')
27 adding the variables and constraints to the model
28 @ingroup PYTHON1THREAD_TUTORIAL
37 self.
addConstraint(pyconopt.ConstraintType_Free, -0.1, [0, 1, 2, 3],
38 [-1, -1, 0, 0], [0, 0, 1, 1])
39 self.
addConstraint(pyconopt.ConstraintType_Eq, 0.0, [0, 1, 2], [0, 0, -1],
41 self.
addConstraint(pyconopt.ConstraintType_Eq, 4.0, [2, 3], [1, 2],
53 @ingroup PYTHON1THREAD_TUTORIAL
64 hold1 = (self.
Al*pow(L,(-self.
Rho)) + self.
Ak*pow(self.
K,(-self.
Rho)) + self.
Ainp*pow(Inp,(-self.
Rho)))
65 hold2 = pow(hold1,( -1./self.
Rho ))
73 @ingroup PYTHON1THREAD_TUTORIAL
85 hold1 = (self.
Al*pow(L,(-self.
Rho)) + self.
Ak*pow(self.
K,(-self.
Rho)) + self.
Ainp*pow(Inp,(-self.
Rho)))
86 hold2 = pow(hold1,( -1./self.
Rho ))
89 jac.append(hold3 * self.
Al * pow(L ,(-self.
Rho-1.)))
90 jac.append(hold3 * self.
Ainp * pow(Inp,(-self.
Rho-1.)))
94if __name__ ==
"__main__":
95 name = os.path.basename(__file__)[:-3]
98 model = TutModelData()
103 conopt.loadModel(model)
104 conopt.setMessageHandler(msghdlr)
107 license_int_1 = os.environ.get(
'LICENSE_INT_1',
None)
108 license_int_2 = os.environ.get(
'LICENSE_INT_2',
None)
109 license_int_3 = os.environ.get(
'LICENSE_INT_3',
None)
110 license_text = os.environ.get(
'LICENSE_TEXT',
None)
111 if license_int_1
is not None and license_int_2
is not None \
112 and license_int_3
is not None and license_text
is not None:
113 conopt.setLicense(int(license_int_1), int(license_int_2),
114 int(license_int_3), license_text)
116 coi_error = conopt.solve()
setOptimizationSense(self, sense)
sets the optimisation direction.
setObjectiveElement(self, elem, elemindex)
sets the index for the objective variable or constraint
addVariable(self, *args)
Overload 1: adds a variable to the model.
addConstraint(self, *args)
Overload 1: adds a constraint to the problem.
A class that can be extended to build and solve a model using Conopt.
static int checkSolve(String name, int model_status, int solution_status, double objective, double expected_objective, double tol)
evaluateNonlinearTerm(self, x, rowno, ignerr, thread)
callback method for evaluating the nonlinear terms in a given row
buildModel(self)
adding the variables and constraints to the model
evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread)
callback method for evaluating the jacobian for the nonlinear terms in a given row