14sys.path.append(
'../common/')
24 adding the variables and constraints to the model
25 @ingroup PYTHON1THREAD_LARGERES1
29 -co.Conopt.Infinity, co.Conopt.Infinity, 35.0
33 self.
considx = self.addConstraint(co.ConstraintType_Eq, 10, [0], [0], [1])
36 self.setObjectiveElement(co.ObjectiveElement_Variable, self.
varidx)
39 self.setOptimizationSense(co.Sense_Maximize)
43 @copydoc conopt.ModelData.evaluateNonlinearTerm
44 @ingroup PYTHON1THREAD_LARGERES1
48 g = math.exp(x[self.
varidx])
54 @copydoc conopt.ModelData.evaluateNonlinearJacobian
55 @ingroup PYTHON1THREAD_LARGERES1
59 jac.append(math.exp(x[self.
varidx]))
64if __name__ ==
'__main__':
65 name = os.path.basename(__file__)[:-3]
67 conopt = co.Conopt(name)
68 model = LargeResModelData()
73 conopt.loadModel(model)
74 conopt.setMessageHandler(msghdlr)
77 license_int_1 = os.environ.get(
'CONOPT_LICENSE_INT_1',
None)
78 license_int_2 = os.environ.get(
'CONOPT_LICENSE_INT_2',
None)
79 license_int_3 = os.environ.get(
'CONOPT_LICENSE_INT_3',
None)
80 license_text = os.environ.get(
'CONOPT_LICENSE_TEXT',
None)
82 license_int_1
is not None
83 and license_int_2
is not None
84 and license_int_3
is not None
85 and license_text
is not None
94 coi_error = conopt.solve()
97 std.python_log(conopt,
'Expected return code 400, Saw')
99 std.python_log(conopt,
'Successful Solve')
evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread)
callback method for evaluating the jacobian for the nonlinear terms in a given row
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