@@ -308,6 +308,12 @@ nmpc_ipopt_tc = NonLinMPC(estim; Hp, Hc, Mwt, Nwt, Cwt, optim, transcription)
308308nmpc_ipopt_tc = setconstraint! (nmpc_ipopt_tc; umin, umax)
309309JuMP. unset_time_limit_sec (nmpc_ipopt_tc. optim)
310310
311+ optim = JuMP. Model (optimizer_with_attributes (Ipopt. Optimizer," sb" => " yes" ), add_bridges= false )
312+ transcription, hessian = TrapezoidalCollocation (), true
313+ nmpc_ipopt_tc_hess = NonLinMPC (estim; Hp, Hc, Mwt, Nwt, Cwt, optim, transcription, hessian)
314+ nmpc_ipopt_tc_hess = setconstraint! (nmpc_ipopt_tc_hess; umin, umax)
315+ JuMP. unset_time_limit_sec (nmpc_ipopt_tc_hess. optim)
316+
311317optim = JuMP. Model (optimizer_with_attributes (Ipopt. Optimizer," sb" => " yes" ), add_bridges= false )
312318transcription = TrapezoidalCollocation (f_threads= true )
313319nmpc_ipopt_tct = NonLinMPC (estim; Hp, Hc, Mwt, Nwt, Cwt, optim, transcription)
@@ -371,6 +377,11 @@ CASE_MPC["Pendulum"]["NonLinMPC"]["Noneconomic"]["Ipopt"]["TrapezoidalCollocatio
371377 sim! ($ nmpc_ipopt_tc, $ N, $ ry; plant= $ plant, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
372378 samples= samples, evals= evals, seconds= seconds
373379 )
380+ CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Noneconomic" ][" Ipopt" ][" TrapezoidalCollocation (Hessian)" ] =
381+ @benchmarkable (
382+ sim! ($ nmpc_ipopt_tc_hess, $ N, $ ry; plant= $ plant, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
383+ samples= samples, evals= evals, seconds= seconds
384+ )
374385CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Noneconomic" ][" Ipopt" ][" TrapezoidalCollocation (threaded)" ] =
375386 @benchmarkable (
376387 sim! ($ nmpc_ipopt_tct, $ N, $ ry; plant= $ plant, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
@@ -406,18 +417,36 @@ empc_ipopt_ss = NonLinMPC(estim2; Hp, Hc, Nwt, Mwt=Mwt2, Cwt, JE, Ewt, optim, tr
406417empc_ipopt_ss = setconstraint! (empc_ipopt_ss; umin, umax)
407418JuMP. unset_time_limit_sec (empc_ipopt_ss. optim)
408419
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+
409426optim = JuMP. Model (optimizer_with_attributes (Ipopt. Optimizer," sb" => " yes" ), add_bridges= false )
410427transcription = MultipleShooting ()
411428empc_ipopt_ms = NonLinMPC (estim2; Hp, Hc, Nwt, Mwt= Mwt2, Cwt, JE, Ewt, optim, transcription, p)
412429empc_ipopt_ms = setconstraint! (empc_ipopt_ms; umin, umax)
413430JuMP. unset_time_limit_sec (empc_ipopt_ms. optim)
414431
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+
415438optim = JuMP. Model (optimizer_with_attributes (Ipopt. Optimizer," sb" => " yes" ), add_bridges= false )
416439transcription = TrapezoidalCollocation ()
417440empc_ipopt_tc = NonLinMPC (estim2; Hp, Hc, Nwt, Mwt= Mwt2, Cwt, JE, Ewt, optim, transcription, p)
418441empc_ipopt_tc = setconstraint! (empc_ipopt_tc; umin, umax)
419442JuMP. unset_time_limit_sec (empc_ipopt_tc. optim)
420443
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+
421450optim = JuMP. Model (MadNLP. Optimizer, add_bridges= false )
422451transcription = SingleShooting ()
423452empc_madnlp_ss = NonLinMPC (estim2; Hp, Hc, Nwt, Mwt= Mwt2, Cwt, JE, Ewt, optim, transcription, p)
@@ -432,16 +461,31 @@ CASE_MPC["Pendulum"]["NonLinMPC"]["Economic"]["Ipopt"]["SingleShooting"] =
432461 sim! ($ empc_ipopt_ss, $ N, $ ry; plant= $ plant2, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
433462 samples= samples, evals= evals, seconds= seconds
434463 )
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+ )
435469CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Economic" ][" Ipopt" ][" MultipleShooting" ] =
436470 @benchmarkable (
437471 sim! ($ empc_ipopt_ms, $ N, $ ry; plant= $ plant2, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
438472 samples= samples, evals= evals, seconds= seconds
439473 )
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+ )
440479CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Economic" ][" Ipopt" ][" TrapezoidalCollocation" ] =
441480 @benchmarkable (
442481 sim! ($ empc_ipopt_tc, $ N, $ ry; plant= $ plant2, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
443482 samples= samples, evals= evals, seconds= seconds
444483 )
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+ )
445489CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Economic" ][" MadNLP" ][" SingleShooting" ] =
446490 @benchmarkable (
447491 sim! ($ empc_madnlp_ss, $ N, $ ry; plant= $ plant2, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
@@ -480,6 +524,14 @@ nmpc2_ipopt_ms = NonLinMPC(estim2;
480524nmpc2_ipopt_ms = setconstraint! (nmpc2_ipopt_ms; umin, umax)
481525JuMP. unset_time_limit_sec (nmpc2_ipopt_ms. optim)
482526
527+ optim = JuMP. Model (optimizer_with_attributes (Ipopt. Optimizer," sb" => " yes" ), add_bridges= false )
528+ transcription, hessian = MultipleShooting (), true
529+ nmpc2_ipopt_ms_hess = NonLinMPC (estim2;
530+ Hp, Hc, Nwt= Nwt, Mwt= [0.5 , 0 ], Cwt, gc!, nc, p= Pmax, optim, transcription, hessian
531+ )
532+ nmpc2_ipopt_ms_hess = setconstraint! (nmpc2_ipopt_ms_hess; umin, umax)
533+ JuMP. unset_time_limit_sec (nmpc2_ipopt_ms_hess. optim)
534+
483535optim = JuMP. Model (optimizer_with_attributes (Ipopt. Optimizer," sb" => " yes" ), add_bridges= false )
484536transcription = TrapezoidalCollocation ()
485537nmpc2_ipopt_tc = NonLinMPC (estim2;
@@ -488,9 +540,13 @@ nmpc2_ipopt_tc = NonLinMPC(estim2;
488540nmpc2_ipopt_tc = setconstraint! (nmpc2_ipopt_tc; umin, umax)
489541JuMP. unset_time_limit_sec (nmpc2_ipopt_tc. optim)
490542
491- # TODO : test custom constraints with MadNLP and SingleShooting, see comment above.
492- # TODO : test custom constraints with MadNLP and MultipleShooting, see comment above.
493- # TODO : test custom constraints with MadNLP and TrapezoidalCollocation, see comment above.
543+ optim = JuMP. Model (optimizer_with_attributes (Ipopt. Optimizer," sb" => " yes" ), add_bridges= false )
544+ transcription, hessian = TrapezoidalCollocation (), true
545+ nmpc2_ipopt_tc_hess = NonLinMPC (estim2;
546+ Hp, Hc, Nwt= Nwt, Mwt= [0.5 , 0 ], Cwt, gc!, nc, p= Pmax, optim, transcription, hessian
547+ )
548+ nmpc2_ipopt_tc = setconstraint! (nmpc2_ipopt_tc_hess; umin, umax)
549+ JuMP. unset_time_limit_sec (nmpc2_ipopt_tc_hess. optim)
494550
495551samples, evals, seconds = 100 , 1 , 15 * 60
496552CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Custom constraints" ][" Ipopt" ][" SingleShooting" ] =
@@ -503,11 +559,21 @@ CASE_MPC["Pendulum"]["NonLinMPC"]["Custom constraints"]["Ipopt"]["MultipleShooti
503559 sim! ($ nmpc2_ipopt_ms, $ N, $ ry; plant= $ plant2, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
504560 samples= samples, evals= evals, seconds= seconds
505561 )
562+ CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Custom constraints" ][" Ipopt" ][" MultipleShooting (Hessian)" ] =
563+ @benchmarkable (
564+ sim! ($ nmpc2_ipopt_ms_hess, $ N, $ ry; plant= $ plant2, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
565+ samples= samples, evals= evals, seconds= seconds
566+ )
506567CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Custom constraints" ][" Ipopt" ][" TrapezoidalCollocation" ] =
507568 @benchmarkable (
508569 sim! ($ nmpc2_ipopt_tc, $ N, $ ry; plant= $ plant2, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
509570 samples= samples, evals= evals, seconds= seconds
510571 )
572+ CASE_MPC[" Pendulum" ][" NonLinMPC" ][" Custom constraints" ][" Ipopt" ][" TrapezoidalCollocation (Hessian)" ] =
573+ @benchmarkable (
574+ sim! ($ nmpc2_ipopt_tc_hess, $ N, $ ry; plant= $ plant2, x_0= $ x_0, x̂_0= $ x̂_0, progress= false ),
575+ samples= samples, evals= evals, seconds= seconds
576+ )
511577
512578# ----------------- Case study: Pendulum successive linearization -------------------------
513579linmodel = linearize (model, x= [0 , 0 ], u= [0 ])
0 commit comments