├── .gitignore
├── .travis.yml
├── CMakeLists.txt
├── Changelog.txt
├── LICENSE.txt
├── Makefile
├── Makefile.external_blas
├── Makefile.rule
├── README.md
├── TODO.txt
├── archive
├── include
│ ├── hpipm_d_irk_int.h
│ ├── hpipm_d_ocp_nlp.h
│ ├── hpipm_d_ocp_nlp_aux.h
│ ├── hpipm_d_ocp_nlp_hyb.h
│ ├── hpipm_d_ocp_nlp_ipm.h
│ ├── hpipm_d_ocp_nlp_sol.h
│ ├── hpipm_d_ocp_nlp_sqp.h
│ └── hpipm_s_ocp_nlp_sol.h
├── ocp_nlp
│ ├── Makefile
│ ├── d_ocp_nlp.c
│ ├── d_ocp_nlp_aux.c
│ ├── d_ocp_nlp_hyb.c
│ ├── d_ocp_nlp_ipm.c
│ ├── d_ocp_nlp_sol.c
│ ├── d_ocp_nlp_sqp.c
│ ├── s_ocp_nlp_sol.c
│ └── x_ocp_nlp_sol.c
├── pendulum
│ ├── jac_model.c
│ ├── ode_model.c
│ ├── vde_adj_model.c
│ ├── vde_forw_model.c
│ └── vde_hess_model.c
├── sim_core
│ └── d_irk_int.c
├── sqp
│ └── d_gn_sqp.c
├── test_d_nlp_ipm.c
├── test_d_nlp_sqp.c
├── test_d_pendulum_hyb.c
├── test_d_pendulum_ipm.c
├── test_d_pendulum_sqp.c
├── test_van_der_pol_hyb.c
├── test_van_der_pol_ipm.c
└── test_van_der_pol_sqp.c
├── auxiliary
├── Makefile
├── aux_mem.c
├── aux_string.c
└── timing.c
├── benchmark
├── .gitignore
├── Makefile
├── d_benchmark.h
├── fetch_cpp_data
└── test_d_benchmark.c
├── cond
├── Makefile
├── d_cast_qcqp.c
├── d_cond.c
├── d_cond_aux.c
├── d_cond_qcqp.c
├── d_elim_x0.c
├── d_part_cond.c
├── d_part_cond_qcqp.c
├── s_cast_qcqp.c
├── s_cond.c
├── s_cond_aux.c
├── s_cond_qcqp.c
├── s_part_cond.c
├── s_part_cond_qcqp.c
├── x_cast_qcqp.c
├── x_cond.c
├── x_cond_aux.c
├── x_cond_qcqp.c
├── x_part_cond.c
└── x_part_cond_qcqp.c
├── dense_qp
├── Makefile
├── d_dense_qcqp.c
├── d_dense_qcqp_dim.c
├── d_dense_qcqp_ipm.c
├── d_dense_qcqp_res.c
├── d_dense_qcqp_sol.c
├── d_dense_qcqp_utils.c
├── d_dense_qp.c
├── d_dense_qp_dim.c
├── d_dense_qp_ipm.c
├── d_dense_qp_kkt.c
├── d_dense_qp_res.c
├── d_dense_qp_seed.c
├── d_dense_qp_sol.c
├── d_dense_qp_utils.c
├── m_dense_qp.c
├── m_dense_qp_dim.c
├── s_dense_qcqp.c
├── s_dense_qcqp_dim.c
├── s_dense_qcqp_ipm.c
├── s_dense_qcqp_res.c
├── s_dense_qcqp_sol.c
├── s_dense_qcqp_utils.c
├── s_dense_qp.c
├── s_dense_qp_dim.c
├── s_dense_qp_ipm.c
├── s_dense_qp_kkt.c
├── s_dense_qp_res.c
├── s_dense_qp_seed.c
├── s_dense_qp_sol.c
├── s_dense_qp_utils.c
├── x_dense_qcqp.c
├── x_dense_qcqp_dim.c
├── x_dense_qcqp_ipm.c
├── x_dense_qcqp_res.c
├── x_dense_qcqp_sol.c
├── x_dense_qcqp_utils.c
├── x_dense_qp.c
├── x_dense_qp_dim.c
├── x_dense_qp_ipm.c
├── x_dense_qp_kkt.c
├── x_dense_qp_res.c
├── x_dense_qp_seed.c
├── x_dense_qp_sol.c
└── x_dense_qp_utils.c
├── doc
├── guide.pdf
└── guide.tex
├── examples
├── archive
│ ├── matlab
│ │ ├── README.md
│ │ ├── getting_started.m
│ │ ├── getting_started_no_matlab_wrapper.m
│ │ ├── getting_started_soft_constr.m
│ │ └── mass_spring_example.m
│ └── octave
│ │ ├── README.md
│ │ ├── getting_started.m
│ │ ├── getting_started_soft_constr.m
│ │ ├── import.m
│ │ └── mass_spring_example.m
├── c
│ ├── CMakeLists.txt
│ ├── Makefile
│ ├── data
│ │ ├── .gitignore
│ │ ├── getting_started_data.c
│ │ ├── getting_started_dense_qp_data.c
│ │ ├── mass_spring_qcqp_data.c
│ │ ├── mass_spring_qp_data.c
│ │ └── pmsm_ocp_qcqp_data.c
│ ├── example_d_dense_qp.c
│ ├── example_d_ocp_qcqp_part_cond.c
│ ├── example_d_ocp_qcqp_x0emb_cond.c
│ ├── example_d_ocp_qcqp_x0emb_part_cond.c
│ ├── example_d_ocp_qp.c
│ ├── example_d_ocp_qp_cond_sens.c
│ ├── example_d_ocp_qp_part_cond.c
│ ├── example_d_ocp_qp_part_cond_sens.c
│ ├── example_d_ocp_qp_sens.c
│ ├── example_d_ocp_qp_solver.c
│ ├── example_d_ocp_qp_unconstr.c
│ ├── example_d_ocp_qp_x0emb.c
│ ├── example_d_ocp_qp_x0emb_cond.c
│ ├── example_d_ocp_qp_x0emb_part_cond.c
│ └── example_d_ocp_qp_x0emb_part_cond_sens.c
├── casadi_python
│ ├── .gitignore
│ ├── Makefile
│ ├── PMSM_model.py
│ ├── env.sh
│ ├── example_PMSM.py
│ └── reference_solver.py
├── matlab_octave
│ ├── .gitignore
│ ├── Makefile
│ ├── README.md
│ ├── env.sh
│ ├── example_from_qp_data_c.m
│ ├── example_getting_started.m
│ ├── example_getting_started_dense_qcqp.m
│ ├── example_getting_started_dense_qp.m
│ ├── example_mass_spring_qcqp.m
│ ├── example_mass_spring_qp.m
│ └── example_mass_spring_qp_ric.m
├── python
│ ├── .gitignore
│ ├── Makefile
│ ├── README.md
│ ├── env.sh
│ ├── example_debug.py
│ ├── example_dense_qcqp_getting_started.py
│ ├── example_dense_qp_getting_started.py
│ ├── example_qcqp_getting_started.py
│ ├── example_qp_getting_started.py
│ ├── example_qp_getting_started_sens.py
│ ├── example_qp_getting_started_soft_constr.py
│ ├── example_qp_slacks_as_controls.py
│ ├── qcqp_data.c
│ ├── slacks_as_controls.py
│ └── tmp.py
└── simulink
│ ├── .gitignore
│ ├── Makefile
│ ├── README.md
│ ├── env.sh
│ ├── hpipm_simulink_getting_started.slx
│ ├── load_parameters.m
│ ├── make_sfun.m
│ └── qp_data.c
├── experimental
└── andrea
│ ├── casadi_vde_interface
│ ├── Makefile
│ ├── jac_model.c
│ ├── main.c
│ ├── model.c
│ ├── model.h
│ ├── model.m
│ ├── ode_model.c
│ ├── vde_adj_model.c
│ ├── vde_forw_model.c
│ └── vde_hess_model.c
│ ├── interfaces
│ └── julia
│ │ ├── hpipm_data.jl
│ │ ├── hpipm_dims.jl
│ │ ├── hpipm_julia.jl
│ │ ├── hpipm_solver.jl
│ │ ├── ju2py_obj.jl
│ │ └── py2ju_obj.jl
│ ├── interfaces_examples
│ └── julia
│ │ ├── README.md
│ │ ├── getting_started.jl
│ │ └── test_old.jl
│ ├── notes
│ ├── notes.auxlock
│ ├── notes.bbl
│ ├── notes.blg
│ ├── notes.pdf
│ ├── notes.tex
│ ├── syscop.bib
│ └── todo.txt
│ └── prototype
│ └── code
│ ├── benchmark.mat
│ ├── main.m
│ ├── mainCUTEr.m
│ ├── mainCUTEr_LIFT.m
│ ├── matlab.mat
│ └── plotregion
│ ├── example1.m
│ ├── example2.m
│ ├── example3.m
│ ├── example4.m
│ ├── example5.m
│ ├── example6.m
│ ├── example7.m
│ ├── license.txt
│ ├── plotregion.m
│ └── plotregion.png
├── include
├── hpipm_aux_mem.h
├── hpipm_aux_string.h
├── hpipm_common.h
├── hpipm_d_cast_qcqp.h
├── hpipm_d_cond.h
├── hpipm_d_cond_aux.h
├── hpipm_d_cond_qcqp.h
├── hpipm_d_core_qp_ipm.h
├── hpipm_d_core_qp_ipm_aux.h
├── hpipm_d_dense_qcqp.h
├── hpipm_d_dense_qcqp_dim.h
├── hpipm_d_dense_qcqp_ipm.h
├── hpipm_d_dense_qcqp_res.h
├── hpipm_d_dense_qcqp_sol.h
├── hpipm_d_dense_qcqp_utils.h
├── hpipm_d_dense_qp.h
├── hpipm_d_dense_qp_dim.h
├── hpipm_d_dense_qp_ipm.h
├── hpipm_d_dense_qp_kkt.h
├── hpipm_d_dense_qp_res.h
├── hpipm_d_dense_qp_seed.h
├── hpipm_d_dense_qp_sol.h
├── hpipm_d_dense_qp_utils.h
├── hpipm_d_ocp_qcqp.h
├── hpipm_d_ocp_qcqp_dim.h
├── hpipm_d_ocp_qcqp_ipm.h
├── hpipm_d_ocp_qcqp_red.h
├── hpipm_d_ocp_qcqp_res.h
├── hpipm_d_ocp_qcqp_sol.h
├── hpipm_d_ocp_qcqp_utils.h
├── hpipm_d_ocp_qp.h
├── hpipm_d_ocp_qp_dim.h
├── hpipm_d_ocp_qp_ipm.h
├── hpipm_d_ocp_qp_kkt.h
├── hpipm_d_ocp_qp_red.h
├── hpipm_d_ocp_qp_res.h
├── hpipm_d_ocp_qp_seed.h
├── hpipm_d_ocp_qp_sol.h
├── hpipm_d_ocp_qp_solver.h
├── hpipm_d_ocp_qp_utils.h
├── hpipm_d_part_cond.h
├── hpipm_d_part_cond_qcqp.h
├── hpipm_d_sim_erk.h
├── hpipm_d_sim_rk.h
├── hpipm_d_tree_ocp_qcqp.h
├── hpipm_d_tree_ocp_qcqp_dim.h
├── hpipm_d_tree_ocp_qcqp_ipm.h
├── hpipm_d_tree_ocp_qcqp_res.h
├── hpipm_d_tree_ocp_qcqp_sol.h
├── hpipm_d_tree_ocp_qcqp_utils.h
├── hpipm_d_tree_ocp_qp.h
├── hpipm_d_tree_ocp_qp_dim.h
├── hpipm_d_tree_ocp_qp_ipm.h
├── hpipm_d_tree_ocp_qp_kkt.h
├── hpipm_d_tree_ocp_qp_res.h
├── hpipm_d_tree_ocp_qp_sol.h
├── hpipm_d_tree_ocp_qp_utils.h
├── hpipm_m_dense_qp.h
├── hpipm_m_dense_qp_dim.h
├── hpipm_m_ocp_qp.h
├── hpipm_m_ocp_qp_ipm_hard.h
├── hpipm_m_ocp_qp_kkt.h
├── hpipm_s_cast_qcqp.h
├── hpipm_s_cond.h
├── hpipm_s_cond_aux.h
├── hpipm_s_cond_qcqp.h
├── hpipm_s_core_qp_ipm.h
├── hpipm_s_core_qp_ipm_aux.h
├── hpipm_s_dense_qcqp.h
├── hpipm_s_dense_qcqp_dim.h
├── hpipm_s_dense_qcqp_ipm.h
├── hpipm_s_dense_qcqp_res.h
├── hpipm_s_dense_qcqp_sol.h
├── hpipm_s_dense_qcqp_utils.h
├── hpipm_s_dense_qp.h
├── hpipm_s_dense_qp_dim.h
├── hpipm_s_dense_qp_ipm.h
├── hpipm_s_dense_qp_kkt.h
├── hpipm_s_dense_qp_res.h
├── hpipm_s_dense_qp_seed.h
├── hpipm_s_dense_qp_sol.h
├── hpipm_s_dense_qp_utils.h
├── hpipm_s_ocp_qcqp.h
├── hpipm_s_ocp_qcqp_dim.h
├── hpipm_s_ocp_qcqp_ipm.h
├── hpipm_s_ocp_qcqp_red.h
├── hpipm_s_ocp_qcqp_res.h
├── hpipm_s_ocp_qcqp_sol.h
├── hpipm_s_ocp_qcqp_utils.h
├── hpipm_s_ocp_qp.h
├── hpipm_s_ocp_qp_dim.h
├── hpipm_s_ocp_qp_ipm.h
├── hpipm_s_ocp_qp_kkt.h
├── hpipm_s_ocp_qp_red.h
├── hpipm_s_ocp_qp_res.h
├── hpipm_s_ocp_qp_seed.h
├── hpipm_s_ocp_qp_sol.h
├── hpipm_s_ocp_qp_utils.h
├── hpipm_s_part_cond.h
├── hpipm_s_part_cond_qcqp.h
├── hpipm_s_sim_erk.h
├── hpipm_s_sim_rk.h
├── hpipm_s_tree_ocp_qcqp.h
├── hpipm_s_tree_ocp_qcqp_dim.h
├── hpipm_s_tree_ocp_qcqp_ipm.h
├── hpipm_s_tree_ocp_qcqp_res.h
├── hpipm_s_tree_ocp_qcqp_sol.h
├── hpipm_s_tree_ocp_qcqp_utils.h
├── hpipm_s_tree_ocp_qp.h
├── hpipm_s_tree_ocp_qp_dim.h
├── hpipm_s_tree_ocp_qp_ipm.h
├── hpipm_s_tree_ocp_qp_kkt.h
├── hpipm_s_tree_ocp_qp_res.h
├── hpipm_s_tree_ocp_qp_sol.h
├── hpipm_s_tree_ocp_qp_utils.h
├── hpipm_scenario_tree.h
├── hpipm_timing.h
└── hpipm_tree.h
├── interfaces
├── archive
│ ├── matlab
│ │ └── hpipm_matlab
│ │ │ ├── +hpipm_matlab
│ │ │ ├── archive
│ │ │ │ ├── hpipm_data.m
│ │ │ │ ├── hpipm_dims.m
│ │ │ │ ├── hpipm_solver.m
│ │ │ │ ├── m2py_cell.m
│ │ │ │ ├── m2py_obj.m
│ │ │ │ └── py2m_obj.m
│ │ │ ├── hpipm_ocp_qp.m
│ │ │ ├── hpipm_ocp_qp_dim.m
│ │ │ ├── hpipm_ocp_qp_sol.m
│ │ │ ├── hpipm_ocp_qp_solver.m
│ │ │ ├── hpipm_ocp_qp_solver_arg.m
│ │ │ ├── isOctave.m
│ │ │ ├── m2py.m
│ │ │ └── py2m.m
│ │ │ └── octave_import.m
│ └── octave
│ │ ├── HPIPM_d_solve_ipm2_hard_ocp_qp.c
│ │ ├── How_to_install_Octave.txt
│ │ ├── Makefile
│ │ ├── codegen_ocp_qp_data.m
│ │ ├── create_ocp_qp.m
│ │ ├── create_ocp_qp_dims.m
│ │ ├── is_octave.m
│ │ ├── test_codgen_ocp_qp_data.m
│ │ └── test_ipm_hard_ocp_qp.m
├── c
│ ├── Makefile
│ ├── d_ocp_qp_solver.c
│ └── x_ocp_qp_solver.c
├── matlab_octave
│ ├── Makefile
│ ├── cflags_octave.txt
│ ├── compile_mex_all.m
│ ├── compile_mex_one.m
│ ├── compile_mex_one_from_script.m
│ ├── dense_qcqp_create.c
│ ├── dense_qcqp_destroy.c
│ ├── dense_qcqp_dim_codegen.c
│ ├── dense_qcqp_dim_create.c
│ ├── dense_qcqp_dim_destroy.c
│ ├── dense_qcqp_dim_get.c
│ ├── dense_qcqp_dim_print.c
│ ├── dense_qcqp_dim_set.c
│ ├── dense_qcqp_get.c
│ ├── dense_qcqp_print.c
│ ├── dense_qcqp_set.c
│ ├── dense_qcqp_sol_create.c
│ ├── dense_qcqp_sol_destroy.c
│ ├── dense_qcqp_sol_get.c
│ ├── dense_qcqp_sol_print.c
│ ├── dense_qcqp_solver_arg_create.c
│ ├── dense_qcqp_solver_arg_destroy.c
│ ├── dense_qcqp_solver_arg_set.c
│ ├── dense_qcqp_solver_create.c
│ ├── dense_qcqp_solver_destroy.c
│ ├── dense_qcqp_solver_get.c
│ ├── dense_qcqp_solver_solve.c
│ ├── dense_qp_create.c
│ ├── dense_qp_destroy.c
│ ├── dense_qp_dim_codegen.c
│ ├── dense_qp_dim_create.c
│ ├── dense_qp_dim_destroy.c
│ ├── dense_qp_dim_get.c
│ ├── dense_qp_dim_print.c
│ ├── dense_qp_dim_set.c
│ ├── dense_qp_get.c
│ ├── dense_qp_print.c
│ ├── dense_qp_set.c
│ ├── dense_qp_sol_create.c
│ ├── dense_qp_sol_destroy.c
│ ├── dense_qp_sol_get.c
│ ├── dense_qp_sol_print.c
│ ├── dense_qp_solver_arg_create.c
│ ├── dense_qp_solver_arg_destroy.c
│ ├── dense_qp_solver_arg_set.c
│ ├── dense_qp_solver_create.c
│ ├── dense_qp_solver_destroy.c
│ ├── dense_qp_solver_get.c
│ ├── dense_qp_solver_solve.c
│ ├── env.m
│ ├── env.sh
│ ├── hpipm_dense_qcqp.m
│ ├── hpipm_dense_qcqp_dim.m
│ ├── hpipm_dense_qcqp_sol.m
│ ├── hpipm_dense_qcqp_solver.m
│ ├── hpipm_dense_qcqp_solver_arg.m
│ ├── hpipm_dense_qp.m
│ ├── hpipm_dense_qp_dim.m
│ ├── hpipm_dense_qp_sol.m
│ ├── hpipm_dense_qp_solver.m
│ ├── hpipm_dense_qp_solver_arg.m
│ ├── hpipm_ocp_qcqp.m
│ ├── hpipm_ocp_qcqp_dim.m
│ ├── hpipm_ocp_qcqp_sol.m
│ ├── hpipm_ocp_qcqp_solver.m
│ ├── hpipm_ocp_qcqp_solver_arg.m
│ ├── hpipm_ocp_qp.m
│ ├── hpipm_ocp_qp_dim.m
│ ├── hpipm_ocp_qp_sol.m
│ ├── hpipm_ocp_qp_solver.m
│ ├── hpipm_ocp_qp_solver_arg.m
│ ├── is_octave.m
│ ├── ocp_qcqp_codegen.c
│ ├── ocp_qcqp_create.c
│ ├── ocp_qcqp_destroy.c
│ ├── ocp_qcqp_dim_codegen.c
│ ├── ocp_qcqp_dim_create.c
│ ├── ocp_qcqp_dim_destroy.c
│ ├── ocp_qcqp_dim_get.c
│ ├── ocp_qcqp_dim_load.c
│ ├── ocp_qcqp_dim_print.c
│ ├── ocp_qcqp_dim_set.c
│ ├── ocp_qcqp_get.c
│ ├── ocp_qcqp_load.c
│ ├── ocp_qcqp_print.c
│ ├── ocp_qcqp_set.c
│ ├── ocp_qcqp_sol_create.c
│ ├── ocp_qcqp_sol_destroy.c
│ ├── ocp_qcqp_sol_get.c
│ ├── ocp_qcqp_sol_print.c
│ ├── ocp_qcqp_sol_set.c
│ ├── ocp_qcqp_solver_arg_codegen.c
│ ├── ocp_qcqp_solver_arg_create.c
│ ├── ocp_qcqp_solver_arg_destroy.c
│ ├── ocp_qcqp_solver_arg_load.c
│ ├── ocp_qcqp_solver_arg_set.c
│ ├── ocp_qcqp_solver_create.c
│ ├── ocp_qcqp_solver_destroy.c
│ ├── ocp_qcqp_solver_get.c
│ ├── ocp_qcqp_solver_solve.c
│ ├── ocp_qp_codegen.c
│ ├── ocp_qp_create.c
│ ├── ocp_qp_destroy.c
│ ├── ocp_qp_dim_codegen.c
│ ├── ocp_qp_dim_create.c
│ ├── ocp_qp_dim_destroy.c
│ ├── ocp_qp_dim_get.c
│ ├── ocp_qp_dim_load.c
│ ├── ocp_qp_dim_print.c
│ ├── ocp_qp_dim_set.c
│ ├── ocp_qp_get.c
│ ├── ocp_qp_load.c
│ ├── ocp_qp_print.c
│ ├── ocp_qp_set.c
│ ├── ocp_qp_sol_create.c
│ ├── ocp_qp_sol_destroy.c
│ ├── ocp_qp_sol_get.c
│ ├── ocp_qp_sol_print.c
│ ├── ocp_qp_sol_set.c
│ ├── ocp_qp_solver_arg_codegen.c
│ ├── ocp_qp_solver_arg_create.c
│ ├── ocp_qp_solver_arg_destroy.c
│ ├── ocp_qp_solver_arg_load.c
│ ├── ocp_qp_solver_arg_set.c
│ ├── ocp_qp_solver_create.c
│ ├── ocp_qp_solver_destroy.c
│ ├── ocp_qp_solver_get.c
│ ├── ocp_qp_solver_get_ric.c
│ ├── ocp_qp_solver_solve.c
│ └── set_cflags_octave.m
├── python
│ ├── Makefile
│ └── hpipm_python
│ │ ├── hpipm_python
│ │ ├── __init__.py
│ │ ├── common.py
│ │ └── wrapper
│ │ │ ├── __init__.py
│ │ │ ├── hpipm_dense_qcqp.py
│ │ │ ├── hpipm_dense_qcqp_dim.py
│ │ │ ├── hpipm_dense_qcqp_sol.py
│ │ │ ├── hpipm_dense_qcqp_solver.py
│ │ │ ├── hpipm_dense_qcqp_solver_arg.py
│ │ │ ├── hpipm_dense_qp.py
│ │ │ ├── hpipm_dense_qp_dim.py
│ │ │ ├── hpipm_dense_qp_sol.py
│ │ │ ├── hpipm_dense_qp_solver.py
│ │ │ ├── hpipm_dense_qp_solver_arg.py
│ │ │ ├── hpipm_ocp_qcqp.py
│ │ │ ├── hpipm_ocp_qcqp_dim.py
│ │ │ ├── hpipm_ocp_qcqp_sol.py
│ │ │ ├── hpipm_ocp_qcqp_solver.py
│ │ │ ├── hpipm_ocp_qcqp_solver_arg.py
│ │ │ ├── hpipm_ocp_qp.py
│ │ │ ├── hpipm_ocp_qp_dim.py
│ │ │ ├── hpipm_ocp_qp_seed.py
│ │ │ ├── hpipm_ocp_qp_sol.py
│ │ │ ├── hpipm_ocp_qp_solver.py
│ │ │ ├── hpipm_ocp_qp_solver2.py
│ │ │ ├── hpipm_ocp_qp_solver_arg.py
│ │ │ └── hpipm_ocp_qp_solver_arg2.py
│ │ └── setup.py
└── simulink
│ ├── README.md
│ └── hpipm_sfun.c
├── ipm_core
├── Makefile
├── d_core_qp_ipm.c
├── d_core_qp_ipm_aux.c
├── d_core_qp_ipm_aux_avx.c
├── d_core_qp_ipm_aux_avx512.c
├── s_core_qp_ipm.c
├── s_core_qp_ipm_aux.c
├── s_core_qp_ipm_aux_avx.c
├── s_core_qp_ipm_aux_avx512.c
├── x_core_qp_ipm.c
└── x_core_qp_ipm_aux.c
├── lib
└── dummy.txt
├── ocp_qp
├── Makefile
├── d_ocp_qcqp.c
├── d_ocp_qcqp_dim.c
├── d_ocp_qcqp_ipm.c
├── d_ocp_qcqp_red.c
├── d_ocp_qcqp_res.c
├── d_ocp_qcqp_sol.c
├── d_ocp_qcqp_utils.c
├── d_ocp_qp.c
├── d_ocp_qp_dim.c
├── d_ocp_qp_ipm.c
├── d_ocp_qp_kkt.c
├── d_ocp_qp_red.c
├── d_ocp_qp_res.c
├── d_ocp_qp_seed.c
├── d_ocp_qp_sol.c
├── d_ocp_qp_utils.c
├── m_ocp_qp.c
├── m_ocp_qp_ipm_hard.c
├── m_ocp_qp_kkt.c
├── s_ocp_qcqp.c
├── s_ocp_qcqp_dim.c
├── s_ocp_qcqp_ipm.c
├── s_ocp_qcqp_red.c
├── s_ocp_qcqp_res.c
├── s_ocp_qcqp_sol.c
├── s_ocp_qcqp_utils.c
├── s_ocp_qp.c
├── s_ocp_qp_dim.c
├── s_ocp_qp_ipm.c
├── s_ocp_qp_kkt.c
├── s_ocp_qp_red.c
├── s_ocp_qp_res.c
├── s_ocp_qp_seed.c
├── s_ocp_qp_sol.c
├── s_ocp_qp_utils.c
├── x_ocp_qcqp.c
├── x_ocp_qcqp_dim.c
├── x_ocp_qcqp_ipm.c
├── x_ocp_qcqp_red.c
├── x_ocp_qcqp_res.c
├── x_ocp_qcqp_sol.c
├── x_ocp_qcqp_utils.c
├── x_ocp_qp.c
├── x_ocp_qp_dim.c
├── x_ocp_qp_ipm.c
├── x_ocp_qp_kkt.c
├── x_ocp_qp_red.c
├── x_ocp_qp_res.c
├── x_ocp_qp_seed.c
├── x_ocp_qp_sol.c
└── x_ocp_qp_utils.c
├── sim_core
├── Makefile
├── d_sim_erk.c
├── d_sim_rk.c
├── s_sim_erk.c
├── s_sim_rk.c
├── x_sim_erk.c
└── x_sim_rk.c
├── test_problems
├── CMakeLists.txt
├── Makefile
├── d_tools.c
├── d_tools.h
├── s_tools.c
├── s_tools.h
├── test_d_cast_qcqp.c
├── test_d_cond.c
├── test_d_cond_qcqp.c
├── test_d_dense.c
├── test_d_dense_qcqp.c
├── test_d_ocp.c
├── test_d_ocp2.c
├── test_d_ocp_phase_I.c
├── test_d_ocp_qcqp.c
├── test_d_part_cond.c
├── test_d_part_cond_qcqp.c
├── test_d_sim.c
├── test_d_tree_ocp.c
├── test_d_tree_ocp_qcqp.c
├── test_m_ocp.c
├── test_s_dense.c
├── test_s_ocp.c
└── test_s_tree_ocp.c
├── tree_ocp_qp
├── Makefile
├── d_tree_ocp_qcqp.c
├── d_tree_ocp_qcqp_dim.c
├── d_tree_ocp_qcqp_ipm.c
├── d_tree_ocp_qcqp_res.c
├── d_tree_ocp_qcqp_sol.c
├── d_tree_ocp_qcqp_utils.c
├── d_tree_ocp_qp.c
├── d_tree_ocp_qp_dim.c
├── d_tree_ocp_qp_ipm.c
├── d_tree_ocp_qp_kkt.c
├── d_tree_ocp_qp_res.c
├── d_tree_ocp_qp_sol.c
├── d_tree_ocp_qp_utils.c
├── s_tree_ocp_qcqp.c
├── s_tree_ocp_qcqp_dim.c
├── s_tree_ocp_qcqp_ipm.c
├── s_tree_ocp_qcqp_res.c
├── s_tree_ocp_qcqp_sol.c
├── s_tree_ocp_qcqp_utils.c
├── s_tree_ocp_qp.c
├── s_tree_ocp_qp_dim.c
├── s_tree_ocp_qp_ipm.c
├── s_tree_ocp_qp_kkt.c
├── s_tree_ocp_qp_res.c
├── s_tree_ocp_qp_sol.c
├── s_tree_ocp_qp_utils.c
├── scenario_tree.c
├── x_tree_ocp_qcqp.c
├── x_tree_ocp_qcqp_dim.c
├── x_tree_ocp_qcqp_ipm.c
├── x_tree_ocp_qcqp_res.c
├── x_tree_ocp_qcqp_sol.c
├── x_tree_ocp_qcqp_utils.c
├── x_tree_ocp_qp.c
├── x_tree_ocp_qp_dim.c
├── x_tree_ocp_qp_ipm.c
├── x_tree_ocp_qp_kkt.c
├── x_tree_ocp_qp_res.c
├── x_tree_ocp_qp_sol.c
└── x_tree_ocp_qp_utils.c
├── utils
├── change_lic.sh
├── new_lic_c
├── new_lic_makefile
├── new_lic_matlab
└── new_lic_python
└── version.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | *.out
3 | *.s
4 | libhpipm.a
5 | libhpipm.so
6 | hpipm_target.h
7 | *.swp
8 | *.swo
9 | *.mex
10 | *.mexa64
11 | *.eps
12 | build/
13 | octave-workspace
14 | *.aux
15 | *.bbl
16 | *.blg
17 | *.toc
18 | *.log
19 | *.synctex.gz
20 | .vscode
21 |
22 | change_name.sh
23 |
24 | __pycache__
25 | *egg-info
26 |
--------------------------------------------------------------------------------
/Changelog.txt:
--------------------------------------------------------------------------------
1 | HPIPM ChangeLog
2 |
3 |
4 |
5 | ====================================================================
6 | Version 0.1.4-master
7 | 3-Sep-2020
8 |
9 | dense_qp:
10 | * update some setters/getters
11 | * add t_lam_min flag to control min value of t and lam
12 |
13 | dense_qcqp:
14 | * add t_lam_min flag to control min value of t and lam
15 |
16 | ocp_qp:
17 | * add reduce/restore eq DOF for LHS/RHS alone
18 | * add t_lam_min flag to control min value of t and lam
19 |
20 | ocp_qcqp:
21 | * add t_lam_min flag to control min value of t and lam
22 |
23 | cond_qp:
24 | * add condensing of LHS
25 |
26 | part_cond_qp:
27 | * add condensing of LHS
28 |
29 | cond_qcqp:
30 | * add condensing of LHS
31 |
32 | part_cond_qcqp:
33 | * add condensing of LHS
34 |
35 | tree_ocp_qp:
36 | * update to nearly all features of ocp qp
37 |
38 | tree_ocp_qcqp:
39 | * add tree ocp qcqp solver
40 |
41 | Matlab/Octave interface:
42 | * add basic interface for dense QP
43 |
44 | ====================================================================
45 | Version 0.1.3
46 | 13-Aug-2020
47 |
48 | cond_qp:
49 | * add classic condensing algorithm (with diag hess flag) & optinos to select the cond alg
50 |
51 | sim:
52 | * resume basic ERK integrator with forward sensitivities capabilities
53 |
54 | ====================================================================
55 | Version 0.1.2
56 | 07-Apr-2020
57 |
58 | dense_qp:
59 | * add mask to disregard constraints (e.g. for one sided constr, or dynamic constr removal)
60 | * replace idxs with idxs_rev
61 |
62 | dense_qcqp:
63 | * add dense qcqp ipm solver built on top of dense qp ipm solver
64 | * replace idxs with idxs_rev
65 |
66 | ocp_qp:
67 | * add mask to disregard constraints (e.g. for one sided constr, or dynamic constr removal)
68 | * replace idxs with idxs_rev
69 | * add routines to reduce/restore equality-constrained degrees-of-freedom
70 | * add routines to get riccati matrices (e.g. control gains / feedback matrix K)
71 |
72 | ocp_qcqp:
73 | * add ocp qcqp ipm solver built on top of ocp qp ipm solver
74 | * replace idxs with idxs_rev
75 |
76 | cond_qcqp:
77 | * add condensing for qcqp
78 |
79 | part_cond_qcqp:
80 | * add partial condensing for qcqp
81 |
82 | Matlab/Octave interface:
83 | * add option to build QP data and args reading from codegen data files
84 | * add ocp qcqp interface with same functionality as the ocp qp one
85 |
86 | simulink interface:
87 | * add a simulink interface based on a basic s-function
88 |
89 | ====================================================================
90 | Version 0.1.1
91 | 01-Oct-2019
92 |
93 | common:
94 | * change license to BSD-2
95 |
96 | dense_qp:
97 | * general renaming of routines, e.g. d_create_dense_qp_dim => d_dense_qp_dim_create
98 | * add functionality to compute predicted solution for a new RHS and sensitivity of solution
99 |
100 | ocp_qp:
101 | * general renaming of routines, e.g. d_create_ocp_qp_dim => d_ocp_qp_dim_create
102 | * add codegen functionality to export dims, qp and ipm_args as global variables in a C source file
103 | * add functionality to compute predicted solution for a new RHS and sensitivity of solution
104 |
105 | cond_qp:
106 | * general renaming of routines, e.g. d_create_cond_ocp2ocp => d_part_cond_qp_ws_create
107 |
108 | Matlab/Octave interface:
109 | * reimplement an unified Matlab & Octave interface based on mex (and independent of the python interface)
110 | * allow for codegen of dims, qp and ipm_args from Matlab/Octave
111 |
112 | python interface:
113 | * allow for codegen of dims, qp and ipm_args from python
114 |
115 | ====================================================================
116 | Version 0.1.0
117 | 04-Jul-2019
118 |
119 | common:
120 | * initial release
121 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | HPIPM -- High-Performance Interior Point Method.
2 | Copyright (C) 2019 by Gianluca Frison.
3 | Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl.
4 | All rights reserved.
5 |
6 | The 2-Clause BSD License
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | 1. Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 | 2. Redistributions in binary form must reproduce the above copyright notice,
14 | this list of conditions and the following disclaimer in the documentation
15 | and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/TODO.txt:
--------------------------------------------------------------------------------
1 | - on exit to IPM, change sign of upper inequality constraints (the core is one-sided, the interface is two-sided)
2 |
--------------------------------------------------------------------------------
/archive/include/hpipm_d_ocp_nlp_aux.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2017-2018 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * This program is free software: you can redistribute it and/or modify *
11 | * it under the terms of the GNU General Public License as published by *
12 | * the Free Software Foundation, either version 3 of the License, or *
13 | * (at your option) any later version *.
14 | * *
15 | * This program is distributed in the hope that it will be useful, *
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 | * GNU General Public License for more details. *
19 | * *
20 | * You should have received a copy of the GNU General Public License *
21 | * along with this program. If not, see . *
22 | * *
23 | * The authors designate this particular file as subject to the "Classpath" exception *
24 | * as provided by the authors in the LICENSE file that accompained this code. *
25 | * *
26 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
27 | * *
28 | **************************************************************************************************/
29 |
30 |
31 |
32 | #include
33 | #include
34 |
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 |
39 | //
40 | void d_cvt_erk_int_to_ocp_qp(int n, struct d_erk_workspace *erk_ws, struct d_ocp_qp *qp, struct d_ocp_nlp_sol *nlp_sol);
41 | //
42 | void d_cvt_erk_int_to_ocp_qp_rhs(int n, struct d_erk_workspace *erk_ws, struct d_ocp_qp *qp, struct d_ocp_nlp_sol *nlp_sol);
43 |
44 | #ifdef __cplusplus
45 | } /* extern "C" */
46 | #endif
47 |
--------------------------------------------------------------------------------
/archive/ocp_nlp/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High Performance Interior Point Method. #
6 | # Copyright (C) 2017 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # HPMPC is free software; you can redistribute it and/or #
11 | # modify it under the terms of the GNU Lesser General Public #
12 | # License as published by the Free Software Foundation; either #
13 | # version 2.1 of the License, or (at your option) any later version. #
14 | # #
15 | # HPMPC is distributed in the hope that it will be useful, #
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of #
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
18 | # See the GNU Lesser General Public License for more details. #
19 | # #
20 | # You should have received a copy of the GNU Lesser General Public #
21 | # License along with HPMPC; if not, write to the Free Software #
22 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #
23 | # #
24 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
25 | # #
26 | ###################################################################################################
27 |
28 | include ../Makefile.rule
29 |
30 | OBJS =
31 |
32 | ifeq ($(TARGET), GENERIC)
33 | OBJS +=
34 | endif
35 |
36 | #OBJS += d_ocp_nlp.o d_ocp_nlp_sol.o d_ocp_nlp_aux.o d_ocp_nlp_hyb.o d_ocp_nlp_ipm.o d_ocp_nlp_sqp.o
37 | #OBJS +=
38 |
39 | obj: $(OBJS)
40 |
41 | clean:
42 | rm -f *.o
43 | rm -f *.s
44 |
45 | d_ocp_nlp_sol.o: d_ocp_nlp_sol.c x_ocp_nlp_sol.c
46 |
--------------------------------------------------------------------------------
/archive/ocp_nlp/d_ocp_nlp_sol.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2017-2018 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * This program is free software: you can redistribute it and/or modify *
11 | * it under the terms of the GNU General Public License as published by *
12 | * the Free Software Foundation, either version 3 of the License, or *
13 | * (at your option) any later version *.
14 | * *
15 | * This program is distributed in the hope that it will be useful, *
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 | * GNU General Public License for more details. *
19 | * *
20 | * You should have received a copy of the GNU General Public License *
21 | * along with this program. If not, see . *
22 | * *
23 | * The authors designate this particular file as subject to the "Classpath" exception *
24 | * as provided by the authors in the LICENSE file that accompained this code. *
25 | * *
26 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
27 | * *
28 | **************************************************************************************************/
29 |
30 |
31 |
32 | #if defined(RUNTIME_CHECKS)
33 | #include
34 | #include
35 | #endif
36 |
37 | #include
38 | #include
39 | #include
40 |
41 | #include "../include/hpipm_d_ocp_nlp.h"
42 | #include "../include/hpipm_d_ocp_nlp_sol.h"
43 |
44 |
45 |
46 | #define CREATE_STRVEC blasfeo_create_dvec
47 | #define CVT_STRVEC2VEC blasfeo_unpack_dvec
48 | #define OCP_NLP d_ocp_nlp
49 | #define OCP_NLP_SOL d_ocp_nlp_sol
50 | #define REAL double
51 | #define STRVEC blasfeo_dvec
52 | #define SIZE_STRVEC blasfeo_memsize_dvec
53 | #define VECCP_LIBSTR blasfeo_dveccp
54 |
55 | #define CREATE_OCP_NLP_SOL d_create_ocp_nlp_sol
56 | #define MEMSIZE_OCP_NLP_SOL d_memsize_ocp_nlp_sol
57 | #define CVT_OCP_NLP_SOL_TO_COLMAJ d_cvt_ocp_nlp_sol_to_colmaj
58 | #define CVT_OCP_NLP_SOL_TO_ROWMAJ d_cvt_ocp_nlp_sol_to_rowmaj
59 | #define CVT_OCP_NLP_SOL_TO_LIBSTR d_cvt_ocp_nlp_sol_to_libstr
60 |
61 |
62 |
63 | #include "x_ocp_nlp_sol.c"
64 |
--------------------------------------------------------------------------------
/archive/ocp_nlp/s_ocp_nlp_sol.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2017-2018 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * This program is free software: you can redistribute it and/or modify *
11 | * it under the terms of the GNU General Public License as published by *
12 | * the Free Software Foundation, either version 3 of the License, or *
13 | * (at your option) any later version *.
14 | * *
15 | * This program is distributed in the hope that it will be useful, *
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 | * GNU General Public License for more details. *
19 | * *
20 | * You should have received a copy of the GNU General Public License *
21 | * along with this program. If not, see . *
22 | * *
23 | * The authors designate this particular file as subject to the "Classpath" exception *
24 | * as provided by the authors in the LICENSE file that accompained this code. *
25 | * *
26 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
27 | * *
28 | **************************************************************************************************/
29 |
30 |
31 |
32 | #if defined(RUNTIME_CHECKS)
33 | #include
34 | #include
35 | #endif
36 |
37 | #include
38 | #include
39 | #include
40 |
41 | #include "../include/hpipm_s_ocp_nlph"
42 | #include "../include/hpipm_s_ocp_nlpsol.h"
43 |
44 |
45 |
46 | #define CREATE_STRVEC blasfeo_create_svec
47 | #define CVT_STRVEC2VEC blasfeo_unpack_svec
48 | #define OCP_NLP s_ocp_nlp
49 | #define OCP_NLP_SOL s_ocp_nlpsol
50 | #define REAL float
51 | #define STRVEC blasfeo_svec
52 | #define SIZE_STRVEC blasfeo_memsize_svec
53 | #define VECCP_LIBSTR blasfeo_sveccp
54 |
55 | #define CREATE_OCP_NLP_SOL s_create_ocp_nlpsol
56 | #define MEMSIZE_OCP_NLP_SOL s_memsize_ocp_nlpsol
57 | #define CVT_OCP_NLP_SOL_TO_COLMAJ s_cvt_ocp_nlpsol_to_colmaj
58 | #define CVT_OCP_NLP_SOL_TO_ROWMAJ s_cvt_ocp_nlpsol_to_rowmaj
59 | #define CVT_OCP_NLP_SOL_TO_LIBSTR s_cvt_ocp_nlpsol_to_libstr
60 |
61 |
62 |
63 | #include "x_ocp_nlpsol.c"
64 |
65 |
--------------------------------------------------------------------------------
/archive/sqp/d_gn_sqp.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2017-2018 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * This program is free software: you can redistribute it and/or modify *
11 | * it under the terms of the GNU General Public License as published by *
12 | * the Free Software Foundation, either version 3 of the License, or *
13 | * (at your option) any later version *.
14 | * *
15 | * This program is distributed in the hope that it will be useful, *
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 | * GNU General Public License for more details. *
19 | * *
20 | * You should have received a copy of the GNU General Public License *
21 | * along with this program. If not, see . *
22 | * *
23 | * The authors designate this particular file as subject to the "Classpath" exception *
24 | * as provided by the authors in the LICENSE file that accompained this code. *
25 | * *
26 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
27 | * *
28 | **************************************************************************************************/
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/auxiliary/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 |
37 | include ../Makefile.rule
38 |
39 | OBJS =
40 |
41 | ifeq ($(TARGET), GENERIC)
42 | OBJS +=
43 | endif
44 |
45 | OBJS += aux_string.o
46 | OBJS += aux_mem.o
47 | OBJS += timing.o
48 |
49 | obj: $(OBJS)
50 |
51 | clean:
52 | rm -f *.o
53 | rm -f *.s
54 |
55 | #aux_string.o: aux_string.c
56 |
--------------------------------------------------------------------------------
/auxiliary/aux_string.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 | int hpipm_strcmp(char *str1, char *str2)
37 | {
38 | int i = 0;
39 | while(str1[i] == str2[i] & str1[i] != '\0')
40 | i++;
41 | if((str1[i] > str2[i]) | (str1[i] < str2[i]))
42 | return 0;
43 | else
44 | return 1;
45 | }
46 |
--------------------------------------------------------------------------------
/auxiliary/timing.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 | #include "../include/hpipm_timing.h"
37 |
38 | void hpipm_tic(hpipm_timer *t)
39 | {
40 | blasfeo_tic(t);
41 | return;
42 | }
43 |
44 |
45 |
46 | double hpipm_toc(hpipm_timer *t)
47 | {
48 | return blasfeo_toc(t);
49 | }
50 |
--------------------------------------------------------------------------------
/benchmark/.gitignore:
--------------------------------------------------------------------------------
1 | problems/
2 | oqp/
3 | projects.coin-or.org/
4 | test
5 |
--------------------------------------------------------------------------------
/benchmark/fetch_cpp_data:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##
4 | ## This file is part of qpOASES.
5 | ##
6 | ## qpOASES -- An Implementation of the Online Active Set Strategy.
7 | ## Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
8 | ## Christian Kirches et al. All rights reserved.
9 | ##
10 | ## qpOASES is free software; you can redistribute it and/or
11 | ## modify it under the terms of the GNU Lesser General Public
12 | ## License as published by the Free Software Foundation; either
13 | ## version 2.1 of the License, or (at your option) any later version.
14 | ##
15 | ## qpOASES is distributed in the hope that it will be useful,
16 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 | ## See the GNU Lesser General Public License for more details.
19 | ##
20 | ## You should have received a copy of the GNU Lesser General Public
21 | ## License along with qpOASES; if not, write to the Free Software
22 | ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 | ##
24 |
25 |
26 |
27 | ##
28 | ## Filename: fetch_cpp_data
29 | ## Author: Hans Joachim Ferreau
30 | ## Version: 3.1embedded
31 | ## Date: 2014-2015
32 |
33 |
34 | #svn export https://projects.coin-or.org/svn/qpOASES/misc/testingdata/cpp . --force
35 | wget -r --no-parent https://projects.coin-or.org/svn/qpOASES/misc/testingdata/cpp/problems/
36 |
--------------------------------------------------------------------------------
/dense_qp/m_dense_qp_dim.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 |
37 |
38 | #include
39 | #include
40 |
41 | #include
42 | #include
43 | #include
44 |
45 | #include
46 | #include
47 |
48 |
49 |
50 | void cvt_d2s_dense_qp_dim(struct d_dense_qp_dim *qpd, struct s_dense_qp_dim *qps)
51 | {
52 |
53 | qps->nv = qpd->nv;
54 | qps->ne = qpd->ne;
55 | qps->nb = qpd->nb;
56 | qps->ng = qpd->ng;
57 | qps->ns = qpd->ns;
58 |
59 | return;
60 |
61 | }
62 |
63 |
64 |
--------------------------------------------------------------------------------
/doc/guide.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/giaf/hpipm/c39c453bef3b78361d40af1ac6316c25e6171c33/doc/guide.pdf
--------------------------------------------------------------------------------
/examples/archive/matlab/README.md:
--------------------------------------------------------------------------------
1 | HPIPM examples using the hpipm_matlab package.
2 |
3 | In order to be able to run the examples in this folder, it is necessary to install the shared libraries libblasfeo.so and libhpipm.so.
4 | The required shared libraries can be installed by running
5 | ```
6 | make shared_library -j4 & sudo make install_shared
7 | ```
8 | from the blasfeo and hpipm root folder.
9 | Make sure that the location of libblasfeo.so and libhpipm.so is known to the system by adding /opt/blasfeo/lib and /opt/hpipm/lib to LD_LIBRARY_PATH as
10 | ```
11 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/blasfeo/lib:/opt/hpipm/lib
12 | ```
13 | (notice that, under some OSs, the value environment variable LD_LIBRARY_PATH within MATLAB can be different from the system's value. As a quick workaround, try to start MATLAB from a terminal).
14 |
15 | Finally you will need to make sure that hpipm/interfaces/matlab/hpipm_matlab is in your MATLAB path and that hpipm_python has been installed for the Python version used by MATLAB.
16 | You can check which version is used by running the command
17 | ```
18 | py.sys.path
19 | ```
20 | from the MATLAB command line and change it by running
21 | ```
22 | pyversion
23 | ```
24 |
25 |
--------------------------------------------------------------------------------
/examples/archive/matlab/getting_started.m:
--------------------------------------------------------------------------------
1 | % pyversion /usr/bin/python3
2 | % py.sys.path
3 |
4 | clearvars
5 | close all
6 | clc
7 |
8 | addpath('../../interfaces/matlab/hpipm_matlab')
9 |
10 | import hpipm_matlab.*
11 |
12 |
13 |
14 | % dims
15 | N = 5;
16 |
17 | tic
18 | dims = hpipm_ocp_qp_dim(N);
19 | tmp_time = toc;
20 | fprintf('create dim time %e\n', tmp_time);
21 |
22 | tic
23 | dims.set('nx', [2, 2, 2, 2, 2, 2]);
24 | tmp_time = toc;
25 | fprintf('set nx time %e\n', tmp_time);
26 | dims.set('nu', [1, 1, 1, 1, 1]);
27 | dims.set('nbx', 2, 0);
28 | dims.set('nbx', 2, 5);
29 |
30 | dims.print_C_struct();
31 |
32 |
33 |
34 | % data
35 | A = [1, 1; 0, 1];
36 | B = [0; 1];
37 | %b = [0; 0]
38 |
39 | Q = [1, 1; 0, 1];
40 | S = [0, 0];
41 | R = [1];
42 | q = [1; 1];
43 | %r = [0];
44 |
45 | Jx = [1, 0; 0, 1];
46 | x0 = [1; 1];
47 | Zu = [1e5, 0; 0, 1e5];
48 | zl = [1e5; 1e5];
49 | zu = [1e5; 1e5];
50 |
51 |
52 |
53 | % qp
54 | tic
55 | qp = hpipm_ocp_qp(dims);
56 | tmp_time = toc;
57 | fprintf('create qp time %e\n', tmp_time);
58 |
59 | tic
60 | qp.set('A', {A, A, A, A, A});
61 | tmp_time = toc;
62 | fprintf('create set A time %e\n', tmp_time);
63 | qp.set('B', {B, B, B, B, B});
64 | %qp.set_b({b, b, b, b, b});
65 |
66 | qp.set('Q', {Q, Q, Q, Q, Q, Q});
67 | qp.set('S', {S, S, S, S, S});
68 | qp.set('R', {R, R, R, R, R});
69 | qp.set('q', {q, q, q, q, q, q});
70 | qp.set('q', q, 0);
71 | %qp.set_r({r, r, r, r, r});
72 | qp.set('Jx', Jx, 0);
73 | qp.set('lx', x0, 0);
74 | qp.set('ux', x0, 0);
75 | qp.set('Jx', Jx, 5);
76 |
77 | qp.print_C_struct()
78 |
79 |
80 |
81 | % qp sol
82 | tic
83 | qp_sol = hpipm_ocp_qp_sol(dims);
84 | tmp_time = toc;
85 | fprintf('create qp_sol time %e\n', tmp_time);
86 |
87 |
88 |
89 | % set up solver arg
90 | tic
91 | arg = hpipm_ocp_qp_solver_arg(dims);
92 | tmp_time = toc;
93 | fprintf('create solver arg time %e\n', tmp_time);
94 |
95 | arg.set_mu0(1e4);
96 | arg.set_iter_max(30);
97 | arg.set_tol_stat(1e-4);
98 | arg.set_tol_eq(1e-5);
99 | arg.set_tol_ineq(1e-5);
100 | arg.set_tol_comp(1e-5);
101 | arg.set_reg_prim(1e-12);
102 |
103 |
104 | % set up solver
105 | tic
106 | solver = hpipm_ocp_qp_solver(dims, arg);
107 | tmp_time = toc;
108 | fprintf('create solver time %e\n', tmp_time);
109 |
110 |
111 |
112 | % solve qp
113 | tic
114 | return_flag = solver.solve(qp, qp_sol);
115 | tmp_time = toc;
116 | fprintf('solve time %e\n', tmp_time);
117 |
118 | fprintf('HPIPM returned with flag %d', return_flag);
119 |
120 | if return_flag==0
121 | fprintf('-> QP solved! Solution:\n')
122 | qp_sol.print_C_struct()
123 | else
124 | fprintf('-> Solver failed!')
125 | end
126 |
127 |
128 | % extract and print sol
129 | fprintf('u =\n');
130 | u = qp_sol.get_u();
131 | for i=1:N+1
132 | u{i}
133 | end
134 |
135 | fprintf('x =\n');
136 | for i=0:N
137 | x_tmp = qp_sol.get_x(i);
138 | x_tmp
139 | end
140 |
141 |
142 | % print solver statistics
143 | fprintf('\nsolver statistics:\n\n');
144 | fprintf('ipm return = %d\n\n', return_flag);
145 | res_stat = solver.get_res_stat();
146 | fprintf('ipm max res stat = %e\n\n', res_stat);
147 | res_eq = solver.get_res_eq();
148 | fprintf('ipm max res eq = %e\n\n', res_eq);
149 | res_ineq = solver.get_res_ineq();
150 | fprintf('ipm max res ineq = %e\n\n', res_ineq);
151 | res_comp = solver.get_res_comp();
152 | fprintf('ipm max res comp = %e\n\n', res_comp);
153 | iters = solver.get_iter();
154 | fprintf('ipm iter = %d\n\n', iters);
155 | stat = solver.get_stat();
156 | fprintf('stat =\n');
157 | fprintf('\talpha_aff\tmu_aff\t\tsigma\t\talpha\t\tmu\n');
158 | for ii=1:iters
159 | fprintf('\t%e\t%e\t%e\t%e\t%e\n', stat(ii,1), stat(ii,2), stat(ii,3), stat(ii,4), stat(ii,5));
160 | end
161 | fprintf('\n');
162 |
163 | return
164 |
165 |
--------------------------------------------------------------------------------
/examples/archive/matlab/getting_started_no_matlab_wrapper.m:
--------------------------------------------------------------------------------
1 | % pyversion /usr/bin/python3
2 | % py.sys.path
3 |
4 | % addpath("~/pytave")
5 |
6 | clear all
7 | close all
8 | clc
9 |
10 | % import python modules
11 | np = py.importlib.import_module('numpy');
12 | hp = py.importlib.import_module('hpipm_python');
13 |
14 | % dims
15 | N = 5;
16 |
17 | tic
18 | dims = hp.hpipm_ocp_qp_dim(int32(N));
19 | tmp_time = toc
20 | fprintf('create dim time %e\n', tmp_time);
21 |
22 | tic
23 | dims.set_nx(np.array([2, 2, 2, 2, 2, 2], np.int32));
24 | tmp_time = toc
25 | fprintf('set nx time %e\n', tmp_time);
26 | dims.set_nu(np.array([1, 1, 1, 1, 1], np.int32));
27 | dims.set_nbx(int32(2), int32(0));
28 | dims.set_nbx(int32(2), int32(5));
29 |
30 | dims.print_C_struct()
31 |
32 |
33 | % data
34 | A = np.array([1, 1, 0, 1]);
35 | B = np.array([0, 1]);
36 | %b = np.array([0, 0]);
37 |
38 | Q = np.array([1, 0, 0, 1]);
39 | S = np.array([0, 0]);
40 | R = np.array([1]);
41 | q = np.array([1, 1]);
42 | %r = np.array([0]);
43 |
44 | Jx = np.array([1, 0, 0, 1]);
45 | x0 = np.array([1, 1]);
46 | Jsx = np.array([1, 0, 0, 1]);
47 | Zl = np.array([1e5, 0, 0, 1e5]);
48 | Zu = np.array([1e5, 0, 0, 1e5]);
49 | zl = np.array([1e5, 1e5]);
50 | zu = np.array([1e5, 1e5]);
51 |
52 |
53 | % qp
54 | tic
55 | qp = hp.hpipm_ocp_qp(dims);
56 | tmp_time = toc
57 | fprintf('create qp time %e\n', tmp_time);
58 |
59 | tic
60 | qp.set_A(py.list({A, A, A, A, A}))
61 | tmp_time = toc
62 | fprintf('create set A time %e\n', tmp_time);
63 | qp.set_B(py.list({B, B, B, B, B}))
64 | %qp.set_b(py.list({b, b, b, b, b}))
65 | qp.set_Q(py.list({Q, Q, Q, Q, Q, Q}))
66 | qp.set_S(py.list({S, S, S, S, S}))
67 | qp.set_R(py.list({R, R, R, R, R}))
68 | qp.set_q(py.list({q, q, q, q, q, q}))
69 | %qp.set_r(py.list({r, r, r, r, r}))
70 | qp.set_Jx(Jx, int32(0))
71 | qp.set_lx(x0, int32(0))
72 | qp.set_ux(x0, int32(0))
73 | qp.set_Jx(Jx, int32(5))
74 |
75 | qp.print_C_struct()
76 |
77 |
78 | % qp sol
79 | tic
80 | qp_sol = hp.hpipm_ocp_qp_sol(dims);
81 | tmp_time = toc
82 | fprintf('create qp_sol time %e\n', tmp_time);
83 |
84 |
85 | % set up solver arg
86 | tic
87 | arg = hp.hpipm_ocp_qp_solver_arg(dims);
88 | tmp_time = toc
89 | fprintf('create solver arg time %e\n', tmp_time);
90 |
91 | arg.set_mu0(1e4);
92 | arg.set_iter_max(int32(30));
93 | arg.set_tol_stat(1e-4);
94 | arg.set_tol_eq(1e-5);
95 | arg.set_tol_ineq(1e-5);
96 | arg.set_tol_comp(1e-5);
97 | arg.set_reg_prim(1e-12);
98 |
99 |
100 | % set up solver
101 | tic
102 | solver = hp.hpipm_ocp_qp_solver(dims, arg);
103 | tmp_time = toc
104 | fprintf('create solver time %e\n', tmp_time);
105 |
106 |
107 | % solve qp
108 | tic
109 | return_flag = solver.solve(qp, qp_sol);
110 | tmp_time = toc
111 | fprintf('solve time %e\n', tmp_time);
112 |
113 | %fprintf('HPIPM returned with flag %d\n', return_flag);
114 |
115 | %if return_flag == 0:
116 | % print('-> QP solved! Solution:\n')
117 | qp_sol.print_C_struct()
118 | %else:
119 | % print('-> Solver failed!')
120 |
121 | % extract and print sol
122 | %print('u =')
123 | %u = qp_sol.get_u()
124 | %for i in range(N+1):
125 | % print(u[i])
126 |
127 | %print('x =')
128 | %for i in range(N+1):
129 | % tmp = qp_sol.get_x(i)
130 | % print(tmp)
131 |
132 |
133 |
134 |
135 | return
136 |
137 |
--------------------------------------------------------------------------------
/examples/archive/octave/README.md:
--------------------------------------------------------------------------------
1 | HPIPM examples using the hpipm_matlab package.
2 |
3 | In order to be able to run the examples in this folder from Octave, it is necessary to install the shared libraries libblasfeo.so and libhpipm.so.
4 | The required shared libraries can be installed by running
5 | ```
6 | make shared_library -j4 & sudo make install_shared
7 | ```
8 | from the blasfeo and hpipm root folder.
9 | Make sure that the location of libblasfeo.so and libhpipm.so is known to the system by adding /opt/blasfeo/lib and /opt/hpipm/lib to LD_LIBRARY_PATH as
10 | ```
11 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/blasfeo/lib:/opt/hpipm/lib
12 | ```
13 | To be able to call the Python interpreter from Octave, you will need to install the Pytave package (follow the instructions here https://bitbucket.org/mtmiller/pytave).
14 | During the installation process, before the configuration step you might need to run
15 | ```
16 | export PYTHON_VERSION=
17 | ```
18 | where your python interpreter binaries name reads `python`.
19 |
20 | Finally you will need to make sure that hpipm/interfaces/matlab/hpipm_matlab is in your Octave path and that hpipm_python has been installed for the Python version used by Octave.
21 | You can check which version is used by running the command
22 | ```
23 | py.sys.path
24 | ```
25 | from the Octave command line.
26 |
27 |
28 |
--------------------------------------------------------------------------------
/examples/archive/octave/getting_started.m:
--------------------------------------------------------------------------------
1 | % pyversion /usr/bin/python3
2 | % py.sys.path
3 |
4 | clear all
5 | close all
6 | clc
7 |
8 | addpath('~/pytave') % or change with your pytave main folder path
9 | addpath('../../interfaces/matlab/hpipm_matlab')
10 |
11 | %octave_import hpipm_matlab.*
12 | import hpipm_matlab.*
13 |
14 |
15 |
16 | % dims
17 | N = 5;
18 |
19 | tic
20 | dims = hpipm_ocp_qp_dim(N);
21 | tmp_time = toc;
22 | fprintf('create dim time %e\n', tmp_time);
23 |
24 | tic
25 | dims.set('nx', [2, 2, 2, 2, 2, 2]);
26 | tmp_time = toc;
27 | fprintf('set nx time %e\n', tmp_time);
28 | dims.set('nu', [1, 1, 1, 1, 1]);
29 | dims.set('nbx', 2, 0);
30 | dims.set('nbx', 2, 5);
31 |
32 | dims.print_C_struct();
33 |
34 |
35 |
36 | % data
37 | A = [1, 1; 0, 1];
38 | B = [0; 1];
39 | %b = [0; 0]
40 |
41 | Q = [1, 1; 0, 1];
42 | S = [0, 0];
43 | R = [1];
44 | q = [1; 1];
45 | %r = [0];
46 |
47 | Jx = [1, 0; 0, 1];
48 | x0 = [1; 1];
49 | Jsx = [1, 0; 0, 1];
50 | Zl = [1e5, 0; 0, 1e5];
51 | Zu = [1e5, 0; 0, 1e5];
52 | zl = [1e5; 1e5];
53 | zu = [1e5; 1e5];
54 |
55 |
56 |
57 | % qp
58 | tic
59 | qp = hpipm_ocp_qp(dims);
60 | tmp_time = toc;
61 | fprintf('create qp time %e\n', tmp_time);
62 |
63 | tic
64 | qp.set('A', {A, A, A, A, A});
65 | tmp_time = toc;
66 | fprintf('create set A time %e\n', tmp_time);
67 | qp.set('B', {B, B, B, B, B});
68 | %qp.set('b', {b, b, b, b, b});
69 |
70 | qp.set('Q', {Q, Q, Q, Q, Q, Q});
71 | qp.set('S', {S, S, S, S, S});
72 | qp.set('R', {R, R, R, R, R});
73 | qp.set('q', {q, q, q, q, q, q});
74 | qp.set('q', q, 0);
75 | %qp.set('r', {r, r, r, r, r});
76 | qp.set('Jx', Jx, 0);
77 | qp.set('lx', x0, 0);
78 | qp.set('ux', x0, 0);
79 | qp.set('Jx', Jx, 5);
80 |
81 | qp.print_C_struct()
82 |
83 |
84 |
85 | % qp sol
86 | tic
87 | qp_sol = hpipm_ocp_qp_sol(dims);
88 | tmp_time = toc;
89 | fprintf('create qp_sol time %e\n', tmp_time);
90 |
91 |
92 |
93 | % set up solver arg
94 | tic
95 | arg = hpipm_ocp_qp_solver_arg(dims);
96 | tmp_time = toc;
97 | fprintf('create solver arg time %e\n', tmp_time);
98 |
99 | arg.set_mu0(1e4);
100 | arg.set_iter_max(30);
101 | arg.set_tol_stat(1e-4);
102 | arg.set_tol_eq(1e-5);
103 | arg.set_tol_ineq(1e-5);
104 | arg.set_tol_comp(1e-5);
105 | arg.set_reg_prim(1e-12);
106 |
107 |
108 | % set up solver
109 | tic
110 | solver = hpipm_ocp_qp_solver(dims, arg);
111 | tmp_time = toc;
112 | fprintf('create solver time %e\n', tmp_time);
113 |
114 |
115 |
116 | % solve qp
117 | tic
118 | return_flag = solver.solve(qp, qp_sol);
119 | tmp_time = toc;
120 | fprintf('solve time %e\n', tmp_time);
121 |
122 | fprintf('HPIPM returned with flag %d', return_flag);
123 |
124 | if return_flag==0
125 | fprintf('-> QP solved! Solution:\n')
126 | qp_sol.print_C_struct()
127 | else
128 | fprintf('-> Solver failed!')
129 | end
130 |
131 |
132 | % extract and print sol
133 | fprintf('u =\n');
134 | u = qp_sol.get_u();
135 | for i=1:N+1
136 | u{i}
137 | end
138 |
139 | fprintf('x =\n');
140 | for i=0:N
141 | x_tmp = qp_sol.get_x(i);
142 | x_tmp
143 | end
144 |
145 |
146 | % print solver statistics
147 | fprintf('\nsolver statistics:\n\n');
148 | fprintf('ipm return = %d\n\n', return_flag);
149 | res_stat = solver.get_res_stat();
150 | fprintf('ipm max res stat = %e\n\n', res_stat);
151 | res_eq = solver.get_res_eq();
152 | fprintf('ipm max res eq = %e\n\n', res_eq);
153 | res_ineq = solver.get_res_ineq();
154 | fprintf('ipm max res ineq = %e\n\n', res_ineq);
155 | res_comp = solver.get_res_comp();
156 | fprintf('ipm max res comp = %e\n\n', res_comp);
157 | iters = solver.get_iter();
158 | fprintf('ipm iter = %d\n\n', iters);
159 | stat = solver.get_stat();
160 | fprintf('stat =\n');
161 | fprintf('\talpha_aff\tmu_aff\t\tsigma\t\talpha\t\tmu\n');
162 | for ii=1:iters
163 | fprintf('\t%e\t%e\t%e\t%e\t%e\n', stat(ii,1), stat(ii,2), stat(ii,3), stat(ii,4), stat(ii,5));
164 | end
165 | fprintf('\n');
166 |
167 |
168 |
169 |
170 | return
171 |
172 |
--------------------------------------------------------------------------------
/examples/archive/octave/import.m:
--------------------------------------------------------------------------------
1 | function import(varargin)
2 | % Import a package. Only entire packages can be imported currently.
3 | error(nargchk(1, inf, nargin, 'struct'));
4 | % Import the packages one-by-one
5 | for i=1:nargin
6 | import1(varargin{i});
7 | end
8 | end
9 |
10 | function import1(pkgname)
11 | % Split up name into parts
12 | pkgname_parts = strsplit(pkgname, '.');
13 | % Fallback to system import command if not entire package (i.e. failure)
14 | if length(pkgname_parts)~= 2 || ~strcmp(pkgname_parts{end}, '*')
15 | error('Only the syntax ''import package_name.*'' is currently supported')
16 | end
17 | % Get path for package
18 | pkgpath = locatepkg(pkgname_parts{1});
19 | % Add to path
20 | addpath(pkgpath);
21 | end
22 |
23 | function pkgpath = locatepkg(pkgname)
24 | pathdirs = strsplit(path, pathsep);
25 | for iPath=1:length(pathdirs)
26 | pkgpath = [pathdirs{iPath} filesep '+' pkgname];
27 | if exist(pkgpath, 'dir')
28 | return;
29 | end
30 | end
31 | error('Package ''%s'' cannot be located in the path', pkgname);
32 | end
33 |
--------------------------------------------------------------------------------
/examples/c/data/.gitignore:
--------------------------------------------------------------------------------
1 | ocp_qp_data.c
2 | ocp_qcqp_data.c
3 |
--------------------------------------------------------------------------------
/examples/c/data/getting_started_dense_qp_data.c:
--------------------------------------------------------------------------------
1 | /***************
2 | * dim
3 | ***************/
4 | /* nv */
5 | int nv = 2;
6 | /* ne */
7 | int ne = 1;
8 | /* nb */
9 | int nb = 2;
10 | /* ng */
11 | int ng = 0;
12 | /* nsb */
13 | int nsb = 0;
14 | /* nsg */
15 | int nsg = 0;
16 | /* ns */
17 | int ns = 0;
18 | /***************
19 | * qp
20 | ***************/
21 | /* H */
22 | static double HH[] = {4.000000000000000e+00, 1.000000000000000e+00, 1.000000000000000e+00, 2.000000000000000e+00, };
23 | double *H = HH;
24 | /* A */
25 | static double AA[] = {1.000000000000000e+00, 1.000000000000000e+00, };
26 | double *A = AA;
27 | /* C */
28 | static double CC[] = {};
29 | double *C = CC;
30 | /* idxb */
31 | static int iidxb[] = {0, 1, };
32 | int *idxb = iidxb;
33 | /* g */
34 | static double gg[] = {1.000000000000000e+00, 1.000000000000000e+00, };
35 | double *g = gg;
36 | /* zl */
37 | static double zzl[] = {};
38 | double *zl = zzl;
39 | /* zu */
40 | static double zzu[] = {};
41 | double *zu = zzu;
42 | /* b */
43 | static double bb[] = {1.000000000000000e+00, };
44 | double *b = bb;
45 | /* lb */
46 | static double llb[] = {-1.000000000000000e+00, -1.000000000000000e+00, };
47 | double *lb = llb;
48 | /* lb_mask */
49 | static double llb_mask[] = {1.000000000000000e+00, 1.000000000000000e+00, };
50 | double *lb_mask = llb_mask;
51 | /* ub */
52 | static double uub[] = {1.500000000000000e+00, 5.000000000000000e-01, };
53 | double *ub = uub;
54 | /* ub_mask */
55 | static double uub_mask[] = {1.000000000000000e+00, 1.000000000000000e+00, };
56 | double *ub_mask = uub_mask;
57 | /* lg */
58 | static double llg[] = {};
59 | double *lg = llg;
60 | /* lg_mask */
61 | static double llg_mask[] = {};
62 | double *lg_mask = llg_mask;
63 | /* ug */
64 | static double uug[] = {};
65 | double *ug = uug;
66 | /* ug_mask */
67 | static double uug_mask[] = {};
68 | double *ug_mask = uug_mask;
69 | /* lls */
70 | static double llls[] = {};
71 | double *lls = llls;
72 | /* lls_mask */
73 | static double llls_mask[] = {};
74 | double *lls_mask = llls_mask;
75 | /* lus */
76 | static double llus[] = {};
77 | double *lus = llus;
78 | /* lus_mask */
79 | static double llus_mask[] = {};
80 | double *lus_mask = llus_mask;
81 | /* Zl */
82 | static double ZZl[] = {};
83 | double *Zl = ZZl;
84 | /* Zu */
85 | static double ZZu[] = {};
86 | double *Zu = ZZu;
87 | /* idxs_rev */
88 | static int iidxs_rev[] = {-1, -1, };
89 | int *idxs_rev = iidxs_rev;
90 | /***************
91 | * arg
92 | ***************/
93 | /* mode */
94 | int mode = 1;
95 | /* iter_max */
96 | int iter_max = 20;
97 | /* alpha_min */
98 | double alpha_min = 1.000000000000000e-12;
99 | /* mu0 */
100 | double mu0 = 1.000000000000000e+01;
101 | /* tol_stat */
102 | double tol_stat = 1.000000000000000e-12;
103 | /* tol_eq */
104 | double tol_eq = 1.000000000000000e-12;
105 | /* tol_ineq */
106 | double tol_ineq = 1.000000000000000e-12;
107 | /* tol_comp */
108 | double tol_comp = 1.000000000000000e-12;
109 | /* reg_prim */
110 | double reg_prim = 1.000000000000000e-15;
111 | /* reg_dual */
112 | double reg_dual = 1.000000000000000e-15;
113 | /* warm_start */
114 | int warm_start = 0;
115 | /* pred_corr */
116 | int pred_corr = 1;
117 | /* split_step */
118 | int split_step = 1;
119 |
--------------------------------------------------------------------------------
/examples/casadi_python/.gitignore:
--------------------------------------------------------------------------------
1 | *.tar.gz
2 | casadi
3 | *.pyc
4 | ocp_qp_data.c
5 | ocp_qcqp_data.c
6 |
--------------------------------------------------------------------------------
/examples/casadi_python/env.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/bash
2 |
3 | if [[ "${BASH_SOURCE[0]}" != "${0}" ]]
4 | then
5 | echo "Script is being sourced"
6 | else
7 | echo "ERROR: Script is a subshell"
8 | echo "To affect your current shell enviroment source this script with:"
9 | echo "source env.sh"
10 | exit
11 | fi
12 |
13 | # check that this file is run
14 | export ENV_RUN=true
15 |
16 | # if hpipm folder not specified assume parent of this folder
17 | HPIPM_MAIN_FOLDER=${HPIPM_MAIN_FOLDER:-"$(pwd)/../.."}
18 | export HPIPM_MAIN_FOLDER
19 | echo
20 | echo "HPIPM_MAIN_FOLDER=$HPIPM_MAIN_FOLDER"
21 |
22 | # if blasfeo folder not specified assume alongside the parent of this folder
23 | BLASFEO_MAIN_FOLDER=${BLASFEO_MAIN_FOLDER:-"$(pwd)/../../../blasfeo"}
24 | export BLASFEO_MAIN_FOLDER
25 | echo
26 | echo "BLASFEO_MAIN_FOLDER=$BLASFEO_MAIN_FOLDER"
27 |
28 | # export LD_LIBRARY_PATH
29 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HPIPM_MAIN_FOLDER/lib:$BLASFEO_MAIN_FOLDER/lib
30 | echo
31 | echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
32 |
33 | # export python path
34 | export PYTHONPATH=$PYTHONPATH:$(pwd)/casadi
35 | echo
36 | echo "PYTHONPATH=$PYTHONPATH"
37 |
--------------------------------------------------------------------------------
/examples/matlab_octave/.gitignore:
--------------------------------------------------------------------------------
1 | cflags_octave.txt
2 | ocp_qp_data.c
3 | ocp_qcqp_data.c
4 |
--------------------------------------------------------------------------------
/examples/matlab_octave/README.md:
--------------------------------------------------------------------------------
1 | HPIPM examples using the mex-based Matlab/Octave interface.
2 |
3 | In order to be able to run the examples in this folder, it is necessary to compile the shared libraries libblasfeo.so and libhpipm.so.
4 | The required shared libraries can be compiled by running
5 | ```
6 | make shared_library -j 4
7 | ```
8 | (and optionally installed by running `make install_shared`) from the blasfeo and hpipm root folders.
9 |
10 | Afterwards, the mex interface has to be compiled.
11 | In order to do so, open a terminal and navigate to the folder `hpipm/interfaces/matlab_octave`, then type the command
12 | ```
13 | source env.sh
14 | ```
15 | This will set some environment flags (comprising LD_LIBRARY_PATH).
16 | In doing so, it is necessary to know the location of the blasfeo and hpipm root folders (or alternatively, installation folders), which can be specified exporting the environment flags `HPIPM_MAIN_FOLDER` and `BLASFEO_MAIN_FOLDER` _before_ executing the command `source env.sh`.
17 | If not specified, default locations relataive to the current examples folder will be used (see the `end.sh` file for more details.
18 | Afterwards, open Matlab or Octave from the same terminal and compile the interface by running the function `compile_mex_all` (this step needs to be repeated only if the BLASFEO or HPIPM C libraries are recompiled).
19 |
20 | Finally, to run the examples, open a terminal and navigate to the current examples folder, then type the command `source env.sh`.
21 | Afterwards, open Matlab or Octave from the same terminal and run the examples.
22 |
23 |
--------------------------------------------------------------------------------
/examples/matlab_octave/env.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/bash
2 |
3 | if [[ "${BASH_SOURCE[0]}" != "${0}" ]]
4 | then
5 | echo "Script is being sourced"
6 | else
7 | echo "ERROR: Script is a subshell"
8 | echo "To affect your current shell enviroment source this script with:"
9 | echo "source env.sh"
10 | exit
11 | fi
12 |
13 | # check that this file is run
14 | export ENV_RUN=true
15 |
16 | # if hpipm folder not specified assume parent of this folder
17 | HPIPM_MAIN_FOLDER=${HPIPM_MAIN_FOLDER:-"$(pwd)/../.."}
18 | export HPIPM_MAIN_FOLDER
19 | echo
20 | echo "HPIPM_MAIN_FOLDER=$HPIPM_MAIN_FOLDER"
21 |
22 | # if blasfeo folder not specified assume alongside the parent of this folder
23 | BLASFEO_MAIN_FOLDER=${BLASFEO_MAIN_FOLDER:-"$(pwd)/../../../blasfeo"}
24 | export BLASFEO_MAIN_FOLDER
25 | echo
26 | echo "BLASFEO_MAIN_FOLDER=$BLASFEO_MAIN_FOLDER"
27 |
28 | # export matlab_octave_mex folder
29 | # MATLAB case
30 | export MATLABPATH=$MATLABPATH:$HPIPM_MAIN_FOLDER/interfaces/matlab_octave/
31 | echo
32 | echo "MATLABPATH=$MATLABPATH"
33 | # Octave case
34 | export OCTAVE_PATH=$OCTAVE_PATH:$HPIPM_MAIN_FOLDER/interfaces/matlab_octave/
35 | echo
36 | echo "OCTAVE_PATH=$OCTAVE_PATH"
37 |
38 | #export HPIPM_MEX_FLAGS="GCC=/usr/bin/gcc-4.9"
39 |
40 | # export LD_LIBRARY_PATH
41 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HPIPM_MAIN_FOLDER/lib:$BLASFEO_MAIN_FOLDER/lib
42 | echo
43 | echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
44 |
45 | # folder containig the data file
46 | DATA_FOLDER=${DATA_FOLDER:-"$(pwd)"}
47 | export DATA_FOLDER
48 | echo
49 | echo "DATA_FOLDER=$DATA_FOLDER"
50 |
51 |
--------------------------------------------------------------------------------
/examples/python/.gitignore:
--------------------------------------------------------------------------------
1 | ocp_qp_data.c
2 | ocp_qcqp_data.c
3 |
--------------------------------------------------------------------------------
/examples/python/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 | PYTHON = python
37 | #PYTHON = python3
38 |
39 | all:
40 | $(PYTHON) example_qp_getting_started.py
41 | $(PYTHON) example_qcqp_getting_started.py
42 |
43 | ### all individual tests ###
44 |
45 | example_qp_getting_started \
46 | example_qcqp_getting_started \
47 | : %:
48 | $(PYTHON) $@.py
49 |
--------------------------------------------------------------------------------
/examples/python/README.md:
--------------------------------------------------------------------------------
1 | HPIPM examples using the hpipm_python module.
2 |
3 | In order to be able to run the examples in this folder, it is necessary to have Python 3 installed in the system.
4 | The first step is to install the shared libraries libblasfeo.so and libhpipm.so and to run
5 | ```
6 | pip install .
7 | ```
8 | from hpipm/interface/python/hpipm_python (depending on your system, you may need to run pip3 instead).
9 |
10 | The required shared libraries can be installed by running
11 | ```
12 | make shared_library -j4 & sudo make install_shared
13 | ```
14 | from the blasfeo and hpipm root folder.
15 | Make sure that the location of libblasfeo.so and libhpipm.so is known to the system by adding /opt/blasfeo/lib and /opt/hpipm/lib to LD_LIBRARY_PATH as
16 | ```
17 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/blasfeo/lib:/opt/hpipm/lib
18 | ```
19 |
--------------------------------------------------------------------------------
/examples/python/env.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/bash
2 |
3 | if [[ "${BASH_SOURCE[0]}" != "${0}" ]]
4 | then
5 | echo "Script is being sourced"
6 | else
7 | echo "ERROR: Script is a subshell"
8 | echo "To affect your current shell enviroment source this script with:"
9 | echo "source env.sh"
10 | exit
11 | fi
12 |
13 | # check that this file is run
14 | export ENV_RUN=true
15 |
16 | # if hpipm folder not specified assume parent of this folder
17 | HPIPM_MAIN_FOLDER=${HPIPM_MAIN_FOLDER:-"$(pwd)/../.."}
18 | export HPIPM_MAIN_FOLDER
19 | echo
20 | echo "HPIPM_MAIN_FOLDER=$HPIPM_MAIN_FOLDER"
21 |
22 | # if blasfeo folder not specified assume alongside the parent of this folder
23 | BLASFEO_MAIN_FOLDER=${BLASFEO_MAIN_FOLDER:-"$(pwd)/../../../blasfeo"}
24 | export BLASFEO_MAIN_FOLDER
25 | echo
26 | echo "BLASFEO_MAIN_FOLDER=$BLASFEO_MAIN_FOLDER"
27 |
28 | # automatically export LD_LIBRARY_PATH or DYLD_LIBRARY_PATH in linux or macos
29 | UNAME_S=$(uname -s)
30 | echo $UNAME_S
31 | if [ "$UNAME_S" = "Linux" ]
32 | then
33 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HPIPM_MAIN_FOLDER/lib:$BLASFEO_MAIN_FOLDER/lib
34 | echo
35 | echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
36 | else
37 | if [ "$UNAME_S" = "Darwin" ]
38 | then
39 | export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$HPIPM_MAIN_FOLDER/lib:$BLASFEO_MAIN_FOLDER/lib
40 | echo
41 | echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH"
42 | else
43 | echo "LD_LIBRARY_PATH not set automatically for this OS. Try to it by hand in the correct way for your OS."
44 | fi
45 | fi
46 | #export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HPIPM_MAIN_FOLDER/lib:$BLASFEO_MAIN_FOLDER/lib
47 | #echo
48 | #echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
49 |
50 |
--------------------------------------------------------------------------------
/examples/python/example_debug.py:
--------------------------------------------------------------------------------
1 | from hpipm_python import *
2 | from hpipm_python.common import *
3 | import numpy as np
4 | import time
5 | import sys
6 | import os
7 |
8 | # check that env.sh has been run
9 | env_run = os.getenv('ENV_RUN')
10 | if env_run!='true':
11 | print('ERROR: env.sh has not been sourced! Before executing this example, run:')
12 | print('source env.sh')
13 | sys.exit(1)
14 |
15 | travis_run = os.getenv('TRAVIS_RUN')
16 | #travis_run = 'true'
17 |
18 |
19 | # define flags
20 | codegen_data = 1; # export qp data in the file dense_qp_data.c for use from C examples
21 | warm_start = 0; # set to 1 to warm-start the primal variable
22 |
23 |
24 | # dim
25 | nv = 3 # number of variables
26 | ne = 1 # number of equality constraints
27 | nb = 3 # number of box constraints
28 | ng = 0 # number of general (inequality) constraints
29 |
30 | dim = hpipm_dense_qp_dim()
31 | dim.set('nv', nv)
32 | dim.set('nb', nb)
33 | dim.set('ne', ne)
34 | dim.set('ng', ng)
35 |
36 | # codegen
37 | if codegen_data:
38 | dim.codegen('dense_qp_data.c', 'w')
39 |
40 | # data
41 | H = np.array([[ 65., -22., -16.], [-22., 14., 7.], [-16., 7., 5.]])
42 | g = np.array([-13., 15., 7.])
43 | A = np.array([[1., 0, 0]])
44 | b = np.array([-0.5])
45 | lb = np.array([-0.5, -2, -0.8])
46 |
47 | # qp
48 | qp = hpipm_dense_qp(dim)
49 | qp.set('H', H)
50 | qp.set('g', g)
51 | qp.set('A', A)
52 | qp.set('b', b)
53 | qp.set('idxb', np.array([0, 1, 2]))
54 | qp.set('lb', lb)
55 | qp.set('ub_mask', np.zeros(3))
56 |
57 | # codegen
58 | if codegen_data:
59 | qp.codegen('dense_qp_data.c', 'a')
60 |
61 | arg = hpipm_dense_qp_solver_arg(dim, 'robust')
62 | qp_sol = hpipm_dense_qp_sol(dim)
63 | solver = hpipm_dense_qp_solver(dim, arg)
64 | solver.solve(qp, qp_sol)
65 |
66 | # codegen
67 | if codegen_data:
68 | arg.codegen('dense_qp_data.c', 'a')
69 |
70 | v = qp_sol.get('v')
71 | pi = qp_sol.get('pi')
72 | lam_lb = qp_sol.get('lam_lb')
73 | lam_ub = qp_sol.get('lam_ub')
74 | lam_lg = qp_sol.get('lam_lg')
75 | lam_ug = qp_sol.get('lam_ug')
76 | print('v = {}'.format(v.flatten()))
77 | print('pi = {}'.format(pi.flatten()))
78 | print('lam_lb = {}'.format(lam_lb.flatten()))
79 | print('lam_ub = {}'.format(lam_ub.flatten()))
80 | print('lam_lg = {}'.format(lam_lg.flatten()))
81 | print('lam_ug = {}'.format(lam_ug.flatten()))
82 |
83 | # get solver statistics
84 | status = solver.get('status')
85 | res_stat = solver.get('max_res_stat')
86 | res_eq = solver.get('max_res_eq')
87 | res_ineq = solver.get('max_res_ineq')
88 | res_comp = solver.get('max_res_comp')
89 | iters = solver.get('iter')
90 | stat = solver.get('stat')
91 | if(travis_run!='true'):
92 | print('\nsolver statistics:\n')
93 | print('ipm return = {0:1d}\n'.format(status))
94 | print('ipm max res stat = {:e}\n'.format(res_stat))
95 | print('ipm max res eq = {:e}\n'.format(res_eq))
96 | print('ipm max res ineq = {:e}\n'.format(res_ineq))
97 | print('ipm max res comp = {:e}\n'.format(res_comp))
98 | print('ipm iter = {0:1d}\n'.format(iters))
99 | print('stat =')
100 | print('\titer\talpha_aff\tmu_aff\t\tsigma\t\talpha_prim\talpha_dual\tmu\t\tres_stat\tres_eq\t\tres_ineq\tres_comp')
101 | for ii in range(iters+1):
102 | print('\t{:d}\t{:e}\t{:e}\t{:e}\t{:e}\t{:e}\t{:e}\t{:e}\t{:e}\t{:e}\t{:e}'.format(ii, stat[ii][0], stat[ii][1], stat[ii][2], stat[ii][3], stat[ii][4], stat[ii][5], stat[ii][6], stat[ii][7], stat[ii][8], stat[ii][9]))
103 | print('')
104 |
105 | if status==0:
106 | print('\nsuccess!\n')
107 | else:
108 | print('\nSolution failed, solver returned status {0:1d}\n'.format(status))
109 |
110 |
111 |
112 | sys.exit(int(status))
113 |
--------------------------------------------------------------------------------
/examples/python/tmp.py:
--------------------------------------------------------------------------------
1 | from hpipm_python import *
2 | from hpipm_python.common import *
3 | import numpy as np
4 | import time
5 |
6 | nv = 8 #number of variables
7 | ne = 8 # number of equality constraints
8 | ng = 0
9 | dim = hpipm_dense_qp_dim()
10 | dim.set('nv', nv)
11 | dim.set('ne', ne)
12 | dim.set('ng', ng)
13 | H = np.array([[ 2, -2, 0, 0, 0, 0, 0, 0],
14 | [-2, 4, -2, 0, 0, 0, 0, 0],
15 | [ 0, -2, 4, -2, 0, 0, 0, 0],
16 | [ 0, 0, -2, 2, 0, 0, 0, 0],
17 | [ 0, 0, 0, 0, 2, -2, 0, 0],
18 | [ 0, 0, 0, 0, -2, 4, -2, 0],
19 | [ 0, 0, 0, 0, 0, -2, 4, -2],
20 | [ 0, 0, 0, 0, 0, 0, -2, 2]])
21 | g = np.array([[0.],[0.],[0.],[0.],[0.],[0.],[0.],[0.]])
22 | A = np.array([[ 1, 0, 0, 0, 0, 0, 0, 0],
23 | [ 0, 0, 0, 0, 1, 0, 0, 0],
24 | [ 0, 0, 0, 1, 0, 0, 0, 0],
25 | [ 0, 0, 0, 0, 0, 0, 0, 1],
26 | [-3, 3, 0, 0, 0, 0, 0, 0],
27 | [ 0, 0, 0, 0, -3, 3, 0, 0],
28 | [ 0, 0, -3, 3, 0, 0, 0, 0],
29 | [ 0, 0, 0, 0, 0, 0, -3, 3]])
30 | b = np.array([[ 1. ],[ 2. ],[10. ],[12. ],[ 1.5],[ 3. ],[ 0. ],[ 1.5]])
31 | qp = hpipm_dense_qp(dim)
32 | qp.set('H', H)
33 | qp.set('g', g)
34 | qp.set('A', A)
35 | qp.set('b', b)
36 | qp.print_C_struct()
37 |
38 | qp_sol = hpipm_dense_qp_sol(dim)
39 | mode = 'speed'
40 | arg = hpipm_dense_qp_solver_arg(dim, mode)
41 | arg.set('mu0', 1e4)
42 | arg.set('iter_max', 30)
43 | arg.set('tol_stat', 1e-4)
44 | arg.set('tol_eq', 1e-5)
45 | arg.set('tol_ineq', 1e-5)
46 | arg.set('tol_comp', 1e-5)
47 | arg.set('reg_prim', 1e-12)
48 | solver = hpipm_dense_qp_solver(dim, arg)
49 | optimization_start_time = time.time()
50 | solver.solve(qp, qp_sol)
51 | optimization_end_time = time.time()
52 | v = qp_sol.get('v')
53 |
54 | print(v)
55 |
56 | print("A @ v[:,None]: " , np.dot(A, v))
57 |
--------------------------------------------------------------------------------
/examples/simulink/.gitignore:
--------------------------------------------------------------------------------
1 | *.slxc
2 |
--------------------------------------------------------------------------------
/examples/simulink/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 |
37 | clean:
38 | rm -f *.mexa64
39 |
40 |
--------------------------------------------------------------------------------
/examples/simulink/README.md:
--------------------------------------------------------------------------------
1 | This example shows how to use the code-generated QP data (see MALTAB/Octave and Python examples) to solve QPs with HPIPM from simulink.
2 | In order to be able to use the S-Function within a Simulink block, copy the C file containing the QP data to the current folder (and change the path in the `make_sfun.m` script).
3 | Then run `make_sfun.m` and `load_parameters.m`.
4 | This will compile the HPIPM S-Function into MEX binaries that you can from the Simulink block `hpipm_simulink_getting_started.slx`.
5 | Notice that the make script will make use of the environment variables usually set by sourcing `env.sh`.
6 | The default `qp_data.c` that you find in this folder refers to the `getting_started` (MATLAB/Octave or Python) example.
7 | When you update the data, you will need to adjust the dimension of the signals in the Simulink block accordingly.
8 |
--------------------------------------------------------------------------------
/examples/simulink/env.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/bash
2 |
3 | if [[ "${BASH_SOURCE[0]}" != "${0}" ]]
4 | then
5 | echo "Script is being sourced"
6 | else
7 | echo "ERROR: Script is a subshell"
8 | echo "To affect your current shell enviroment source this script with:"
9 | echo "source env.sh"
10 | exit
11 | fi
12 |
13 | # check that this file is run
14 | export ENV_RUN=true
15 |
16 | # if hpipm folder not specified assume parent of this folder
17 | HPIPM_MAIN_FOLDER=${HPIPM_MAIN_FOLDER:-"$(pwd)/../.."}
18 | export HPIPM_MAIN_FOLDER
19 | echo
20 | echo "HPIPM_MAIN_FOLDER=$HPIPM_MAIN_FOLDER"
21 |
22 | # if blasfeo folder not specified assume alongside the parent of this folder
23 | BLASFEO_MAIN_FOLDER=${BLASFEO_MAIN_FOLDER:-"$(pwd)/../../../blasfeo"}
24 | export BLASFEO_MAIN_FOLDER
25 | echo
26 | echo "BLASFEO_MAIN_FOLDER=$BLASFEO_MAIN_FOLDER"
27 |
28 | # export matlab_octave_mex folder
29 | # MATLAB case
30 | export MATLABPATH=$MATLABPATH:$HPIPM_MAIN_FOLDER/interfaces/matlab_octave/
31 | echo
32 | echo "MATLABPATH=$MATLABPATH"
33 | # Octave case
34 | export OCTAVE_PATH=$OCTAVE_PATH:$HPIPM_MAIN_FOLDER/interfaces/matlab_octave/
35 | echo
36 | echo "OCTAVE_PATH=$OCTAVE_PATH"
37 |
38 | #export HPIPM_MEX_FLAGS="GCC=/usr/bin/gcc-4.9"
39 |
40 | # export LD_LIBRARY_PATH
41 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HPIPM_MAIN_FOLDER/lib:$BLASFEO_MAIN_FOLDER/lib
42 | echo
43 | echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
44 |
45 | # folder containig the data file
46 | DATA_FOLDER=${DATA_FOLDER:-"$(pwd)"}
47 | export DATA_FOLDER
48 | echo
49 | echo "DATA_FOLDER=$DATA_FOLDER"
50 |
51 |
--------------------------------------------------------------------------------
/examples/simulink/hpipm_simulink_getting_started.slx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/giaf/hpipm/c39c453bef3b78361d40af1ac6316c25e6171c33/examples/simulink/hpipm_simulink_getting_started.slx
--------------------------------------------------------------------------------
/examples/simulink/load_parameters.m:
--------------------------------------------------------------------------------
1 | close all
2 | clc
3 |
4 | % check that env.sh has been run
5 | env_run = getenv('ENV_RUN');
6 | if (~strcmp(env_run, 'true'))
7 | disp('ERROR: env.sh has not been sourced! Before executing this example, run:');
8 | disp('source env.sh');
9 | return;
10 | end
11 |
12 |
13 |
14 |
15 | % create dim from qp data
16 | dim = hpipm_ocp_qp_dim('qp_data.c');
17 | dim.print_C_struct();
18 |
19 | % extract dims
20 | N = dim.get('N');
21 | NU = dim.get('nu', 0);
22 | NX = dim.get('nx', 1);
23 |
24 | % initial state for simulation
25 | % TODO getter for x0 in qp data !!!!!!!!!
26 | x0 = [-1 3];
27 |
28 | % sampling time
29 | Ts = 1; % by default one simulation step per second
30 |
31 |
--------------------------------------------------------------------------------
/examples/simulink/make_sfun.m:
--------------------------------------------------------------------------------
1 | HPIPM_MAIN_FOLDER = getenv('HPIPM_MAIN_FOLDER');
2 | BLASFEO_MAIN_FOLDER = getenv('BLASFEO_MAIN_FOLDER');
3 |
4 | SOURCES = [ 'qp_data.c ', ...
5 | [HPIPM_MAIN_FOLDER, '/interfaces/simulink/hpipm_sfun.c ']];
6 |
7 | INCS = [ ' -I', HPIPM_MAIN_FOLDER, '/include/ ', ...
8 | ' -I', BLASFEO_MAIN_FOLDER, '/include/ '];
9 |
10 | CFLAGS = ' -O';
11 |
12 | LIB_PATH = [ ' -L', HPIPM_MAIN_FOLDER, '/lib/ ', ...
13 | ' -L', BLASFEO_MAIN_FOLDER, '/lib/ '];
14 |
15 | LIBS = '-lhpipm -lblasfeo -lm';
16 |
17 | eval( [ 'mex -v -output hpipm_solver_sfunction ', ...
18 | CFLAGS, INCS, ' ', SOURCES, LIB_PATH, ' ', LIBS ]);
19 |
20 | disp( [ 'hpipm_solver_sfunction', '.', ...
21 | eval('mexext'), ' successfully created!'] );
22 |
23 |
24 |
--------------------------------------------------------------------------------
/experimental/andrea/casadi_vde_interface/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 |
37 | CC = gcc
38 | CFLAGS = -O3
39 | main: main.o model.o vde_forw_model.o
40 | $(CC) -o main main.o model.o vde_forw_model.o -lm -I.
41 |
42 | clean:
43 | rm main.o model.o vde_forw_model.o
44 |
--------------------------------------------------------------------------------
/experimental/andrea/casadi_vde_interface/main.c:
--------------------------------------------------------------------------------
1 | #include "model.h"
2 |
3 | int main(){
4 |
5 | printf("Testing CasADi-generated VDE evaluation:\n\n");
6 | const int NX = 4;
7 | const int NU = 1;
8 |
9 | // test input
10 | double in[NX + NU + NX*NX + NX*NU];
11 | double out[NX + NX*NX + NX*NU];
12 |
13 | for (int i = 0; i < NX + NU + NX*NX + NX*NU; i++) in[i] = i;
14 |
15 | printf("input:\n\n");
16 | for (int i = 0; i < NX; i++) printf("x[%i] = %f\n", i, in[i]);
17 | printf("\n");
18 | for (int i = 0; i < NX*NX; i++) printf("dx/dx[%i] = %f\n", i, in[i+NX]);
19 | printf("\n");
20 | for (int i = 0; i < NX*NU; i++) printf("dx/du[%i] = %f\n", i, in[i+NX*NX]);
21 | printf("\n");
22 | for (int i = 0; i < NU; i++) printf("u[%i] = %f\n", i, in[i+NX*NX+NX*NU]);
23 | printf("\n");
24 |
25 | VDE_fun_model(in, out, vdeFun);
26 |
27 | printf("output:\n\n");
28 | for (int i = 0; i < NX; i++) printf("x[%i] = %f\n", i, out[i]);
29 | printf("\n");
30 | for (int i = 0; i < NX*NX; i++) printf("dx/dx[%i] = %f\n", i, out[i+NX]);
31 | printf("\n");
32 | for (int i = 0; i < NX*NU; i++) printf("dx/du[%i] = %f\n", i, out[i+NX*NX]);
33 | printf("\n");
34 |
35 | printf("-> done.\n");
36 | }
37 |
--------------------------------------------------------------------------------
/experimental/andrea/casadi_vde_interface/model.c:
--------------------------------------------------------------------------------
1 | #include "model.h"
2 |
3 | void VDE_fun_model(const double* in, double* out,
4 | int (*vde)(const double**, double**, int*, double*,
5 | int)) {
6 |
7 | const int NX = 4;
8 | const int NU = 1;
9 | const double* x = in;
10 | const double* Su = in + NX;
11 | const double* Sx = in + NX + NU * NX;
12 | const double* u = in + NX + NX * (NX + NU);
13 |
14 | double* x_out = out;
15 | double* Su_out = out + NX;
16 | double* Sx_out = out + NX + NU * NX;
17 |
18 | const double* casadi_arg[4];
19 | double* casadi_res[3];
20 |
21 | casadi_arg[0] = x;
22 | casadi_arg[1] = Sx;
23 | casadi_arg[2] = Su;
24 | casadi_arg[3] = u;
25 |
26 | casadi_res[0] = x_out;
27 | casadi_res[1] = Sx_out;
28 | casadi_res[2] = Su_out;
29 |
30 | int* iw = 0;
31 | double* w = 0;
32 | int mem = 0;
33 |
34 | vde(casadi_arg, casadi_res, iw, w, mem);
35 | }
36 |
--------------------------------------------------------------------------------
/experimental/andrea/casadi_vde_interface/model.h:
--------------------------------------------------------------------------------
1 | #ifndef EXAMPLES_C_PENDULUM_MODEL_PENDULUM_MODEL_H_
2 | #define EXAMPLES_C_PENDULUM_MODEL_PENDULUM_MODEL_H_
3 |
4 | int vdeFun(const double** arg, double** res, int* iw, double* w, int mem);
5 |
6 | void VDE_fun_pendulum(const double* in, double* out,
7 | int (*vde)(const double**, double**, int*, double*, int));
8 |
9 | #endif // EXAMPLES_C_PENDULUM_MODEL_PENDULUM_MODEL_H_
10 |
--------------------------------------------------------------------------------
/experimental/andrea/casadi_vde_interface/model.m:
--------------------------------------------------------------------------------
1 | clc;
2 | clear all;
3 | close all;
4 |
5 | import casadi.*
6 |
7 | % constants
8 | M = 1;
9 | m = 0.1;
10 | g = 9.81;
11 | l = 0.8;
12 |
13 | % variables
14 | x1 = SX.sym('x1');
15 | theta = SX.sym('theta');
16 | v1 = SX.sym('v1');
17 | dtheta = SX.sym('dtheta');
18 |
19 | F = SX.sym('F');
20 |
21 | x = [x1; theta; v1; dtheta];
22 | u = F;
23 |
24 | nx = length(x);
25 | nu = length(u);
26 |
27 | % ODE system
28 |
29 | f_expl = [ v1; ...
30 | dtheta; ...
31 | (- l*m*sin(theta)*dtheta^2 + F + g*m*cos(theta)*sin(theta))/(M + m - m*cos(theta)^2); ...
32 | (- l*m*cos(theta)*sin(theta)*dtheta^2 + F*cos(theta) + g*m*sin(theta) + M*g*sin(theta))/(l*(M + m - m*cos(theta)^2)) ];
33 |
34 |
35 | odeFun = Function('odeFun',{x,u},{f_expl});
36 |
37 | Sx = SX.sym('Sx',nx,nx);
38 | Sp = SX.sym('Sp',nx,nu);
39 | lambdaX = SX.sym('lambdaX',nx,1);
40 |
41 | vdeX = SX.zeros(nx,nx);
42 | vdeX = vdeX + jtimes(f_expl,x,Sx);
43 |
44 | vdeP = SX.zeros(nx,nu) + jacobian(f_expl,u);
45 | vdeP = vdeP + jtimes(f_expl,x,Sp);
46 |
47 | vdeFun = Function('vdeFun',{x,Sx,Sp,u},{f_expl,vdeX,vdeP});
48 |
49 | jacX = SX.zeros(nx,nx) + jacobian(f_expl,x);
50 | jacFun = Function('jacFun',{x,u},{f_expl,jacX});
51 |
52 | %adj = jtimes(f_expl,[x;u],lambdaX,true);
53 | adj = jtimes(f_expl,[u;x],lambdaX,true);
54 |
55 | adjFun = Function('adjFun',{x,lambdaX,u},{adj});
56 |
57 | S_forw = vertcat(horzcat(Sx, Sp), horzcat(zeros(nu,nx), eye(nu)));
58 | hess = S_forw.'*jtimes(adj,[x;u],S_forw);
59 | hess2 = [];
60 | for j = 1:nx+nu
61 | for i = j:nx+nu
62 | hess2 = [hess2; hess(i,j)];
63 | end
64 | end
65 |
66 | hessFun = Function('hessFun',{x,Sx,Sp,lambdaX,u},{adj,hess2});
67 |
68 | opts = struct('mex', false);
69 | odeFun.generate(['ode_model'], opts);
70 | vdeFun.generate(['vde_forw_model'], opts);
71 | jacFun.generate(['jac_model'], opts);
72 | adjFun.generate(['vde_adj_model'], opts);
73 | hessFun.generate(['vde_hess_model'], opts);
74 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces/julia/hpipm_data.jl:
--------------------------------------------------------------------------------
1 | function hpipm_data()
2 | py_qp_data = hp.hpipm_data()
3 | ju_qp_data = py2ju_obj(py_qp_data)
4 | return ju_qp_data
5 | end
6 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces/julia/hpipm_dims.jl:
--------------------------------------------------------------------------------
1 | function hpipm_dims()
2 | py_qp_dims = hp.hpipm_dims()
3 | ju_qp_dims = py2ju_obj(py_qp_dims)
4 | return ju_qp_dims
5 | end
6 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces/julia/hpipm_julia.jl:
--------------------------------------------------------------------------------
1 | module hpipm_julia
2 | using PyCall
3 | @pyimport numpy as np
4 | @pyimport hpipm_python as hp
5 |
6 | export hpipm_data, hpipm_dims, hpipm_solver
7 | include("py2ju_obj.jl")
8 | include("ju2py_obj.jl")
9 | include("hpipm_data.jl")
10 | include("hpipm_dims.jl")
11 | include("hpipm_solver.jl")
12 | end
13 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces/julia/hpipm_solver.jl:
--------------------------------------------------------------------------------
1 | type hpipm_solver
2 | # "attribtues"
3 | py_hpipm_solver
4 | py_hpipm_data
5 | py_hpipm_dims
6 |
7 | # "methods"
8 | solve
9 | print_sol
10 |
11 | function hpipm_solver(ju_qp_dims, ju_qp_data)
12 | this = new()
13 |
14 | py_qp_data = hp.hpipm_data()
15 | this.py_hpipm_data = ju2py_obj(ju_qp_data, py_qp_data)
16 |
17 | py_qp_dims = hp.hpipm_dims()
18 | this.py_hpipm_dims = ju2py_obj(ju_qp_dims, py_qp_dims)
19 |
20 | py_qp_solver = hp.hpipm_solver(this.py_hpipm_dims, this.py_hpipm_data)
21 | this.py_hpipm_solver = py_qp_solver
22 |
23 | this.solve = function()
24 | (this.py_hpipm_solver)[:solve]()
25 | end
26 |
27 | this.print_sol = function()
28 | this.py_hpipm_solver[:print_sol]()
29 | end
30 |
31 | return this
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces/julia/ju2py_obj.jl:
--------------------------------------------------------------------------------
1 | function ju2py_obj(ju_obj, py_obj)
2 | py_attr = keys(py_obj)
3 | n_attr = length(py_attr)
4 | for i = 1:n_attr
5 | # skip base class attributes
6 | if !contains(String(py_attr[i]), "__")
7 | if py_obj[py_attr[i]] != nothing
8 | error("Cannot assign to non-None attribute $(py_obj[py_attr[i]]) in Python object.")
9 | end
10 | py_attr_name = py_attr[i]
11 | ju_key_name = String(py_attr_name)
12 | if ju_obj[ju_key_name] != nothing
13 | ju_eltype = eltype(ju_obj[ju_key_name])
14 | # assign Julia array of arrays to Python list of numpy arrays
15 | if ju_eltype == Array{Int64, 1} || ju_eltype == Array{Float64,1} || ju_eltype == Array{Int64,2} || ju_eltype == Array{Float64, 2}
16 | try py_obj[py_attr_name] = PyVector(ju_obj[ju_key_name])
17 | catch
18 | error("Could not assign attribute $(py_attr[i]).")
19 | end
20 | # assign Julia array to numpy array
21 | elseif (ju_eltype == Int64 || ju_eltype == Float64) && size(ju_obj[ju_key_name]) != ()
22 | try py_obj[py_attr_name] = np.array(ju_obj[ju_key_name])
23 | catch
24 | error("Could not assign attribute $(py_attr[i]).")
25 | end
26 | # assign scalar
27 | elseif size(ju_obj[ju_key_name]) == ()
28 | try py_obj[py_attr_name] = ju_obj[ju_key_name]
29 | catch
30 | error("Could not assign attribute $(py_attr[i]).")
31 | end
32 | # the Julia Dictionary containts something that it should not contain
33 | else
34 | error("Julia dictionary contains something not an Array{Int/Float64} or Int/Float64.")
35 | end
36 | end
37 | end
38 | end
39 | return py_obj
40 | end
41 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces/julia/py2ju_obj.jl:
--------------------------------------------------------------------------------
1 | function py2ju_obj(py_obj)
2 | py_attr = keys(py_obj)
3 | n_attr = length(py_attr)
4 | ju_obj = Dict()
5 | for i = 1:n_attr
6 | # skip base class attributes
7 | if !contains(String(py_attr[i]), "__")
8 | if py_obj[py_attr[i]] != nothing
9 | error("Cannot convert Python object with non-None attribute value $(prop[i]).")
10 | end
11 | attr_name = String(py_attr[i])
12 | ju_obj[attr_name] = nothing
13 | end
14 | end
15 | return ju_obj
16 | end
17 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces_examples/julia/README.md:
--------------------------------------------------------------------------------
1 | HPIPM examples using the hpipm_julia module. In order to be able to run the examples in this folder from Julia (version > 0.5 required), it is necessary to install the shared libraries libblasfeo.so and libhpipm.so. The required shared libraries can be installed by running 'make shared_library -j4 & sudo make install_shared' from the blasfeo and hpipm root folder. Make sure that the location of libblasfeo.so and libhpipm.so is known to the system by adding /opt/blasfeo/lib and /opt/hpipm/lib to LD_LIBRARY_PATH. In order to be able to call the Python interpreter from Julia you will need to install the PyCall Julia package (https://github.com/JuliaPy/PyCall.jl) by running 'Pkg.build("PyCall")'. Finally, you will need to make sure that hpipm/interfaces/julia/hpipm_julia.jl is included (run include ) and that hpipm_python has been installed for the Python version used by Julia. You can set the path to the desired version of the Python intepreter by running 'ENV["PYTHON"] = 'path_to_python_interpreter'' from Julia before building PyCall.
2 |
3 |
4 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces_examples/julia/getting_started.jl:
--------------------------------------------------------------------------------
1 | # ENV["PYTHON"] = /usr/bin/python3
2 | # Pkg.build("PyCall")
3 |
4 | include("../../interfaces/julia/hpipm_julia.jl")
5 | using hpipm_julia
6 |
7 | qp_data = hpipm_data()
8 |
9 | A = [1.0 0; 1 1]
10 | B = [0, 1]
11 | b = [0, 0]
12 |
13 | Q = [1 0; 0 1]
14 | S = [0, 0]
15 | R = [1]
16 | q = [1, 1]
17 | r = [0]
18 |
19 | qp_data["A"] = [A, A, A, A, A]
20 | qp_data["B"] = [B, B, B, B, B]
21 | qp_data["b"] = [b, b, b, b, b]
22 | qp_data["Q"] = [Q, Q, Q, Q, Q, Q]
23 | qp_data["S"] = [S, S, S, S, S, S]
24 | qp_data["R"] = [R, R, R, R, R, R]
25 | qp_data["q"] = [q, q, q, q, q, q]
26 | qp_data["r"] = [r, r, r, r, r, r]
27 |
28 | x0 = [1, 1]
29 |
30 | qp_data["d_lb"] = [x0]
31 | qp_data["d_ub"] = [x0]
32 |
33 | qp_data["idxb"] = [[1, 2]]
34 |
35 | qp_dims = hpipm_dims()
36 |
37 | qp_dims["nx"] = [2, 2, 2, 2, 2, 2]
38 | qp_dims["nu"] = [1, 1, 1, 1, 1, 0]
39 | qp_dims["nb"] = [2, 0, 0, 0, 0, 0]
40 | qp_dims["nbx"] = [2, 0, 0, 0, 0, 0]
41 | qp_dims["nbu"] = [0, 0, 0, 0, 0, 0]
42 | qp_dims["ng"] = [0, 0, 0, 0, 0, 0]
43 | qp_dims["ns"] = [0, 0, 0, 0, 0, 0]
44 | qp_dims["nsbx"] = [0, 0, 0, 0, 0, 0]
45 | qp_dims["nsbu"] = [0, 0, 0, 0, 0, 0]
46 | qp_dims["nsg"] = [0, 0, 0, 0, 0, 0]
47 | qp_dims["N"] = 5
48 |
49 | # set up solver
50 | solver = hpipm_solver(qp_dims, qp_data)
51 |
52 | # solve qp
53 | return_flag = solver.solve()
54 |
55 | println("HPIPM returned with flag $(return_flag)\n")
56 |
57 | if return_flag == 0
58 | println("-> QP solved Solution:\n")
59 | solver.print_sol()
60 | else
61 | println("-> Solver failed.\n")
62 | end
63 |
--------------------------------------------------------------------------------
/experimental/andrea/interfaces_examples/julia/test_old.jl:
--------------------------------------------------------------------------------
1 | # ENV["PYTHON"] = /usr/bin/python3
2 | # Pkg.build("PyCall")
3 |
4 | using PyCall
5 | @pyimport hpipm_python as hp
6 | @pyimport numpy as np
7 |
8 | qp_data = hp.hpipm_data()
9 |
10 | A = np.array([1, 0, 1, 1])
11 | B = np.array([0, 1])
12 | b = np.array([0, 0])
13 |
14 | Q = np.array([1, 0, 0, 1])
15 | S = np.array([0, 0])
16 | R = np.array([1])
17 | q = np.array([1, 1])
18 | r = np.array([0])
19 |
20 | qp_data[:A] = PyVector([A, A, A, A, A])
21 | qp_data[:B] = PyVector([B, B, B, B, B])
22 | qp_data[:b] = PyVector([b, b, b, b, b])
23 | qp_data[:Q] = PyVector([Q, Q, Q, Q, Q, Q])
24 | qp_data[:S] = PyVector([S, S, S, S, S, S])
25 | qp_data[:R] = PyVector([R, R, R, R, R, R])
26 | qp_data[:q] = PyVector([q, q, q, q, q, q])
27 | qp_data[:r] = PyVector([r, r, r, r, r, r])
28 |
29 | x0 = np.array([1, 1])
30 |
31 | qp_data[:d_lb] = PyVector([x0])
32 | qp_data[:d_ub] = PyVector([x0])
33 |
34 | qp_data[:idxb] = PyVector([np.array([1, 2])])
35 |
36 | qp_dims = hp.hpipm_dims()
37 |
38 | qp_dims[:nx] = np.array([2, 2, 2, 2, 2, 2])
39 | qp_dims[:nu] = np.array([1, 1, 1, 1, 1, 0])
40 | qp_dims[:nb] = np.array([2, 0, 0, 0, 0, 0])
41 | qp_dims[:nbx] = np.array([2, 0, 0, 0, 0, 0])
42 | qp_dims[:nbu] = np.array([0, 0, 0, 0, 0, 0])
43 | qp_dims[:ng] = np.array([0, 0, 0, 0, 0, 0])
44 | qp_dims[:ns] = np.array([0, 0, 0, 0, 0, 0])
45 | qp_dims[:nsbx] = np.array([0, 0, 0, 0, 0, 0])
46 | qp_dims[:nsbu] = np.array([0, 0, 0, 0, 0, 0])
47 | qp_dims[:nsg] = np.array([0, 0, 0, 0, 0, 0])
48 | qp_dims[:N] = 5
49 |
50 | # set up solver
51 | solver = hp.hpipm_solver(qp_dims, qp_data)
52 |
53 | # solve qp
54 | return_flag = solver[:solve]()
55 |
56 | println("HPIPM returned with flag $(return_flag)\n")
57 |
58 | if return_flag == 0
59 | println("-> QP solved Solution:\n")
60 | solver[:print_sol]()
61 | else
62 | println("-> Solver failed.\n")
63 | end
64 |
--------------------------------------------------------------------------------
/experimental/andrea/notes/notes.auxlock:
--------------------------------------------------------------------------------
1 | \def \tikzexternallocked {0}
2 |
--------------------------------------------------------------------------------
/experimental/andrea/notes/notes.bbl:
--------------------------------------------------------------------------------
1 | \begin{thebibliography}{1}
2 |
3 | \bibitem{Frison2013}
4 | G.~Frison and J.~B. J{\o}rgensen.
5 | \newblock Efficient implementation of the {R}iccati recursion for solving
6 | linear-quadratic control problems.
7 | \newblock In {\em 2013 IEEE International Conference on Control Applications
8 | (CCA)}, pages 1117--1122, Aug 2013.
9 |
10 | \end{thebibliography}
11 |
--------------------------------------------------------------------------------
/experimental/andrea/notes/notes.blg:
--------------------------------------------------------------------------------
1 | This is BibTeX, Version 0.99d (TeX Live 2015/Debian)
2 | Capacity: max_strings=35307, hash_size=35307, hash_prime=30011
3 | The top-level auxiliary file: notes.aux
4 | The style file: plain.bst
5 | Database file #1: syscop.bib
6 | You've used 1 entry,
7 | 2118 wiz_defined-function locations,
8 | 579 strings with 5716 characters,
9 | and the built_in function-call counts, 501 in all, are:
10 | = -- 49
11 | > -- 13
12 | < -- 1
13 | + -- 5
14 | - -- 4
15 | * -- 29
16 | := -- 72
17 | add.period$ -- 3
18 | call.type$ -- 1
19 | change.case$ -- 5
20 | chr.to.int$ -- 0
21 | cite$ -- 1
22 | duplicate$ -- 25
23 | empty$ -- 45
24 | format.name$ -- 4
25 | if$ -- 117
26 | int.to.chr$ -- 0
27 | int.to.str$ -- 1
28 | missing$ -- 1
29 | newline$ -- 8
30 | num.names$ -- 2
31 | pop$ -- 8
32 | preamble$ -- 1
33 | purify$ -- 4
34 | quote$ -- 0
35 | skip$ -- 24
36 | stack$ -- 0
37 | substring$ -- 41
38 | swap$ -- 13
39 | text.length$ -- 1
40 | text.prefix$ -- 0
41 | top$ -- 0
42 | type$ -- 4
43 | warning$ -- 0
44 | while$ -- 4
45 | width$ -- 2
46 | write$ -- 13
47 |
--------------------------------------------------------------------------------
/experimental/andrea/notes/notes.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/giaf/hpipm/c39c453bef3b78361d40af1ac6316c25e6171c33/experimental/andrea/notes/notes.pdf
--------------------------------------------------------------------------------
/experimental/andrea/notes/syscop.bib:
--------------------------------------------------------------------------------
1 | /home/andrea/syscop_bibtex/syscop.bib
--------------------------------------------------------------------------------
/experimental/andrea/notes/todo.txt:
--------------------------------------------------------------------------------
1 | 1. check problem 24: converges in C implementation but not in MATLAB
2 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/benchmark.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/giaf/hpipm/c39c453bef3b78361d40af1ac6316c25e6171c33/experimental/andrea/prototype/code/benchmark.mat
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/matlab.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/giaf/hpipm/c39c453bef3b78361d40af1ac6316c25e6171c33/experimental/andrea/prototype/code/matlab.mat
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/example1.m:
--------------------------------------------------------------------------------
1 |
2 | close all
3 |
4 | plotregion({-[1 1 1],[-2 3 -4]},{[-1.5],[-20]},{[0 0 0],[2 1 4]},{[Inf,0.5,0.5],[3,3,6]});
5 |
6 | axis equal
7 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/example2.m:
--------------------------------------------------------------------------------
1 |
2 | close all
3 |
4 | plotregion([1 1],[0.6],[0 0],[1 1],'m',0.3,4*(rand(2,7)-0.5),'r:','gxbx');
5 |
6 | axis equal
7 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/example3.m:
--------------------------------------------------------------------------------
1 |
2 | close all
3 |
4 | n=15;
5 | vec1=sin(linspace(0,2*pi*(1-1/n),n))';
6 | vec2=cos(linspace(0,2*pi*(1-1/n),n))';
7 | vec3=zeros(n,1);
8 |
9 | plotregion({-[vec1,vec2,vec3;vec3,vec2,vec1],[1 0 0;-1 0 0;0 1 0;0 -1 0;0 0 1;0 0 -1]*[cos(1),sin(1),0;cos(3),0,sin(3);0,sin(2),cos(2)]},{-1.9*ones(2*n,1),[-5 1 5 -6 -3 2]'},[],[],{'b','r'},0.7);
10 |
11 | axis equal
12 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/example4.m:
--------------------------------------------------------------------------------
1 |
2 | close all
3 |
4 | A=[1,1,1;-1,1,1;1,-1,1;1,1,-1;-1,-1,1;-1,1,-1;1,-1,-1;-1,-1,-1];
5 | b=-ones(8,1);
6 |
7 | plotregion(A,b,[],[],[0.7,0.2,0.3]);
8 |
9 | axis equal
10 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/example5.m:
--------------------------------------------------------------------------------
1 |
2 | close all
3 |
4 | A=[-sqrt(6)/2,-3*sqrt(2)/2,-sqrt(3)/2;sqrt(6),0,-sqrt(3)/2;-sqrt(6)/2,3*sqrt(2)/2,-sqrt(3)/2;0,0,1];
5 | b=[-sqrt(6)/2;-sqrt(6)/2;-sqrt(6)/2;0];
6 |
7 | plotregion(A,b,[],[],[0.1,0.5,0.8]);
8 |
9 | axis equal
10 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/example6.m:
--------------------------------------------------------------------------------
1 |
2 | close all
3 |
4 | A=[1,1,1];
5 | b=2;
6 | lb=zeros(3,1);
7 | ub=ones(3,1);
8 |
9 | plotregion(A,b,lb,ub,[0.3,0.3,0.9]);
10 |
11 | axis equal
12 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/example7.m:
--------------------------------------------------------------------------------
1 |
2 | close all
3 |
4 | A=[-sqrt(6)/2,-3*sqrt(2)/2,-sqrt(3)/2;sqrt(6),0,-sqrt(3)/2;-sqrt(6)/2,3*sqrt(2)/2,-sqrt(3)/2;0,0,1];
5 | b=[-sqrt(6)/2;-sqrt(6)/2;-sqrt(6)/2;0];
6 |
7 | lb=[-0.3,-999,0];
8 | ub=[0.3,999,0.9];
9 |
10 | plotregion(A,b,lb,ub,[0.1,0.9,0.0]);
11 |
12 | axis equal
13 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/license.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009, Per Bergström
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above copyright
11 | notice, this list of conditions and the following disclaimer in
12 | the documentation and/or other materials provided with the distribution
13 |
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 | POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/plotregion.m:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/giaf/hpipm/c39c453bef3b78361d40af1ac6316c25e6171c33/experimental/andrea/prototype/code/plotregion/plotregion.m
--------------------------------------------------------------------------------
/experimental/andrea/prototype/code/plotregion/plotregion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/giaf/hpipm/c39c453bef3b78361d40af1ac6316c25e6171c33/experimental/andrea/prototype/code/plotregion/plotregion.png
--------------------------------------------------------------------------------
/include/hpipm_aux_mem.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 | #ifndef HPIPM_AUX_MEM_H_
37 | #define HPIPM_AUX_MEM_H_
38 |
39 | #include "hpipm_common.h"
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | void hpipm_zero_memset(hpipm_size_t memsize, void *mem);
46 |
47 | #ifdef __cplusplus
48 | } /* extern "C" */
49 | #endif
50 |
51 | #endif // HPIPM_AUX_MEM_H_
52 |
53 |
--------------------------------------------------------------------------------
/include/hpipm_aux_string.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 | #ifndef HPIPM_AUX_STRING_H_
37 | #define HPIPM_AUX_STRING_H_
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 | #define MAX_STR_LEN 5
44 | int hpipm_strcmp(char *str1, char *str2);
45 |
46 | #ifdef __cplusplus
47 | } /* extern "C" */
48 | #endif
49 |
50 | #endif // HPIPM_AUX_STRING_H_
51 |
--------------------------------------------------------------------------------
/include/hpipm_m_ocp_qp.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 |
37 |
38 | #include
39 | #include
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 | void m_cvt_d_ocp_qp_to_s_ocp_qp(struct d_ocp_qp *d_qp, struct s_ocp_qp *s_qp);
46 |
47 | #ifdef __cplusplus
48 | } /* extern "C" */
49 | #endif
50 |
--------------------------------------------------------------------------------
/include/hpipm_m_ocp_qp_kkt.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 | #ifdef __cplusplus
37 | extern "C" {
38 | #endif
39 |
40 | void m_fact_solve_kkt_step_hard_ocp_qp(struct d_ocp_qp *d_qp, struct s_ocp_qp *s_qp, struct m_ipm_hard_ocp_qp_workspace *ws);
41 | void m_solve_kkt_step_hard_ocp_qp(struct d_ocp_qp *d_qp, struct s_ocp_qp *s_qp, struct m_ipm_hard_ocp_qp_workspace *ws);
42 |
43 | #ifdef __cplusplus
44 | } /* extern "C" */
45 | #endif
46 |
--------------------------------------------------------------------------------
/include/hpipm_timing.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 | #ifndef HPIPM_TIMING_H_
37 | #define HPIPM_TIMING_H_
38 |
39 |
40 |
41 | #include
42 |
43 |
44 |
45 | #ifdef __cplusplus
46 | extern "C" {
47 | #endif
48 |
49 |
50 |
51 | typedef blasfeo_timer hpipm_timer;
52 |
53 |
54 |
55 | //
56 | void hpipm_tic(hpipm_timer *t);
57 | //
58 | double hpipm_toc(hpipm_timer *t);
59 |
60 |
61 |
62 | #ifdef __cplusplus
63 | } // #extern "C"
64 | #endif
65 |
66 |
67 | #endif // HPIPM_TIMING_H_
68 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/archive/hpipm_data.m:
--------------------------------------------------------------------------------
1 | function m_qp_data = hpipm_data()
2 | import hpipm_matlab.*
3 | hp = py.importlib.import_module('hpipm_python');
4 | py_qp_data = hp.hpipm_data();
5 | m_qp_data = py2m_obj(py_qp_data);
6 | end
7 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/archive/hpipm_dims.m:
--------------------------------------------------------------------------------
1 | function m_qp_dims = hpipm_dims()
2 | import hpipm_matlab.*
3 | hp = py.importlib.import_module('hpipm_python');
4 | py_qp_dims = hp.hpipm_dims();
5 | m_qp_dims = py2m_obj(py_qp_dims);
6 | end
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/archive/hpipm_solver.m:
--------------------------------------------------------------------------------
1 | classdef hpipm_solver
2 | properties
3 | py_hpipm_solver
4 | py_qp_data
5 | py_qp_dims
6 | end
7 |
8 | methods
9 | function obj = hpipm_solver(m_qp_dims, m_qp_data)
10 | import hpipm_matlab.*
11 | hp = py.importlib.import_module('hpipm_python');
12 | py_qp_dims = hp.hpipm_dims();
13 | obj.py_qp_dims = m2py_obj(m_qp_dims, py_qp_dims);
14 |
15 | py_qp_data = hp.hpipm_data();
16 | obj.py_qp_data = m2py_obj(m_qp_data, py_qp_data);
17 | obj.py_hpipm_solver = hp.hpipm_solver(py_qp_dims, py_qp_data);
18 | end
19 |
20 | function return_flag = solve(obj)
21 | return_flag = int64(obj.py_hpipm_solver.solve().real);
22 | end
23 |
24 | function print_sol(obj)
25 | obj.py_hpipm_solver.print_sol()
26 | end
27 | end
28 | end
29 |
30 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/archive/m2py_cell.m:
--------------------------------------------------------------------------------
1 | function py_list = m2py_cell(m_cell, np)
2 | n = length(m_cell);
3 | py_cell = cell(n, 1);
4 | for i = 1:n
5 | M = m_cell{i};
6 | np_array = hpipm_matlab.m2py(M, np);
7 | py_cell{i} = np_array;
8 | end
9 | py_list = py.list(py_cell.');
10 | end
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/archive/m2py_obj.m:
--------------------------------------------------------------------------------
1 | function py_obj = m2py_obj(m_obj, py_obj)
2 | np = py.importlib.import_module('numpy');
3 | import hpipm_matlab.*
4 | py_props = fieldnames(py_obj);
5 |
6 | for iprop = 1:length(py_props)
7 | py_thisprop = py_props{iprop};
8 | py_thisprop_value = py_obj.(py_thisprop);
9 |
10 | % TODO(andrea): py.NoneType not supported in Octave
11 | if ~isOctave()
12 | if py_thisprop_value ~= py.NoneType
13 | error(['Trying to assign to non-None attribute "', py_thisprop, '" in Python object.']);
14 | end
15 | end
16 | eval(['isempty_attr = isempty(m_obj.', py_thisprop, ');']);
17 | if ~isempty_attr
18 | eval(['attr_type = class(m_obj.', py_thisprop, ');']);
19 | switch attr_type
20 | case 'cell'
21 | try eval(['py_obj.', py_thisprop, '=', 'hpipm_matlab.m2py_cell(m_obj.', py_thisprop, ', np);']);
22 |
23 | catch
24 | error(['Cannot assign "', py_thisprop, '" to Pyton object.']);
25 | end
26 | case 'double'
27 | eval(['attr_size = sum(size(m_obj.', py_thisprop,'));']);
28 | if attr_size > 2
29 | try eval(['py_obj.', py_thisprop, '=', 'hpipm_matlab.m2py(m_obj.', py_thisprop, ', np);']);
30 |
31 | catch
32 | error(['Cannot assign "', py_thisprop, '" to Pyton object.']);
33 | end
34 | else
35 | try eval(['py_obj.', py_thisprop, '=', 'int32(m_obj.', py_thisprop, ');']);
36 |
37 | catch
38 | error(['Cannot assign "', py_thisprop, '" to Pyton object.']);
39 | end
40 | end
41 | end
42 | end
43 | eval(['m_thisprop_value = m_obj.', py_thisprop, ';'])
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/archive/py2m_obj.m:
--------------------------------------------------------------------------------
1 | function m_obj = py2m_obj(py_obj)
2 | import hpipm_matlab.*
3 | props = fieldnames(py_obj);
4 | for iprop = 1:length(props)
5 | thisprop = props{iprop};
6 | thisprop_value = py_obj.(thisprop);
7 |
8 | % TODO(andrea): py.NoneType not supported in Octave
9 | if ~isOctave()
10 | if thisprop_value ~= py.NoneType
11 | error('Can only convert python objects with all member values set to None')
12 | end
13 | end
14 |
15 | end
16 | n_props = length(props);
17 | empty_cell = cell(n_props, 1);
18 | m_obj = cell2struct(empty_cell, props, 1);
19 | end
20 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/hpipm_ocp_qp.m:
--------------------------------------------------------------------------------
1 | classdef hpipm_ocp_qp
2 |
3 |
4 |
5 | properties
6 | hp
7 | np
8 | py_qp
9 | end
10 |
11 |
12 |
13 | methods
14 |
15 |
16 | function obj = hpipm_ocp_qp(dims)
17 | obj.np = py.importlib.import_module('numpy');
18 | obj.hp = py.importlib.import_module('hpipm_python');
19 | obj.py_qp = obj.hp.hpipm_ocp_qp(dims.py_dims);
20 | end
21 |
22 |
23 | function set(obj, varargin)
24 | import hpipm_matlab.*
25 | if (length(varargin)==2)
26 | field = varargin{1};
27 | mat = varargin{2};
28 | py_mat = py.list({});
29 | for i=1:length(mat)
30 | mat0 = mat{i};
31 | py_mat.append(m2py(mat0, obj.np));
32 | end
33 | obj.py_qp.set(field, py_mat);
34 | else
35 | field = varargin{1};
36 | mat0 = varargin{2};
37 | idx = varargin{3};
38 | obj.py_qp.set(field, m2py(mat0, obj.np), int32(idx));
39 | end
40 | end
41 |
42 | function print_C_struct(obj)
43 | obj.py_qp.print_C_struct();
44 | end
45 |
46 | end
47 |
48 | end
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/hpipm_ocp_qp_dim.m:
--------------------------------------------------------------------------------
1 | classdef hpipm_ocp_qp_dim
2 |
3 | properties
4 | hp
5 | np
6 | py_dims
7 | end
8 |
9 | methods
10 |
11 | function obj = hpipm_ocp_qp_dim(N)
12 | obj.np = py.importlib.import_module('numpy');
13 | obj.hp = py.importlib.import_module('hpipm_python');
14 | obj.py_dims = obj.hp.hpipm_ocp_qp_dim(int32(N));
15 | end
16 |
17 | function set(obj, varargin)
18 | if(length(varargin)==2)
19 | field = varargin{1};
20 | n_dim = varargin{2};
21 | m = length(n_dim);
22 | py_n_dim = obj.np.zeros({int32(m), int32(1)}, obj.np.int32);
23 | for i=1:m
24 | py_n_dim.itemset(int32(i-1), int32(0), int32(n_dim(i)));
25 | end
26 | obj.py_dims.set(field, py_n_dim);
27 | else
28 | field = varargin{1};
29 | n_dim = varargin{2};
30 | idx = varargin{3};
31 | obj.py_dims.set(field, int32(n_dim), int32(idx));
32 | end
33 | end
34 |
35 | function print_C_struct(obj)
36 | obj.py_dims.print_C_struct();
37 | end
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/hpipm_ocp_qp_sol.m:
--------------------------------------------------------------------------------
1 | classdef hpipm_ocp_qp_sol
2 |
3 |
4 |
5 | properties
6 | hp
7 | np
8 | py_qp_sol
9 | end
10 |
11 |
12 |
13 | methods
14 |
15 |
16 | function obj = hpipm_ocp_qp_sol(dims)
17 | % import hpipm_matlab.*;
18 | obj.np = py.importlib.import_module('numpy');
19 | obj.hp = py.importlib.import_module('hpipm_python');
20 | obj.py_qp_sol = obj.hp.hpipm_ocp_qp_sol(dims.py_dims);
21 | end
22 |
23 |
24 | function u = get_u(obj, varargin)
25 | import hpipm_matlab.*
26 | if (length(varargin)==0)
27 | u = {};
28 | py_u = obj.py_qp_sol.get_u();
29 | shape = obj.np.shape(py_u);
30 | m = int64(shape{1});
31 | for ii=1:m
32 | u{ii} = py2m(py_u{ii}, obj.np);
33 | end
34 | else
35 | idx = varargin{1};
36 | py_u = obj.py_qp_sol.get_u(int32(idx));
37 | u = py2m(py_u, obj.np);
38 | end
39 | end
40 |
41 |
42 | function x = get_x(obj, varargin)
43 | import hpipm_matlab.*
44 | if (length(varargin)==0)
45 | x = {};
46 | py_x = obj.py_qp_sol.get_x();
47 | shape = obj.np.shape(py_x);
48 | m = int64(shape{1});
49 | for ii=1:m
50 | x{ii} = py2m(py_x{ii}, obj.np);
51 | end
52 | else
53 | idx = varargin{1};
54 | py_x = obj.py_qp_sol.get_x(int32(idx));
55 | x = py2m(py_x, obj.np);
56 | end
57 | end
58 |
59 |
60 | function print_C_struct(obj)
61 | obj.py_qp_sol.print_C_struct();
62 | end
63 |
64 |
65 | end
66 |
67 | end
68 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/hpipm_ocp_qp_solver.m:
--------------------------------------------------------------------------------
1 | classdef hpipm_ocp_qp_solver
2 |
3 |
4 |
5 | properties
6 | hp
7 | np
8 | py_arg
9 | py_solver
10 | end
11 |
12 |
13 |
14 | methods
15 |
16 |
17 | function obj = hpipm_ocp_qp_solver(dim, arg)
18 | % import hpipm_matlab.*;
19 | obj.np = py.importlib.import_module('numpy');
20 | obj.hp = py.importlib.import_module('hpipm_python');
21 | obj.py_solver = obj.hp.hpipm_ocp_qp_solver(dim.py_dims, arg.py_arg);
22 | obj.py_arg = arg.py_arg;
23 | end
24 |
25 |
26 | function return_flag = solve(obj, qp, qp_sol)
27 | py_flag = obj.py_solver.solve(qp.py_qp, qp_sol.py_qp_sol);
28 | return_flag = int64(py_flag.real);
29 | end
30 |
31 |
32 | function res = get_res_stat(obj)
33 | res = obj.py_solver.get_res_stat();
34 | end
35 |
36 |
37 | function res = get_res_eq(obj)
38 | res = obj.py_solver.get_res_eq();
39 | end
40 |
41 |
42 | function res = get_res_ineq(obj)
43 | res = obj.py_solver.get_res_ineq();
44 | end
45 |
46 |
47 | function res = get_res_comp(obj)
48 | res = obj.py_solver.get_res_comp();
49 | end
50 |
51 |
52 | function iters = get_iter(obj)
53 | py_iters = obj.py_solver.get_iter();
54 | iters = int64(py_iters.real);
55 | end
56 |
57 |
58 | function res = get_stat(obj)
59 | import hpipm_matlab.*;
60 | py_res = obj.py_solver.get_stat();
61 | res = py2m(py_res, obj.np);
62 | end
63 |
64 |
65 | end
66 |
67 | end
68 |
69 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/hpipm_ocp_qp_solver_arg.m:
--------------------------------------------------------------------------------
1 | classdef hpipm_ocp_qp_solver_arg
2 |
3 |
4 |
5 | properties
6 | hp
7 | np
8 | py_arg
9 | end
10 |
11 |
12 |
13 | methods
14 |
15 |
16 | function obj = hpipm_ocp_qp_solver_arg(dims)
17 | % import hpipm_matlab.*;
18 | obj.np = py.importlib.import_module('numpy');
19 | obj.hp = py.importlib.import_module('hpipm_python');
20 | obj.py_arg = obj.hp.hpipm_ocp_qp_solver_arg(dims.py_dims);
21 | end
22 |
23 |
24 | function set_mu0(obj, mu0)
25 | obj.py_arg.set_mu0(mu0);
26 | end
27 |
28 |
29 | function set_iter_max(obj, iter_max)
30 | obj.py_arg.set_iter_max(int32(iter_max));
31 | end
32 |
33 |
34 | function set_tol_stat(obj, tol_stat)
35 | obj.py_arg.set_tol_stat(tol_stat);
36 | end
37 |
38 |
39 | function set_tol_eq(obj, tol_eq)
40 | obj.py_arg.set_tol_eq(tol_eq);
41 | end
42 |
43 |
44 | function set_tol_ineq(obj, tol_ineq)
45 | obj.py_arg.set_tol_ineq(tol_ineq);
46 | end
47 |
48 |
49 | function set_tol_comp(obj, tol_comp)
50 | obj.py_arg.set_tol_comp(tol_comp);
51 | end
52 |
53 |
54 | function set_reg_prim(obj, reg_prim)
55 | obj.py_arg.set_reg_prim(reg_prim);
56 | end
57 |
58 |
59 | end
60 |
61 | end
62 |
63 |
64 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/isOctave.m:
--------------------------------------------------------------------------------
1 | function retval = isOctave
2 | persistent cacheval; % speeds up repeated calls
3 |
4 | if isempty (cacheval)
5 | cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
6 | end
7 |
8 | retval = cacheval;
9 | end
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/m2py.m:
--------------------------------------------------------------------------------
1 | function np_array = m2py(M, np)
2 | % m = size(M,1);
3 | % n = size(M,2);
4 | % np_array = np.zeros({int32(m), int32(n)});
5 | % itemset = np_array.itemset;
6 | % for i = 1:m
7 | % for j = 1:n
8 | %% np_array.itemset(int32(i-1), int32(j-1), double(M(i,j)));
9 | % itemset(int32(i-1), int32(j-1), double(M(i,j)));
10 | % end
11 | % end
12 | % this is faster but it needs transposition !!!
13 | tmp = M';
14 | np_array = np.array(tmp(:).');
15 | end
16 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/+hpipm_matlab/py2m.m:
--------------------------------------------------------------------------------
1 | function m_mat = py2m(py_array, np)
2 | % dim = py_array.shape;
3 | ndim = int64(np.ndim(py_array));
4 | shape = np.shape(py_array);
5 | % py_item = py_array.item();
6 | if (ndim==1)
7 | m = int64(shape{1});
8 | m_mat = zeros(m, 1);
9 | for ii=1:m
10 | m_mat(ii) = py_array.item(int32(ii-1));
11 | % m_mat(ii) = item(int32(ii-1));
12 | end
13 | else % ndim==2
14 | m = int64(shape{1});
15 | n = int64(shape{2});
16 | m_mat = zeros(m, n);
17 | for ii=1:m
18 | for jj=1:n
19 | m_mat(ii, jj) = py_array.item(int32(ii-1), int32(jj-1));
20 | % m_mat(ii, jj) = item(int32(ii-1), int32(jj-1));
21 | end
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/interfaces/archive/matlab/hpipm_matlab/octave_import.m:
--------------------------------------------------------------------------------
1 | function octave_import(varargin)
2 | % Import a package. Only entire packages can be imported currently.
3 | error(nargchk(1, inf, nargin, 'struct'));
4 | % Import the packages one-by-one
5 | for i=1:nargin
6 | import1(varargin{i});
7 | end
8 | end
9 |
10 | function import1(pkgname)
11 | % Split up name into parts
12 | pkgname_parts = strsplit(pkgname, '.');
13 | % Fallback to system import command if not entire package (i.e. failure)
14 | if length(pkgname_parts)~= 2 || ~strcmp(pkgname_parts{end}, '*')
15 | error('Only the syntax ''import package_name.*'' is currently supported')
16 | end
17 | % Get path for package
18 | pkgpath = locatepkg(pkgname_parts{1});
19 | % Add to path
20 | addpath(pkgpath);
21 | end
22 |
23 | function pkgpath = locatepkg(pkgname)
24 | pathdirs = strsplit(path, pathsep);
25 | for iPath=1:length(pathdirs)
26 | pkgpath = [pathdirs{iPath} filesep '+' pkgname];
27 | if exist(pkgpath, 'dir')
28 | return;
29 | end
30 | end
31 | error('Package ''%s'' cannot be located in the path', pkgname);
32 | end
33 |
--------------------------------------------------------------------------------
/interfaces/archive/octave/How_to_install_Octave.txt:
--------------------------------------------------------------------------------
1 | On an Ubuntu machine, open a terminal and type
2 |
3 | $ sudo apt-get install octave octave-control
4 |
5 | To install the tools to compile mex files in Octave, open a terminal and type
6 |
7 | $ sudo apt-get install liboctave-dev
8 |
--------------------------------------------------------------------------------
/interfaces/archive/octave/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 |
37 | all:
38 |
39 | clean:
40 | rm -f *.o
41 | rm -f *.mex
42 | rm -f libhpmpc.a
43 | rm -f octave-workspace
44 |
45 |
--------------------------------------------------------------------------------
/interfaces/archive/octave/create_ocp_qp_dims.m:
--------------------------------------------------------------------------------
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 | % %
3 | % This file is part of HPIPM. %
4 | % %
5 | % HPIPM -- High Performance Interior Point Method. %
6 | % Copyright (C) 2017 by Gianluca Frison. %
7 | % Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. %
8 | % All rights reserved. %
9 | % %
10 | % HPIPM is free software; you can redistribute it and/or %
11 | % modify it under the terms of the GNU Lesser General Public %
12 | % License as published by the Free Software Foundation; either %
13 | % version 2.1 of the License, or (at your option) any later version. %
14 | % %
15 | % HPIPM is distributed in the hope that it will be useful, %
16 | % but WITHOUT ANY WARRANTY; without even the implied warranty of %
17 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. %
18 | % See the GNU Lesser General Public License for more details. %
19 | % %
20 | % You should have received a copy of the GNU Lesser General Public %
21 | % License along with HPIPM; if not, write to the Free Software %
22 | % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA %
23 | % %
24 | % Author: Gianluca Frison, giaf (at) dtu.dk %
25 | % %
26 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 |
28 | function dims = create_ocp_qp_dims( N )
29 | % dims
30 |
31 | % control horizon
32 | dims.N = N;
33 | % number of states
34 | dims.nx = zeros(N+1, 1);
35 | % number of inputs
36 | dims.nu = zeros(N+1, 1);
37 | % number of state box constraints
38 | dims.nbx = zeros(N+1, 1);
39 | % number of input box constraints
40 | dims.nbu = zeros(N+1, 1);
41 | % number of general constraints
42 | dims.ng = zeros(N+1, 1);
43 | % number of soft constraints
44 | dims.ns = zeros(N+1, 1);
45 |
46 | return;
47 |
48 |
--------------------------------------------------------------------------------
/interfaces/archive/octave/is_octave.m:
--------------------------------------------------------------------------------
1 | % function to check if running in octave or matlab
2 | function r = is_octave()
3 | persistent x;
4 | if (isempty(x))
5 | x = exist( 'OCTAVE_VERSION', 'builtin');
6 | end
7 | r = x;
8 | end
9 |
10 |
--------------------------------------------------------------------------------
/interfaces/archive/octave/test_codgen_ocp_qp_data.m:
--------------------------------------------------------------------------------
1 | %
2 |
3 | % horizon length
4 | N = 5;
5 |
6 | % dims
7 | dims = create_ocp_qp_dims(N);
8 |
9 | % number of states
10 | for ii=1:N+1
11 | dims.nx(ii) = 2;
12 | end
13 | % number of inputs
14 | for ii=1:N
15 | dims.nu(ii) = 1;
16 | end
17 | % number of state box constraints
18 | for ii=1:N+1
19 | dims.nbx(ii) = dims.nx(ii);
20 | end
21 | % number of input box constraints
22 | for ii=1:N
23 | dims.nbu(ii) = dims.nu(ii);
24 | end
25 | % number of general constraints
26 | dims.ng(N+1) = 2;
27 | % number of general constraints which are softed
28 | dims.ns(N+1) = dims.ng(N+1);
29 |
30 | %dims
31 |
32 |
33 | % data
34 | %
35 | A = [1 1; 0 1];
36 | %
37 | B = [0; 1];
38 | %
39 | b = [0; 0];
40 | %
41 | Q = [1 0; 0 1];
42 | %
43 | S = [0 0];
44 | %
45 | R = [1];
46 | %
47 | q = [1; 1];
48 | %
49 | r = [0];
50 | %
51 | Jx0 = [1 0; 0 1];
52 | %
53 | x0 = [1; 1];
54 | %
55 | Jx = [1 0; 0 1];
56 | %
57 | lx = [-5; -5];
58 | %
59 | ux = [5; 5];
60 | %
61 | Ju = [1];
62 | %
63 | lu = [-0.5];
64 | %
65 | uu = [0.5];
66 | %
67 | CN = [1 0; 0 1];
68 | %
69 | lgN = [0; 0];
70 | %
71 | ugN = [0; 0];
72 | %
73 | ZlN = [1e6 0; 0 1e6];
74 | %
75 | ZuN = [1e6 0; 0 1e6];
76 | %
77 | zlN = [0; 0];
78 | %
79 | zuN = [0; 0];
80 | %
81 | JsgN = [1 0; 0 1];
82 |
83 | %
84 | slN = [1; 1];
85 | %
86 | suN = [1; 1];
87 |
88 |
89 | % qp
90 | %
91 | qp = create_ocp_qp(dims);
92 |
93 | % A
94 | for ii=1:N
95 | qp.A{ii} = A;
96 | end
97 | % B
98 | for ii=1:N
99 | qp.B{ii} = B;
100 | end
101 | % b
102 | for ii=1:N
103 | qp.b{ii} = b;
104 | end
105 | % Q
106 | for ii=1:N+1
107 | qp.Q{ii} = Q;
108 | end
109 | % R
110 | for ii=1:N
111 | qp.R{ii} = R;
112 | end
113 | % S
114 | for ii=1:N
115 | qp.S{ii} = S;
116 | end
117 | % q
118 | for ii=1:N+1
119 | qp.q{ii} = q;
120 | end
121 | % r
122 | for ii=1:N
123 | qp.r{ii} = r;
124 | end
125 | % Jx
126 | qp.Jx{1} = Jx0;
127 | for ii=2:N+1
128 | qp.Jx{ii} = Jx;
129 | end
130 | % lx
131 | qp.lx{1} = x0;
132 | for ii=2:N+1
133 | qp.lx{ii} = lx;
134 | end
135 | % ux
136 | qp.ux{1} = x0;
137 | for ii=2:N+1
138 | qp.ux{ii} = ux;
139 | end
140 | % Ju
141 | for ii=1:N
142 | qp.Ju{ii} = Ju;
143 | end
144 | % lu
145 | for ii=1:N
146 | qp.lu{ii} = lu;
147 | end
148 | % uu
149 | for ii=1:N
150 | qp.uu{ii} = uu;
151 | end
152 | %
153 | qp.C{N+1} = CN;
154 | %
155 | qp.lg{N+1} = lgN;
156 | %
157 | qp.ug{N+1} = ugN;
158 | %
159 | qp.Zl{N+1} = ZlN;
160 | %
161 | qp.Zu{N+1} = ZuN;
162 | %
163 | qp.zl{N+1} = zlN;
164 | %
165 | qp.zu{N+1} = zuN;
166 | %
167 | qp.Jsg{N+1} = JsgN;
168 |
169 | %qp
170 |
171 |
172 | % sol_guess
173 | %
174 | sol_guess = create_ocp_qp_sol(dims);
175 | %
176 | sol_guess.sl{N+1} = slN;
177 | %
178 | sol_guess.su{N+1} = suN;
179 |
180 |
181 | % codgen data
182 | codegen_ocp_qp_data(dims, qp, sol_guess);
183 |
184 |
--------------------------------------------------------------------------------
/interfaces/c/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 |
37 | include ../../Makefile.rule
38 |
39 | OBJS =
40 |
41 | ifeq ($(TARGET), GENERIC)
42 | OBJS +=
43 | endif
44 |
45 | # double
46 | OBJS += d_ocp_qp_solver.o
47 | # single
48 |
49 | obj: $(OBJS)
50 |
51 | clean:
52 | rm -f *.o
53 | rm -f *.s
54 |
55 | d_ocp_qp_solver.o: d_ocp_qp_solver.c x_ocp_qp_solver.c
56 |
57 |
--------------------------------------------------------------------------------
/interfaces/matlab_octave/cflags_octave.txt:
--------------------------------------------------------------------------------
1 | -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -std=c99
--------------------------------------------------------------------------------
/interfaces/matlab_octave/dense_qp_destroy.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 | // system
36 | #include
37 | #include
38 | #include
39 | // hpipm
40 | #include "hpipm_d_dense_qp.h"
41 | // mex
42 | #include "mex.h"
43 |
44 |
45 |
46 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
47 | {
48 |
49 | // mexPrintf("\nin dense_qp_destroy\n");
50 |
51 | long long *ptr;
52 |
53 | /* RHS */
54 |
55 | // qp_mem
56 | ptr = (long long *) mxGetData( prhs[0] );
57 | free( (void *) ptr[0] );
58 |
59 | return;
60 |
61 | }
62 |
63 |
64 |
--------------------------------------------------------------------------------
/interfaces/matlab_octave/env.m:
--------------------------------------------------------------------------------
1 | % Matlab file to replace env.sh to allow compile_mex_all.m to run on Windows
2 | % Len van Moorsel
3 | % 2021
4 |
5 | %% set environment variables, that are originally set in env.sh
6 |
7 | % set paths to folders used by HPIPM
8 | setenv('HPIPM_MAIN_FOLDER',fileparts(fileparts(pwd))); % "$(pwd)/../.."
9 | disp([' set HPIPM_MAIN_FOLDER to: ', getenv('HPIPM_MAIN_FOLDER')])
10 |
11 | setenv('BLASFEO_MAIN_FOLDER',[fileparts(fileparts(fileparts(pwd))),'/blasfeo']); % "$(pwd)/../../../blasfeo"
12 | disp([' set BLASFEO_MAIN_FOLDER to: ', getenv('BLASFEO_MAIN_FOLDER')])
13 |
14 | matlabpath = [getenv('HPIPM_MAIN_FOLDER'),'/interfaces/matlab_octave/']; % $HPIPM_MAIN_FOLDER/interfaces/matlab_octave/
15 | if (getenv('MATLABPATH') == "") % if empty, set path
16 | setenv('MATLABPATH', matlabpath);
17 | disp([' set MATLABPATH to: ', getenv('MATLABPATH')])
18 | else % else, append path
19 | setenv('MATLABPATH',[getenv('MATLABPATH'),';',matlabpath]);
20 | disp([' appended MATLABPATH to: ', getenv('MATLABPATH')])
21 | end
22 |
23 | octave_path = [getenv('HPIPM_MAIN_FOLDER'),'/interfaces/matlab_octave/']; % $HPIPM_MAIN_FOLDER/interfaces/matlab_octave/
24 | if (getenv('OCTAVE_PATH') == "") % if empty, set path
25 | setenv('OCTAVE_PATH', octave_path);
26 | disp([' set OCTAVE_PATH to: ', getenv('OCTAVE_PATH')])
27 | else % else, append path
28 | setenv('OCTAVE_PATH',[getenv('OCTAVE_PATH'),';',octave_path]);
29 | disp([' appended OCTAVE_PATH to: ', getenv('OCTAVE_PATH')])
30 | end
31 |
32 | ld_library_path = [[getenv('HPIPM_MAIN_FOLDER'),'/lib/'],';',[getenv('BLASFEO_MAIN_FOLDER'),'/lib/']]; % $HPIPM_MAIN_FOLDER/lib:$BLASFEO_MAIN_FOLDER/lib
33 | if (getenv('LD_LIBRARY_PATH') == "") % if empty, set path
34 | setenv('LD_LIBRARY_PATH', ld_library_path);
35 | disp([' set LD_LIBRARY_PATH to: ', getenv('LD_LIBRARY_PATH')])
36 | else % else, append path
37 | setenv('LD_LIBRARY_PATH',[getenv('LD_LIBRARY_PATH'),';',ld_library_path]);
38 | disp([' appended LD_LIBRARY_PATH to: ', getenv('LD_LIBRARY_PATH')])
39 | end
40 |
41 | % set environment run variable to true to indicate this script was run
42 | setenv('ENV_RUN','true')
--------------------------------------------------------------------------------
/interfaces/matlab_octave/env.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/bash
2 |
3 | if [[ "${BASH_SOURCE[0]}" != "${0}" ]]
4 | then
5 | echo "Script is being sourced"
6 | else
7 | echo "ERROR: Script is a subshell"
8 | echo "To affect your current shell enviroment source this script with:"
9 | echo "source env.sh"
10 | exit
11 | fi
12 |
13 | # check that this file is run
14 | export ENV_RUN=true
15 |
16 | # if hpipm folder not specified assume parent of this folder
17 | HPIPM_MAIN_FOLDER=${HPIPM_MAIN_FOLDER:-"$(pwd)/../.."}
18 | export HPIPM_MAIN_FOLDER
19 | echo
20 | echo "HPIPM_MAIN_FOLDER=$HPIPM_MAIN_FOLDER"
21 |
22 | # if blasfeo folder not specified assume alongside the parent of this folder
23 | BLASFEO_MAIN_FOLDER=${BLASFEO_MAIN_FOLDER:-"$(pwd)/../../../blasfeo"}
24 | #BLASFEO_MAIN_FOLDER=${BLASFEO_MAIN_FOLDER:-"/opt/blasfeo"}
25 | export BLASFEO_MAIN_FOLDER
26 | echo
27 | echo "BLASFEO_MAIN_FOLDER=$BLASFEO_MAIN_FOLDER"
28 |
29 | # export matlab_octave_mex folder
30 | # MATLAB case
31 | export MATLABPATH=$MATLABPATH:$HPIPM_MAIN_FOLDER/interfaces/matlab_octave/
32 | echo
33 | echo "MATLABPATH=$MATLABPATH"
34 | # Octave case
35 | export OCTAVE_PATH=$OCTAVE_PATH:$HPIPM_MAIN_FOLDER/interfaces/matlab_octave/
36 | echo
37 | echo "OCTAVE_PATH=$OCTAVE_PATH"
38 |
39 | #export HPIPM_MEX_FLAGS="GCC=/usr/bin/gcc-4.9"
40 |
41 | # export LD_LIBRARY_PATH
42 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HPIPM_MAIN_FOLDER/lib:$BLASFEO_MAIN_FOLDER/lib
43 | echo
44 | echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
45 |
--------------------------------------------------------------------------------
/interfaces/matlab_octave/is_octave.m:
--------------------------------------------------------------------------------
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 | % %
3 | % This file is part of HPIPM. %
4 | % %
5 | % HPIPM -- High-Performance Interior Point Method. %
6 | % Copyright (C) 2019 by Gianluca Frison. %
7 | % Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. %
8 | % All rights reserved. %
9 | % %
10 | % The 2-Clause BSD License %
11 | % %
12 | % Redistribution and use in source and binary forms, with or without %
13 | % modification, are permitted provided that the following conditions are met: %
14 | % %
15 | % 1. Redistributions of source code must retain the above copyright notice, this %
16 | % list of conditions and the following disclaimer. %
17 | % 2. Redistributions in binary form must reproduce the above copyright notice, %
18 | % this list of conditions and the following disclaimer in the documentation %
19 | % and/or other materials provided with the distribution. %
20 | % %
21 | % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND %
22 | % ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED %
23 | % WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE %
24 | % DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR %
25 | % ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES %
26 | % (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; %
27 | % LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND %
28 | % ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT %
29 | % (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS %
30 | % SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %
31 | % %
32 | % Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de %
33 | % %
34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 | % function to check if running in octave or matlab
36 | function r = is_octave()
37 | persistent x;
38 | if (isempty(x))
39 | x = exist( 'OCTAVE_VERSION', 'builtin');
40 | end
41 | r = x;
42 | end
43 |
44 |
--------------------------------------------------------------------------------
/interfaces/matlab_octave/ocp_qcqp_destroy.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 | // system
36 | #include
37 | #include
38 | #include
39 | // hpipm
40 | #include "hpipm_d_ocp_qcqp.h"
41 | // mex
42 | #include "mex.h"
43 |
44 |
45 |
46 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
47 | {
48 |
49 | // mexPrintf("\nin ocp_qcqp_destroy\n");
50 |
51 | long long *ptr;
52 |
53 | /* RHS */
54 |
55 | // qp_mem
56 | ptr = (long long *) mxGetData( prhs[0] );
57 | free( (void *) ptr[0] );
58 |
59 | return;
60 |
61 | }
62 |
63 |
64 |
--------------------------------------------------------------------------------
/interfaces/matlab_octave/ocp_qp_destroy.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 | // system
36 | #include
37 | #include
38 | #include
39 | // hpipm
40 | #include "hpipm_d_ocp_qp.h"
41 | // mex
42 | #include "mex.h"
43 |
44 |
45 |
46 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
47 | {
48 |
49 | // mexPrintf("\nin ocp_qp_destroy\n");
50 |
51 | long long *ptr;
52 |
53 | /* RHS */
54 |
55 | // qp_mem
56 | ptr = (long long *) mxGetData( prhs[0] );
57 | free( (void *) ptr[0] );
58 |
59 | return;
60 |
61 | }
62 |
63 |
64 |
--------------------------------------------------------------------------------
/interfaces/python/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 | #PIP = pip
37 | PIP = pip3
38 |
39 | all:
40 | cd hpipm_python ; $(PIP) install . ; cd ..
41 |
--------------------------------------------------------------------------------
/interfaces/python/hpipm_python/hpipm_python/__init__.py:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 | from . import wrapper
37 | from .common import *
38 |
--------------------------------------------------------------------------------
/interfaces/python/hpipm_python/setup.py:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 | from setuptools import setup, find_packages
37 |
38 | import hpipm_python
39 |
40 | setup(name='hpipm-python',
41 | version='0.2',
42 | description='Python interface to HPIPM',
43 | url='http://github.com/giaf/hpipm',
44 | author='Andrea Zanelli - Gianluca Frison',
45 | license='BSD-2',
46 | packages = find_packages(),
47 | zip_safe=False)
48 |
--------------------------------------------------------------------------------
/interfaces/simulink/README.md:
--------------------------------------------------------------------------------
1 | The Simulink interface of HPIPM consists of a single C file which defines the S-Function to be used together with the generated C code containing the QP data. For more details, please
2 | look at the Simulink example.
3 |
--------------------------------------------------------------------------------
/ipm_core/d_core_qp_ipm.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 |
37 |
38 | #if defined(RUNTIME_CHECKS)
39 | #include
40 | #include
41 | #endif
42 |
43 | #include "../include/hpipm_d_core_qp_ipm.h"
44 | #include "../include/hpipm_d_core_qp_ipm_aux.h"
45 |
46 |
47 |
48 | #define CORE_QP_IPM_WORKSPACE d_core_qp_ipm_workspace
49 | #define REAL double
50 |
51 | #define MEMSIZE_CORE_QP_IPM d_memsize_core_qp_ipm
52 | #define CREATE_CORE_QP_IPM d_create_core_qp_ipm
53 |
54 |
55 |
56 | #include "x_core_qp_ipm.c"
57 |
--------------------------------------------------------------------------------
/ipm_core/s_core_qp_ipm.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 |
37 |
38 | #if defined(RUNTIME_CHECKS)
39 | #include
40 | #include
41 | #endif
42 |
43 | #include "../include/hpipm_s_core_qp_ipm.h"
44 | #include "../include/hpipm_s_core_qp_ipm_aux.h"
45 |
46 |
47 |
48 | #define CORE_QP_IPM_WORKSPACE s_core_qp_ipm_workspace
49 | #define REAL float
50 |
51 | #define MEMSIZE_CORE_QP_IPM s_memsize_core_qp_ipm
52 | #define CREATE_CORE_QP_IPM s_create_core_qp_ipm
53 |
54 |
55 |
56 | #include "x_core_qp_ipm.c"
57 |
58 |
--------------------------------------------------------------------------------
/lib/dummy.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/giaf/hpipm/c39c453bef3b78361d40af1ac6316c25e6171c33/lib/dummy.txt
--------------------------------------------------------------------------------
/sim_core/Makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 |
37 | include ../Makefile.rule
38 |
39 | OBJS =
40 |
41 | ifeq ($(TARGET), GENERIC)
42 | OBJS +=
43 | endif
44 |
45 | # double
46 | OBJS += d_sim_rk.o
47 | OBJS += d_sim_erk.o
48 | #single
49 | OBJS += s_sim_rk.o
50 | OBJS += s_sim_erk.o
51 |
52 | obj: $(OBJS)
53 |
54 | clean:
55 | rm -f *.o
56 | rm -f *.s
57 |
58 | d_sim_rk.o: d_sim_rk.c x_sim_rk.c
59 | s_sim_rk.o: s_sim_rk.c x_sim_rk.c
60 | d_sim_erk.o: d_sim_erk.c x_sim_erk.c
61 | s_sim_erk.o: s_sim_erk.c x_sim_erk.c
62 |
--------------------------------------------------------------------------------
/sim_core/d_sim_rk.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 |
37 |
38 | #include
39 | #include
40 |
41 | #include
42 | #include
43 |
44 |
45 |
46 | #define REAL double
47 | #define SIM_RK_DATA d_sim_rk_data
48 |
49 |
50 |
51 | #define SIM_RK_DATA_MEMSIZE d_sim_rk_data_memsize
52 | #define SIM_RK_DATA_CREATE d_sim_rk_data_create
53 | #define SIM_RK_DATA_INIT_DEFAULT d_sim_rk_data_init_default
54 | #define SIM_RK_DATA_SET_ALL d_sim_rk_data_set_all
55 |
56 |
57 |
58 | #include "x_sim_rk.c"
59 |
--------------------------------------------------------------------------------
/sim_core/s_sim_rk.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
36 |
37 |
38 | #include
39 | #include
40 |
41 | #include
42 | #include
43 |
44 |
45 |
46 | #define REAL float
47 | #define SIM_RK_DATA s_sim_rk_data
48 |
49 |
50 |
51 | #define SIM_RK_DATA_MEMSIZE s_sim_rk_data_memsize
52 | #define SIM_RK_DATA_CREATE s_sim_rk_data_create
53 | #define SIM_RK_DATA_INIT_DEFAULT s_sim_rk_data_init_default
54 | #define SIM_RK_DATA_SET_ALL s_sim_rk_data_set_all
55 |
56 |
57 |
58 | #include "x_sim_rk.c"
59 |
60 |
61 |
--------------------------------------------------------------------------------
/utils/change_lic.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | #for file in `find test_problems/ -name "*.h"`; do echo $file; done
4 |
5 | #for file in `find auxiliary/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
6 | #for file in `find cond/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
7 | #for file in `find dense_qp/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
8 | #for file in `find ipm_core/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
9 | #for file in `find ocp_qp/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
10 | #for file in `find tree_ocp_qp/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
11 | #for file in `find include/ -name "*.h"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
12 | #for file in `find benchmark/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
13 | #for file in `find benchmark/ -name "*.h"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
14 | #for file in `find test_problems/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
15 | #for file in `find test_problems/ -name "*.h"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
16 | #for file in `find . -name "Makefile*"`; do cat utils/new_lic_makefile > temp && tail -n +35 $file >> temp && cat temp > $file; done
17 |
18 | #for file in `find interfaces/matlab_octave/ -name "*.c"`; do cat utils/new_lic_c > temp && tail -n +35 $file >> temp && cat temp > $file; done
19 | #for file in `find interfaces/matlab_octave/ -name "*.m"`; do cat utils/new_lic_matlab > temp && tail -n +35 $file >> temp && cat temp > $file; done
20 | #for file in `find examples/matlab_octave/ -name "*.m"`; do cat utils/new_lic_matlab > temp && tail -n +35 $file >> temp && cat temp > $file; done
21 |
22 | #for file in `find interfaces/python/ -name "*.py"`; do cat utils/new_lic_python > temp && tail -n +35 $file >> temp && cat temp > $file; done
23 | #for file in `find examples/python/ -name "*.py"`; do cat utils/new_lic_python > temp && tail -n +35 $file >> temp && cat temp > $file; done
24 |
--------------------------------------------------------------------------------
/utils/new_lic_c:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | * *
3 | * This file is part of HPIPM. *
4 | * *
5 | * HPIPM -- High-Performance Interior Point Method. *
6 | * Copyright (C) 2019 by Gianluca Frison. *
7 | * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. *
8 | * All rights reserved. *
9 | * *
10 | * The 2-Clause BSD License *
11 | * *
12 | * Redistribution and use in source and binary forms, with or without *
13 | * modification, are permitted provided that the following conditions are met: *
14 | * *
15 | * 1. Redistributions of source code must retain the above copyright notice, this *
16 | * list of conditions and the following disclaimer. *
17 | * 2. Redistributions in binary form must reproduce the above copyright notice, *
18 | * this list of conditions and the following disclaimer in the documentation *
19 | * and/or other materials provided with the distribution. *
20 | * *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
31 | * *
32 | * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de *
33 | * *
34 | **************************************************************************************************/
35 |
--------------------------------------------------------------------------------
/utils/new_lic_makefile:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
36 |
--------------------------------------------------------------------------------
/utils/new_lic_matlab:
--------------------------------------------------------------------------------
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 | % %
3 | % This file is part of HPIPM. %
4 | % %
5 | % HPIPM -- High-Performance Interior Point Method. %
6 | % Copyright (C) 2019 by Gianluca Frison. %
7 | % Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. %
8 | % All rights reserved. %
9 | % %
10 | % The 2-Clause BSD License %
11 | % %
12 | % Redistribution and use in source and binary forms, with or without %
13 | % modification, are permitted provided that the following conditions are met: %
14 | % %
15 | % 1. Redistributions of source code must retain the above copyright notice, this %
16 | % list of conditions and the following disclaimer. %
17 | % 2. Redistributions in binary form must reproduce the above copyright notice, %
18 | % this list of conditions and the following disclaimer in the documentation %
19 | % and/or other materials provided with the distribution. %
20 | % %
21 | % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND %
22 | % ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED %
23 | % WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE %
24 | % DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR %
25 | % ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES %
26 | % (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; %
27 | % LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND %
28 | % ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT %
29 | % (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS %
30 | % SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %
31 | % %
32 | % Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de %
33 | % %
34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 |
--------------------------------------------------------------------------------
/utils/new_lic_python:
--------------------------------------------------------------------------------
1 | ###################################################################################################
2 | # #
3 | # This file is part of HPIPM. #
4 | # #
5 | # HPIPM -- High-Performance Interior Point Method. #
6 | # Copyright (C) 2019 by Gianluca Frison. #
7 | # Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
8 | # All rights reserved. #
9 | # #
10 | # The 2-Clause BSD License #
11 | # #
12 | # Redistribution and use in source and binary forms, with or without #
13 | # modification, are permitted provided that the following conditions are met: #
14 | # #
15 | # 1. Redistributions of source code must retain the above copyright notice, this #
16 | # list of conditions and the following disclaimer. #
17 | # 2. Redistributions in binary form must reproduce the above copyright notice, #
18 | # this list of conditions and the following disclaimer in the documentation #
19 | # and/or other materials provided with the distribution. #
20 | # #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #
22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #
23 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
24 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR #
25 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
26 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
27 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #
28 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
30 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
31 | # #
32 | # Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
33 | # #
34 | ###################################################################################################
35 |
--------------------------------------------------------------------------------
/version.txt:
--------------------------------------------------------------------------------
1 | 0.1.3
2 |
--------------------------------------------------------------------------------