30 adding the variables and constraints to the model
31 @ingroup PYTHON1THREAD_TUTORIAL2
34 self.addVariable(0.1, co.Conopt.Infinity, 0.5)
35 self.addVariable(0.1, co.Conopt.Infinity, 0.5)
36 self.addVariable(0.0, co.Conopt.Infinity)
37 self.addVariable(0.0, co.Conopt.Infinity)
40 self.addConstraint(co.ConstraintType_Free, -0.1, [0, 1, 2, 3],
41 [-1, -1, 0, 0], [0, 0, 1, 1])
42 self.addConstraint(co.ConstraintType_Eq, 0.0, [0, 1, 2], [0, 0, -1],
44 self.addConstraint(co.ConstraintType_Eq, 4.0, [2, 3], [1, 2],
48 self.setObjectiveElement(co.ObjectiveElement_Constraint, 0)
51 self.setOptimizationSense(co.Sense_Maximize)
54 self.setSDLagrangianStructure([0, 1, 1, 3], [0, 0, 1, 2])
103 @ingroup PYTHON1THREAD_TUTORIAL2
105 numhessian = len(hessianrow)
106 hessian = [0
for i
in range(numhessian)]
114 hold1 = (self.
Al*pow(L,-self.
Rho) + self.
Ak*pow(self.
K,-self.
Rho) + self.
Ainp*pow(Inp,-self.
Rho))
115 hold2 = pow( hold1,-1.0/self.
Rho)
116 hold3 = hold2 / hold1
118 hold4 = hold3 / hold1 * (-1.0/self.
Rho-1.0)
120 hessian[0] = hold4 * (-self.
Rho) * pow(self.
Al*pow(L,-self.
Rho-1.0),2) \
121 + hold3 * self.
Al * (-self.
Rho-1.0)*pow(L,-self.
Rho-2.0)
122 hessian[1] = hold4 * (-self.
Rho) * (self.
Al*pow(L,-self.
Rho-1.0)) * \
123 (self.
Ainp*pow(Inp,-self.
Rho-1.0))
124 hessian[2] = hold4 * (-self.
Rho) * \
125 pow(self.
Ainp*pow(Inp,-self.
Rho-1.0),2) + \
126 hold3 * self.
Ainp * (-self.
Rho-1.0)*pow(Inp,-self.
Rho-2.0)
128 for i
in range(numhessian):
129 hessian[i] = hessian[i] * u[1]