13sys.path.append(
'../common/')
28 adding the variables and constraints to the model
29 @ingroup PYTHON1THREAD_LARGEBND
32 self.
varl = self.addVariable(0.1, 1.0e20, 0.5)
33 self.
varinp = self.addVariable(0.1, 1.0e21, 0.5)
34 self.
varout = self.addVariable(0.0, 1.0e22)
35 self.
varp = self.addVariable(0.0, 1.0e23)
39 co.ConstraintType_Free,
53 co.ConstraintType_Eq, 4.0, [self.
varout, self.
varp], [1, 2], [0, 0]
57 self.setObjectiveElement(co.ObjectiveElement_Constraint, 0)
60 self.setOptimizationSense(co.Sense_Maximize)
64 @copydoc conopt.ModelData.evaluateNonlinearTerm
65 @ingroup PYTHON1THREAD_LARGEBND
77 self.
Al * pow(L, (-self.
Rho))
78 + self.
Ak * pow(self.
K, (-self.
Rho))
79 + self.
Ainp * pow(Inp, (-self.
Rho))
81 hold2 = pow(hold1, (-1.0 / self.
Rho))
89 @copydoc conopt.ModelData.evaluateNonlinearJacobian
90 @ingroup PYTHON1THREAD_LARGEBND
103 self.
Al * pow(L, (-self.
Rho))
104 + self.
Ak * pow(self.
K, (-self.
Rho))
105 + self.
Ainp * pow(Inp, (-self.
Rho))
107 hold2 = pow(hold1, (-1.0 / self.
Rho))
108 hold3 = hold2 / hold1
110 jac.append(hold3 * self.
Al * pow(L, (-self.
Rho - 1.0)))
111 jac.append(hold3 * self.
Ainp * pow(Inp, (-self.
Rho - 1.0)))
116if __name__ ==
'__main__':
117 name = os.path.basename(__file__)[:-3]
119 conopt = co.Conopt(name)
120 model = TutModelData()
125 conopt.loadModel(model)
126 conopt.setMessageHandler(msghdlr)
129 license_int_1 = os.environ.get(
'CONOPT_LICENSE_INT_1',
None)
130 license_int_2 = os.environ.get(
'CONOPT_LICENSE_INT_2',
None)
131 license_int_3 = os.environ.get(
'CONOPT_LICENSE_INT_3',
None)
132 license_text = os.environ.get(
'CONOPT_LICENSE_TEXT',
None)
134 license_int_1
is not None
135 and license_int_2
is not None
136 and license_int_3
is not None
137 and license_text
is not None
146 coi_error = conopt.solve()
static int checkSolve(String name, int model_status, int solution_status, double objective, double expected_objective, double tol)
buildModel(self)
adding the variables and constraints to the model
evaluateNonlinearTerm(self, x, rowno, ignerr, thread)
callback method for evaluating the nonlinear terms in a given row
evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread)
callback method for evaluating the jacobian for the nonlinear terms in a given row