optimizeメソッド
モデルの最適化を実行します。
- まず、問題の定義を使用して最適化エンジンを作成します。
- 次に、指定したシステムを目的の精度で最適化することを最適化エンジンに指示します。
例
def optimize (self):
# Define the cost functions in a list – there are 3 of these
obj = [self.a2x, self.a2y, self.a2psi]
# Define the weights for the cost functions in a list – there are 3 of these
wt = [1,1,1]
# Define the list of responses consist of inequality constraints – there are 6 of these
ineq = [self.cons1, self.cons2, self.cons3, self.cons4, self.cons5, self.cons6]
# Create the optimizer
opt = Optimizer ( label = "Optimize RMS2", # Label
objective = obj, # Objectives
weights = wt, # Weights
type = "KINEMATICS", # Simulation Type
end = 2, # End Time
dtout = 0.01, # No. of steps
plot = True, # Display plots
ineqConstraints = ineq # Inequality constraints
)
# Now perform the optimization
x = opt.optimize ()
# Return the result
return x
例
def optimize (self):
# Define the cost functions in a list – there are 3 of these
obj = [self.a2x, self.a2y, self.a2psi]
# Define the weights for the cost functions in a list – there are 3 of these
wt = [1,1,1]
# Create the optimizer
opt = Optimizer ( label = "Optimize RMS2", # Label
objective = obj, # Objectives
weights = wt, # Weights
simMethod = self.simulate # The simulation method
plot = True, # Display plots
)
# Now perform the optimization
x = opt.optimize (accuracy=1e-3)
# Return the result
return x