Skip to content

Commit 4ea61b7

Browse files
committed
bench: new test on the pendulum with MS and UnoSolver
1 parent 93bcef3 commit 4ea61b7

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

benchmark/3_bench_predictive_control.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,13 @@ optim = JuMP.Model(MadNLP.Optimizer, add_bridges=false)
318318
transcription = SingleShooting()
319319
nmpc_madnlp_ss = NonLinMPC(estim; Hp, Hc, Mwt, Nwt, Cwt, optim, transcription)
320320
nmpc_madnlp_ss = setconstraint!(nmpc_madnlp_ss; umin, umax)
321-
JuMP.unset_time_limit_sec(nmpc_madnlp_ss.optim)
321+
JuMP.unset_time_limit_sec(nmpc_madnlp_ss.optim)
322+
323+
optim = JuMP.Model(()->UnoSolver.Optimizer(preset="filtersqp"), add_bridges=false)
324+
transcription, hessian, oracle = MultipleShooting(), true, true
325+
nmpc_uno_ms_hess = NonLinMPC(estim; Hp, Hc, Mwt, Nwt, Cwt, optim, transcription, hessian, oracle)
326+
nmpc_uno_ms_hess = setconstraint!(nmpc_uno_ms_hess; umin, umax)
327+
JuMP.unset_time_limit_sec(nmpc_uno_ms_hess.optim)
322328

323329
# TODO: does not work well with MadNLP and MultipleShooting or TrapezoidalCollocation,
324330
# figure out why. Current theory:
@@ -375,6 +381,11 @@ CASE_MPC["Pendulum"]["NonLinMPC"]["Noneconomic"]["MadNLP"]["SingleShooting"] =
375381
sim!($nmpc_madnlp_ss, $N, $ry; plant=$plant, x_0=$x_0, x̂_0=$x̂_0, progress=false),
376382
samples=samples, evals=evals, seconds=seconds
377383
)
384+
CASE_MPC["Pendulum"]["NonLinMPC"]["Noneconomic"]["Uno"]["MultipleShooting (Hessian)"] =
385+
@benchmarkable(
386+
sim!($nmpc_uno_ms_hess, $N, $ry; plant=$plant, x_0=$x_0, x̂_0=$x̂_0, progress=false),
387+
samples=samples, evals=evals, seconds=seconds
388+
)
378389

379390
# ----------------- Case study: Pendulum economic --------------------------------
380391
model2, p = pendulum_model2, pendulum_p2

benchmark/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1313
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1414
SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5"
1515
SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35"
16+
UnoSolver = "1baa60ac-02f7-4b39-a7a8-2f4f58486b05"

benchmark/benchmarks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using BenchmarkTools
22
using ModelPredictiveControl, ControlSystemsBase, LinearAlgebra
3-
using JuMP, OSQP, DAQP, Ipopt, MadNLP
3+
using JuMP, OSQP, DAQP, Ipopt, MadNLP, UnoSolver
44

55
const SUITE = BenchmarkGroup(["ModelPredictiveControl"])
66

src/controller/nonlinmpc.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ This controller allocates memory at each time step for the optimization.
222222
function, see [`DifferentiationInterface` doc](@extref DifferentiationInterface List).
223223
- `jacobian=default_jacobian(transcription)` : an `AbstractADType` backend for the Jacobian
224224
of the nonlinear constraints, see `gradient` above for the options (default in Extended Help).
225-
- `hessian=false` : an `AbstractADType` backend for the Hessian of the Lagrangian, see
226-
`gradient` above for the options. The default `false` skip it and use the quasi-Newton
227-
method of `optim`, which is always the case if `oracle=false` (see Extended Help).
228-
- `oracle=JuMP.solver_name(optim)=="Ipopt"`: use the efficient [`VectorNonlinearOracle`](@extref MathOptInterface MathOptInterface.VectorNonlinearOracle)
229-
for the nonlinear constraints (not supported by most optimizers for now).
225+
- `hessian=false` : an `AbstractADType` backend or `Bool` for the Hessian of the Lagrangian,
226+
see `gradient` above for the options. The default `false` skip it and use the quasi-Newton
227+
method of `optim`, which is always the case if `oracle=false` (see Extended Help).
228+
- `oracle=JuMP.solver_name(optim)=="Ipopt"` : a `Bool` to use the [`VectorNonlinearOracle`](@extref MathOptInterface MathOptInterface.VectorNonlinearOracle)
229+
for efficient nonlinear constraints (not supported by most optimizers for now).
230230
- additional keyword arguments are passed to [`UnscentedKalmanFilter`](@ref) constructor
231231
(or [`SteadyKalmanFilter`](@ref), for [`LinModel`](@ref)).
232232

src/estimator/mhe/construct.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ transcription for now.
279279
- `hessian=false` : an `AbstractADType` backend for the Hessian of the Lagrangian, see
280280
`gradient` above for the options. The default `false` skip it and use the quasi-Newton
281281
method of `optim`, which is always the case if `oracle=false` (see Extended Help).
282-
- `oracle=JuMP.solver_name(optim)=="Ipopt"`: use the efficient [`VectorNonlinearOracle`](@extref MathOptInterface MathOptInterface.VectorNonlinearOracle)
283-
for the nonlinear constraints (not supported by most optimizers for now).
282+
- `oracle=JuMP.solver_name(optim)=="Ipopt"` : a `Bool` to use the [`VectorNonlinearOracle`](@extref MathOptInterface MathOptInterface.VectorNonlinearOracle)
283+
for efficient nonlinear constraints (not supported by most optimizers for now).
284284
- `direct=true`: construct with a direct transmission from ``\mathbf{y^m}`` (a.k.a. current
285285
estimator, in opposition to the delayed/predictor form).
286286

0 commit comments

Comments
 (0)