pub struct ShootingProblem<S: Scalar> { /* private fields */ }Expand description
Builder for single-shooting optimal control problems.
Implementations§
Source§impl<S: Scalar> ShootingProblem<S>
impl<S: Scalar> ShootingProblem<S>
Sourcepub fn new(n_states: usize, n_controls: usize) -> Self
pub fn new(n_states: usize, n_controls: usize) -> Self
Create a new shooting problem.
n_states: dimension of the ODE state vector.n_controls: dimension of the control vector per segment.
Sourcepub fn dynamics<F>(self, f: F) -> Self
pub fn dynamics<F>(self, f: F) -> Self
Set the controlled ODE right-hand side: f(t, y, dydt, u).
Sourcepub fn initial_state(self, y0: Vec<S>) -> Self
pub fn initial_state(self, y0: Vec<S>) -> Self
Set the initial state y(t0).
Sourcepub fn n_segments(self, n: usize) -> Self
pub fn n_segments(self, n: usize) -> Self
Set the number of control intervals.
Sourcepub fn control_bounds(self, bounds: Vec<Option<(S, S)>>) -> Self
pub fn control_bounds(self, bounds: Vec<Option<(S, S)>>) -> Self
Set bounds for each control variable (applied to every segment).
Sourcepub fn terminal_cost<F>(self, f: F) -> Self
pub fn terminal_cost<F>(self, f: F) -> Self
Set the terminal cost phi(y(T)).
Sourcepub fn running_cost<F>(self, f: F) -> Self
pub fn running_cost<F>(self, f: F) -> Self
Set the running cost L(t, y, u).
Sourcepub fn terminal_constraint<F>(self, f: F) -> Self
pub fn terminal_constraint<F>(self, f: F) -> Self
Set terminal equality constraints h(y(T)) = 0.
Sourcepub fn ode_tolerances(self, rtol: S, atol: S) -> Self
pub fn ode_tolerances(self, rtol: S, atol: S) -> Self
Set ODE solver tolerances.
Sourcepub fn solve(self) -> Result<ShootingResult<S>, OcpError>
pub fn solve(self) -> Result<ShootingResult<S>, OcpError>
Execute the single-shooting optimal control solve.
Auto Trait Implementations§
impl<S> Freeze for ShootingProblem<S>where
S: Freeze,
impl<S> !RefUnwindSafe for ShootingProblem<S>
impl<S> Send for ShootingProblem<S>
impl<S> Sync for ShootingProblem<S>
impl<S> Unpin for ShootingProblem<S>where
S: Unpin,
impl<S> UnsafeUnpin for ShootingProblem<S>where
S: UnsafeUnpin,
impl<S> !UnwindSafe for ShootingProblem<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more