Skip to content

Commit 3c46387

Browse files
authored
Merge pull request #287 from JuliaControl/bench_empc_hess
bench: new EMPC tests with `hessian=true`
2 parents b4ad881 + c41a8eb commit 3c46387

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

benchmark/3_bench_predictive_control.jl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,18 +417,36 @@ empc_ipopt_ss = NonLinMPC(estim2; Hp, Hc, Nwt, Mwt=Mwt2, Cwt, JE, Ewt, optim, tr
417417
empc_ipopt_ss = setconstraint!(empc_ipopt_ss; umin, umax)
418418
JuMP.unset_time_limit_sec(empc_ipopt_ss.optim)
419419

420+
optim = JuMP.Model(optimizer_with_attributes(Ipopt.Optimizer,"sb"=>"yes"), add_bridges=false)
421+
transcription, hessian = SingleShooting(), true
422+
empc_ipopt_ss_hess = NonLinMPC(estim2; Hp, Hc, Nwt, Mwt=Mwt2, Cwt, JE, Ewt, optim, transcription, hessian, p)
423+
empc_ipopt_ss_hess = setconstraint!(empc_ipopt_ss_hess; umin, umax)
424+
JuMP.unset_time_limit_sec(empc_ipopt_ss_hess.optim)
425+
420426
optim = JuMP.Model(optimizer_with_attributes(Ipopt.Optimizer,"sb"=>"yes"), add_bridges=false)
421427
transcription = MultipleShooting()
422428
empc_ipopt_ms = NonLinMPC(estim2; Hp, Hc, Nwt, Mwt=Mwt2, Cwt, JE, Ewt, optim, transcription, p)
423429
empc_ipopt_ms = setconstraint!(empc_ipopt_ms; umin, umax)
424430
JuMP.unset_time_limit_sec(empc_ipopt_ms.optim)
425431

432+
optim = JuMP.Model(optimizer_with_attributes(Ipopt.Optimizer,"sb"=>"yes"), add_bridges=false)
433+
transcription, hessian = MultipleShooting(), true
434+
empc_ipopt_ms_hess = NonLinMPC(estim2; Hp, Hc, Nwt, Mwt=Mwt2, Cwt, JE, Ewt, optim, transcription, hessian, p)
435+
empc_ipopt_ms_hess = setconstraint!(empc_ipopt_ms_hess; umin, umax)
436+
JuMP.unset_time_limit_sec(empc_ipopt_ms_hess.optim)
437+
426438
optim = JuMP.Model(optimizer_with_attributes(Ipopt.Optimizer,"sb"=>"yes"), add_bridges=false)
427439
transcription = TrapezoidalCollocation()
428440
empc_ipopt_tc = NonLinMPC(estim2; Hp, Hc, Nwt, Mwt=Mwt2, Cwt, JE, Ewt, optim, transcription, p)
429441
empc_ipopt_tc = setconstraint!(empc_ipopt_tc; umin, umax)
430442
JuMP.unset_time_limit_sec(empc_ipopt_tc.optim)
431443

444+
optim = JuMP.Model(optimizer_with_attributes(Ipopt.Optimizer,"sb"=>"yes"), add_bridges=false)
445+
transcription, hessian = TrapezoidalCollocation(), true
446+
empc_ipopt_tc_hess = NonLinMPC(estim2; Hp, Hc, Nwt, Mwt=Mwt2, Cwt, JE, Ewt, optim, transcription, hessian, p)
447+
empc_ipopt_tc_hess = setconstraint!(empc_ipopt_tc_hess; umin, umax)
448+
JuMP.unset_time_limit_sec(empc_ipopt_tc_hess.optim)
449+
432450
optim = JuMP.Model(MadNLP.Optimizer, add_bridges=false)
433451
transcription = SingleShooting()
434452
empc_madnlp_ss = NonLinMPC(estim2; Hp, Hc, Nwt, Mwt=Mwt2, Cwt, JE, Ewt, optim, transcription, p)
@@ -443,16 +461,31 @@ CASE_MPC["Pendulum"]["NonLinMPC"]["Economic"]["Ipopt"]["SingleShooting"] =
443461
sim!($empc_ipopt_ss, $N, $ry; plant=$plant2, x_0=$x_0, x̂_0=$x̂_0, progress=false),
444462
samples=samples, evals=evals, seconds=seconds
445463
)
464+
CASE_MPC["Pendulum"]["NonLinMPC"]["Economic"]["Ipopt"]["SingleShooting (Hessian)"] =
465+
@benchmarkable(
466+
sim!($empc_ipopt_ss_hess, $N, $ry; plant=$plant2, x_0=$x_0, x̂_0=$x̂_0, progress=false),
467+
samples=samples, evals=evals, seconds=seconds
468+
)
446469
CASE_MPC["Pendulum"]["NonLinMPC"]["Economic"]["Ipopt"]["MultipleShooting"] =
447470
@benchmarkable(
448471
sim!($empc_ipopt_ms, $N, $ry; plant=$plant2, x_0=$x_0, x̂_0=$x̂_0, progress=false),
449472
samples=samples, evals=evals, seconds=seconds
450473
)
474+
CASE_MPC["Pendulum"]["NonLinMPC"]["Economic"]["Ipopt"]["MultipleShooting (Hessian)"] =
475+
@benchmarkable(
476+
sim!($empc_ipopt_ms_hess, $N, $ry; plant=$plant2, x_0=$x_0, x̂_0=$x̂_0, progress=false),
477+
samples=samples, evals=evals, seconds=seconds
478+
)
451479
CASE_MPC["Pendulum"]["NonLinMPC"]["Economic"]["Ipopt"]["TrapezoidalCollocation"] =
452480
@benchmarkable(
453481
sim!($empc_ipopt_tc, $N, $ry; plant=$plant2, x_0=$x_0, x̂_0=$x̂_0, progress=false),
454482
samples=samples, evals=evals, seconds=seconds
455483
)
484+
CASE_MPC["Pendulum"]["NonLinMPC"]["Economic"]["Ipopt"]["TrapezoidalCollocation (Hessian)"] =
485+
@benchmarkable(
486+
sim!($empc_ipopt_tc_hess, $N, $ry; plant=$plant2, x_0=$x_0, x̂_0=$x̂_0, progress=false),
487+
samples=samples, evals=evals, seconds=seconds
488+
)
456489
CASE_MPC["Pendulum"]["NonLinMPC"]["Economic"]["MadNLP"]["SingleShooting"] =
457490
@benchmarkable(
458491
sim!($empc_madnlp_ss, $N, $ry; plant=$plant2, x_0=$x_0, x̂_0=$x̂_0, progress=false),

0 commit comments

Comments
 (0)