我正在设计一个二维受限的火箭模型。其动态模型有 6 个状态和 2 个输入。
我正在使用最佳控制python库。该库的文档可以在以下链接中找到:Python 最佳控制库。链接文档的第 195 页描述了最优控制问题的约束。请不要这样,Final_x
并Final_z
表示火箭在 2D 空间中的最终坐标。[Min_T, a_min], [Max_T, a_max]
表示火箭系统的推力和推力矢量角的上限和下限(这些是输入)。
我正在定义我的约束,然后以下列方式将它们传递给求解器:
con1 = [ opt.input_range_constraint(rocket, [Min_T, a_min], [Max_T, a_max]) ]
terminal = [ opt.state_range_constraint(rocket, [Final_x, -np.inf, Final_z, -np.inf, -np.inf, -np.inf],
[Final_x, np.inf, Final_z, np.inf, np.inf, np.inf]) ]
result = opt.solve_ocp(
rocket, horizon, x0, cost, con1, terminal_constraints=terminal,
initial_guess=bend_left, log=False, minimize_method="SLSQP",
minimize_options={'ftol': 0.000001, 'eps': np.finfo(float).eps, "maxiter": 500, "disp":True})
如上所述定义和传递约束时,我收到以下错误消息:
/opt/anaconda3/lib/python3.8/site-packages/scipy/optimize/_constraints.py:386: OptimizeWarning: At least one constraint is unbounded above and below. Such constraints are ignored.
warn("At least one constraint is unbounded above and below. Such "
/opt/anaconda3/lib/python3.8/site-packages/scipy/optimize/_constraints.py:432: OptimizeWarning: Equality and inequality constraints are specified in the same element of the constraint list. For efficient use with this method, equality and inequality constraints should be specified in separate elements of the constraint list.
warn("Equality and inequality constraints are specified in the same "
根据错误消息的要求,分别定义约束的正确方法是什么?