horizon.solvers package

Submodules

horizon.solvers.blocksqp module

class horizon.solvers.blocksqp.BlockSqpSolver(prb: horizon.problem.Problem, opts: Dict[KT, VT])

Bases: horizon.solvers.nlpsol.NlpsolSolver

configure_rti() → bool

Take appropriate actions to make the solver suitable for a RTI scheme

Returns:success flag
Return type:bool

horizon.solvers.ilqr module

class horizon.solvers.ilqr.SolverILQR(prb: horizon.problem.Problem, opts: Dict[KT, VT] = None)

Bases: horizon.solvers.solver.Solver

configure_rti() → bool

Take appropriate actions to make the solver suitable for a RTI scheme

Returns:success flag
Return type:bool
getDt()

Get the horizon’s dt as a vector of dt for each node.

Returns:array of dt values for each node
Return type:array
getSolutionDict()

Get the horizon’s solution

Returns:dictionary of variable optimized
Return type:dict
print_timings()
save()
set_iteration_callback(cb=None)
solve()

Solve the horizon’s problem

Returns:success flag
Return type:bool

horizon.solvers.ipopt module

class horizon.solvers.ipopt.IpoptSolver(prb: horizon.problem.Problem, opts: Dict[KT, VT])

Bases: horizon.solvers.nlpsol.NlpsolSolver

horizon.solvers.nlpsol module

class horizon.solvers.nlpsol.NlpsolSolver(prb: horizon.problem.Problem, opts: Dict[KT, VT], solver_plugin: str)

Bases: horizon.solvers.solver.Solver

build()
fill the dictionary “state_var_impl”
  • key: nodes (nNone, n0, n1, …) nNone contains single variables that are not projected in nodes
  • val: dict with name and value of implemented variable
getConstraintSolutionDict()
getDt()

Get the horizon’s dt as a vector of dt for each node.

Returns:array of dt values for each node
Return type:array
getSolutionDict()

Get the horizon’s solution

Returns:dictionary of variable optimized
Return type:dict
solve() → bool

Solve the horizon’s problem

Returns:success flag
Return type:bool

horizon.solvers.solver module

class horizon.solvers.solver.Solver(prb: horizon.problem.Problem, opts: Dict[KT, VT] = None)

Bases: abc.ABC

Solver is an abstract interface for a generic solver that aims to find a solution of an instance of horizon.Problem.

The typical usage requires to (i) given an horizon.Problem, call the factory make_solver() to retrieve a solver concrete instance, (ii) to call solve() on it, and (iii) to retrieve the solution as solver.x_opt, and solver.u_opt.

configure_rti() → bool

Take appropriate actions to make the solver suitable for a RTI scheme

Returns:success flag
Return type:bool
getDt()

Get the horizon’s dt as a vector of dt for each node.

Returns:array of dt values for each node
Return type:array
getSolutionDict()

Get the horizon’s solution

Returns:dictionary of variable optimized
Return type:dict
classmethod make_solver(type: str, prb: horizon.problem.Problem, opts: Dict[KT, VT] = None) → horizon.solvers.solver.Solver

Construct a solver from its type name

Parameters:
  • type (str) – a string indicating the solver type (e.g., blocksqp, ipopt, ilqr)
  • prb (Problem) – the horizon’s problem instance to be solved
  • dt (float) – the discretization step, None if not needed
  • opts (Dict, optional) – A solver-dependent Dict of options. Defaults to None.
solve() → bool

Solve the horizon’s problem

Returns:success flag
Return type:bool

horizon.solvers.sqp module

class horizon.solvers.sqp.GNSQPSolver(prb: horizon.problem.Problem, opts: Dict[KT, VT], qp_solver_plugin: str)

Bases: horizon.solvers.solver.Solver

getAlpha()
getBeta()
getConstraintNormIterations()
getConstraintSolutionDict()
getDt()

Get the horizon’s dt as a vector of dt for each node.

Returns:array of dt values for each node
Return type:array
getHessianComputationTime()
getLineSearchComputationTime()
getObjectiveIterations()
getQPComputationTime()
getSolutionDict()

Get the horizon’s solution

Returns:dictionary of variable optimized
Return type:dict
setAlphaMin(alpha_min)
setBeta(beta)
set_iteration_callback(cb=None)
solve() → bool

Solve the horizon’s problem

Returns:success flag
Return type:bool

Module contents