Skip to content

Commit e1e5bc9

Browse files
committed
charge 'horizon' to 'timepts' in solve_ocp
1 parent 20177f2 commit e1e5bc9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

control/optimal.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ def __init__(
940940

941941
# Compute the input for a nonlinear, (constrained) optimal control problem
942942
def solve_ocp(
943-
sys, horizon, X0, cost, trajectory_constraints=None, terminal_cost=None,
943+
sys, timepts, X0, cost, trajectory_constraints=None, terminal_cost=None,
944944
terminal_constraints=[], initial_guess=None, basis=None, squeeze=None,
945945
transpose=None, return_states=True, print_summary=True, log=False,
946946
**kwargs):
@@ -952,7 +952,7 @@ def solve_ocp(
952952
sys : InputOutputSystem
953953
I/O system for which the optimal input will be computed.
954954
955-
horizon : 1D array_like
955+
timepts : 1D array_like
956956
List of times at which the optimal input should be computed.
957957
958958
X0: array-like or number, optional
@@ -990,9 +990,9 @@ def solve_ocp(
990990
991991
initial_guess : 1D or 2D array_like
992992
Initial inputs to use as a guess for the optimal input. The inputs
993-
should either be a 2D vector of shape (ninputs, horizon) or a 1D
994-
input of shape (ninputs,) that will be broadcast by extension of the
995-
time axis.
993+
should either be a 2D vector of shape (ninputs, len(timepts)) or a
994+
1D input of shape (ninputs,) that will be broadcast by extension of
995+
the time axis.
996996
997997
log : bool, optional
998998
If `True`, turn on logging messages (using Python logging module).
@@ -1069,7 +1069,7 @@ def solve_ocp(
10691069

10701070
# Set up the optimal control problem
10711071
ocp = OptimalControlProblem(
1072-
sys, horizon, cost, trajectory_constraints=trajectory_constraints,
1072+
sys, timepts, cost, trajectory_constraints=trajectory_constraints,
10731073
terminal_cost=terminal_cost, terminal_constraints=terminal_constraints,
10741074
initial_guess=initial_guess, basis=basis, log=log, **kwargs)
10751075

@@ -1081,12 +1081,12 @@ def solve_ocp(
10811081

10821082
# Create a model predictive controller for an optimal control problem
10831083
def create_mpc_iosystem(
1084-
sys, horizon, cost, constraints=[], terminal_cost=None,
1084+
sys, timepts, cost, constraints=[], terminal_cost=None,
10851085
terminal_constraints=[], log=False, **kwargs):
10861086
"""Create a model predictive I/O control system
10871087
10881088
This function creates an input/output system that implements a model
1089-
predictive control for a system given the time horizon, cost function and
1089+
predictive control for a system given the time points, cost function and
10901090
constraints that define the finite-horizon optimization that should be
10911091
carried out at each state.
10921092
@@ -1095,7 +1095,7 @@ def create_mpc_iosystem(
10951095
sys : InputOutputSystem
10961096
I/O system for which the optimal input will be computed.
10971097
1098-
horizon : 1D array_like
1098+
timepts : 1D array_like
10991099
List of times at which the optimal input should be computed.
11001100
11011101
cost : callable
@@ -1133,7 +1133,7 @@ def create_mpc_iosystem(
11331133
"""
11341134
# Set up the optimal control problem
11351135
ocp = OptimalControlProblem(
1136-
sys, horizon, cost, trajectory_constraints=constraints,
1136+
sys, timepts, cost, trajectory_constraints=constraints,
11371137
terminal_cost=terminal_cost, terminal_constraints=terminal_constraints,
11381138
log=log, kwargs_check=False, **kwargs)
11391139

0 commit comments

Comments
 (0)