casadi 3.6.5__cp38-none-manylinux2014_aarch64.whl → 3.6.7__cp38-none-manylinux2014_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- casadi/_casadi.so +0 -0
- casadi/casadi.py +739 -308
- casadi/cmake/alpaqa/alpaqaConfigVersion.cmake +0 -5
- casadi/cmake/alpaqa/alpaqaTargets.cmake +1 -1
- casadi/cmake/casadi-config-version.cmake +1 -1
- casadi/cmake/casadi-targets.cmake +1 -1
- casadi/cmake/osqp/osqp-targets.cmake +1 -1
- casadi/cmake/proxsuite/proxsuiteConfigVersion.cmake +0 -5
- casadi/cmake/proxsuite/proxsuiteTargets.cmake +1 -1
- casadi/cmake/qdldl/qdldl-targets.cmake +1 -1
- casadi/include/casadi/casadi.i +3 -0
- casadi/include/casadi/casadi_c.h +2 -0
- casadi/include/casadi/config.h +8 -8
- casadi/include/casadi/core/casadi_common.hpp +1 -0
- casadi/include/casadi/core/casadi_misc.hpp +52 -0
- casadi/include/casadi/core/casadi_types.hpp +3 -2
- casadi/include/casadi/core/code_generator.hpp +30 -1
- casadi/include/casadi/core/global_options.hpp +2 -0
- casadi/include/casadi/core/mx.hpp +18 -3
- casadi/include/casadi/core/optistack.hpp +23 -0
- casadi/include/casadi/core/runtime/casadi_nlp.hpp +19 -4
- casadi/include/casadi/core/runtime/casadi_ocp_block.hpp +55 -0
- casadi/include/casadi/core/runtime/casadi_oracle.hpp +44 -0
- casadi/include/casadi/core/runtime/casadi_oracle_callback.hpp +39 -0
- casadi/include/casadi/core/runtime/casadi_runtime.hpp +4 -1
- casadi/include/casadi/core/runtime/casadi_scaled_copy.hpp +31 -0
- casadi/include/casadi/core/serializing_stream.hpp +2 -2
- casadi/include/casadi/core/sparsity.hpp +7 -0
- casadi/include/casadi/doc.i +1513 -1016
- casadi/include/casadi/doc_merged.i +965 -719
- casadi/include/casadi/mem.h +1 -0
- casadi/include/daqp/api.h +46 -0
- casadi/include/daqp/auxiliary.h +29 -0
- casadi/include/daqp/bnb.h +32 -0
- casadi/include/daqp/codegen.h +18 -0
- casadi/include/daqp/constants.h +92 -0
- casadi/include/daqp/daqp.h +22 -0
- casadi/include/daqp/daqp_prox.h +18 -0
- casadi/include/daqp/factorization.h +18 -0
- casadi/include/daqp/types.h +161 -0
- casadi/include/daqp/utils.h +44 -0
- casadi/include/fatrop/auxiliary/Common.hpp +34 -0
- casadi/include/fatrop/auxiliary/DynamicLib.hpp +34 -0
- casadi/include/fatrop/auxiliary/FatropOptions.hpp +68 -0
- casadi/include/fatrop/auxiliary/FatropVector.hpp +143 -0
- casadi/include/fatrop/auxiliary/LinearAlgebra.hpp +88 -0
- casadi/include/fatrop/auxiliary/VectorUtils.hpp +54 -0
- casadi/include/fatrop/blasfeo_wrapper/LinearAlgebraBlasfeo.hpp +493 -0
- casadi/include/fatrop/fatrop.hpp +39 -0
- casadi/include/fatrop/function_evaluation/CasadiCodegen.hpp +104 -0
- casadi/include/fatrop/function_evaluation/FunctionEvaluation.hpp +60 -0
- casadi/include/fatrop/json/json.h +946 -0
- casadi/include/fatrop/ocp/CasadiCApiUserdataWrap.hpp +87 -0
- casadi/include/fatrop/ocp/DuInfEvaluator.hpp +38 -0
- casadi/include/fatrop/ocp/FatropOCP.hpp +161 -0
- casadi/include/fatrop/ocp/FatropOCPBuilder.hpp +52 -0
- casadi/include/fatrop/ocp/FatropOCPResto.hpp +299 -0
- casadi/include/fatrop/ocp/OCP.hpp +82 -0
- casadi/include/fatrop/ocp/OCPAbstract.hpp +254 -0
- casadi/include/fatrop/ocp/OCPAdapter.hpp +197 -0
- casadi/include/fatrop/ocp/OCPCInterface.h +289 -0
- casadi/include/fatrop/ocp/OCPDims.hpp +60 -0
- casadi/include/fatrop/ocp/OCPInitializer.hpp +41 -0
- casadi/include/fatrop/ocp/OCPKKT.hpp +69 -0
- casadi/include/fatrop/ocp/OCPLSRiccati.hpp +198 -0
- casadi/include/fatrop/ocp/OCPLSScaler.hpp +66 -0
- casadi/include/fatrop/ocp/OCPLinearSolver.hpp +75 -0
- casadi/include/fatrop/ocp/OCPNoScaling.hpp +42 -0
- casadi/include/fatrop/ocp/OCPScalingMethod.hpp +42 -0
- casadi/include/fatrop/ocp/StageOCP.hpp +592 -0
- casadi/include/fatrop/ocp/StageOCPApplication.hpp +242 -0
- casadi/include/fatrop/ocp/StageOCPExpressions.hpp +182 -0
- casadi/include/fatrop/ocp/UStageEvalAbstract.hpp +168 -0
- casadi/include/fatrop/ocp/UStageOCPImpl.hpp +152 -0
- casadi/include/fatrop/quasi_newton/bfgs.hpp +159 -0
- casadi/include/fatrop/solver/AlgBuilder.hpp +76 -0
- casadi/include/fatrop/solver/AlgStrategy.hpp +33 -0
- casadi/include/fatrop/solver/FatropAlg.hpp +121 -0
- casadi/include/fatrop/solver/FatropData.hpp +188 -0
- casadi/include/fatrop/solver/FatropOptions.hpp +95 -0
- casadi/include/fatrop/solver/FatropPrinter.hpp +65 -0
- casadi/include/fatrop/solver/FatropStats.hpp +63 -0
- casadi/include/fatrop/solver/Filter.hpp +54 -0
- casadi/include/fatrop/solver/IterationData.hpp +56 -0
- casadi/include/fatrop/solver/LineSearch.hpp +86 -0
- casadi/include/fatrop/solver/NLPL1.hpp +263 -0
- casadi/include/fatrop/templates/NLPAlg.hpp +104 -0
- casadi/include/licenses/daqp-external/LICENSE +21 -0
- casadi/include/licenses/fatrop-external/LICENSE.txt +165 -0
- casadi/include/licenses/fatrop-external/external/blasfeo/LICENSE.txt +26 -0
- casadi/include/licenses/fatrop-external/external/pybind11/LICENSE +29 -0
- casadi/include/osqp/constants.h +2 -3
- casadi/include/osqp/version.h +9 -0
- casadi/lib/cmake/tinyxml2/tinyxml2-config-version.cmake +0 -5
- casadi/lib/cmake/tinyxml2/tinyxml2-static-targets.cmake +1 -1
- casadi/libcasadi.so +0 -0
- casadi/libcasadi.so.3.7 +0 -0
- casadi/libcasadi_conic_cplex.so +0 -0
- casadi/libcasadi_conic_cplex.so.3.7 +0 -0
- casadi/libcasadi_conic_daqp.so +0 -0
- casadi/libcasadi_conic_daqp.so.3.7 +0 -0
- casadi/libcasadi_conic_fatrop.so +0 -0
- casadi/libcasadi_conic_fatrop.so.3.7 +0 -0
- casadi/libcasadi_conic_gurobi.so +0 -0
- casadi/libcasadi_conic_gurobi.so.3.7 +0 -0
- casadi/libcasadi_conic_hpipm.so +0 -0
- casadi/libcasadi_conic_hpipm.so.3.7 +0 -0
- casadi/libcasadi_conic_ipqp.so +0 -0
- casadi/libcasadi_conic_ipqp.so.3.7 +0 -0
- casadi/libcasadi_conic_nlpsol.so +0 -0
- casadi/libcasadi_conic_nlpsol.so.3.7 +0 -0
- casadi/libcasadi_conic_osqp.so +0 -0
- casadi/libcasadi_conic_osqp.so.3.7 +0 -0
- casadi/libcasadi_conic_proxqp.so +0 -0
- casadi/libcasadi_conic_proxqp.so.3.7 +0 -0
- casadi/libcasadi_conic_qpoases.so +0 -0
- casadi/libcasadi_conic_qpoases.so.3.7 +0 -0
- casadi/libcasadi_conic_qrqp.so +0 -0
- casadi/libcasadi_conic_qrqp.so.3.7 +0 -0
- casadi/libcasadi_conic_superscs.so +0 -0
- casadi/libcasadi_conic_superscs.so.3.7 +0 -0
- casadi/libcasadi_integrator_collocation.so +0 -0
- casadi/libcasadi_integrator_collocation.so.3.7 +0 -0
- casadi/libcasadi_integrator_cvodes.so +0 -0
- casadi/libcasadi_integrator_cvodes.so.3.7 +0 -0
- casadi/libcasadi_integrator_idas.so +0 -0
- casadi/libcasadi_integrator_idas.so.3.7 +0 -0
- casadi/libcasadi_integrator_rk.so +0 -0
- casadi/libcasadi_integrator_rk.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_alpaqa.so +0 -0
- casadi/libcasadi_nlpsol_alpaqa.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_ampl.so +0 -0
- casadi/libcasadi_nlpsol_ampl.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_blocksqp.so +0 -0
- casadi/libcasadi_nlpsol_blocksqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_fatrop.so +0 -0
- casadi/libcasadi_nlpsol_fatrop.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.so +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_ipopt.so +0 -0
- casadi/libcasadi_nlpsol_ipopt.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_knitro.so +0 -0
- casadi/libcasadi_nlpsol_knitro.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_madnlp.so +0 -0
- casadi/libcasadi_nlpsol_madnlp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_qrsqp.so +0 -0
- casadi/libcasadi_nlpsol_qrsqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_scpgen.so +0 -0
- casadi/libcasadi_nlpsol_scpgen.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_snopt.so +0 -0
- casadi/libcasadi_nlpsol_snopt.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.so +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_worhp.so +0 -0
- casadi/libcasadi_nlpsol_worhp.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_fast_newton.so +0 -0
- casadi/libcasadi_rootfinder_fast_newton.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_kinsol.so +0 -0
- casadi/libcasadi_rootfinder_kinsol.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_newton.so +0 -0
- casadi/libcasadi_rootfinder_newton.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_nlpsol.so +0 -0
- casadi/libcasadi_rootfinder_nlpsol.so.3.7 +0 -0
- casadi/libcasadi_sundials_common.so +0 -0
- casadi/libcasadi_sundials_common.so.3.7 +0 -0
- casadi/libcoinmetis.la +1 -1
- casadi/libcoinmetis.so +0 -0
- casadi/libcoinmetis.so.2 +0 -0
- casadi/libcoinmetis.so.2.0.0 +0 -0
- casadi/libdaqp.so +0 -0
- casadi/libdaqpstat.a +0 -0
- casadi/libfatrop.so +0 -0
- casadi/libmatlab_ipc.so +0 -0
- casadi/libosqp.a +0 -0
- casadi/libosqp.so +0 -0
- casadi/pkgconfig/casadi.pc +1 -1
- casadi/tools/__init__.py +4 -0
- casadi/tools/bounds.py +3 -3
- {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/METADATA +2 -2
- {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/RECORD +181 -104
- {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/WHEEL +0 -0
@@ -0,0 +1,188 @@
|
|
1
|
+
/*
|
2
|
+
* Fatrop - A fast trajectory optimization solver
|
3
|
+
* Copyright (C) 2022 - 2024 Lander Vanroye, KU Leuven. All rights reserved.
|
4
|
+
*
|
5
|
+
* This file is part of Fatrop.
|
6
|
+
*
|
7
|
+
* Fatrop is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* Fatrop is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
18
|
+
* along with Fatrop. If not, see <http://www.gnu.org/licenses/>. */
|
19
|
+
|
20
|
+
// solver data
|
21
|
+
#ifndef FATROPDATAINCLUDED
|
22
|
+
#define FATROPDATAINCLUDED
|
23
|
+
#include "fatrop/blasfeo_wrapper/LinearAlgebraBlasfeo.hpp"
|
24
|
+
#include "fatrop/templates/NLPAlg.hpp"
|
25
|
+
#include "fatrop/auxiliary/Common.hpp"
|
26
|
+
#include "FatropOptions.hpp"
|
27
|
+
#include "fatrop/solver/FatropPrinter.hpp"
|
28
|
+
#include <cmath>
|
29
|
+
#include <memory>
|
30
|
+
namespace fatrop
|
31
|
+
{
|
32
|
+
#define CACHEMACRO(instance, val) instance.evaluated ? instance.value : instance.SetValue(val)
|
33
|
+
struct FatropData
|
34
|
+
{
|
35
|
+
FatropData(const NLPDims &nlpdims, const std::shared_ptr<FatropOptions> ¶ms, const std::shared_ptr<FatropPrinter> &printer);
|
36
|
+
void initialize();
|
37
|
+
fatrop_int reset();
|
38
|
+
fatrop_int reset_caches();
|
39
|
+
double e_mu_curr(double mu);
|
40
|
+
fatrop_int eval_dual_inf_slack_eqs();
|
41
|
+
double eval_compl_slack(double mu);
|
42
|
+
double eval_barrier_func(double mu, VEC *s_p);
|
43
|
+
double eval_barrier_func_curr(double mu);
|
44
|
+
double eval_barrier_func_trial(double mu);
|
45
|
+
double eval_barrier_func_backup(double mu);
|
46
|
+
double eval_barrier_fo_decr(double mu, VEC *s_p, VEC *delta_s_p);
|
47
|
+
double eval_barrier_fo_decr_curr(double mu);
|
48
|
+
double eval_barrier_fo_decr_backup(double mu);
|
49
|
+
fatrop_int bound_slacks();
|
50
|
+
fatrop_int bound_z();
|
51
|
+
fatrop_int warmstart_dual();
|
52
|
+
fatrop_int modify_dual_bounds(double mu);
|
53
|
+
fatrop_int accept_dual_initializiaton();
|
54
|
+
fatrop_int update_trial_step(double alpha_primal, double alpha_dual);
|
55
|
+
fatrop_int accept_trial_step();
|
56
|
+
fatrop_int backup_curr();
|
57
|
+
fatrop_int backup_delta();
|
58
|
+
fatrop_int restore_backup();
|
59
|
+
double constr_viol_max_curr();
|
60
|
+
double constr_viol_max_next();
|
61
|
+
double constr_viol_sum_curr();
|
62
|
+
double constr_viol_sum_backup();
|
63
|
+
double constr_viol_sum_next();
|
64
|
+
double dual_sum_curr();
|
65
|
+
double dual_max_curr();
|
66
|
+
double dual_mean_curr();
|
67
|
+
double z_sum_curr();
|
68
|
+
fatrop_int number_of_bounds();
|
69
|
+
double delta_dual_max();
|
70
|
+
double dual_inf_max_curr();
|
71
|
+
double fo_decr_obj_curr();
|
72
|
+
double fo_decr_obj_backup();
|
73
|
+
void maximum_step_size(double &alpha_max_pr, double &alpha_max_du, double tau);
|
74
|
+
void set_bounds(const std::vector<double> &lowerin, const std::vector<double> &upperin);
|
75
|
+
void relax_bounds();
|
76
|
+
void relax_bounds_var(double mu);
|
77
|
+
void evaluate_barrier_quantities(double mu);
|
78
|
+
void compute_delta_z();
|
79
|
+
void compute_primal_dual_residu();
|
80
|
+
void init_bounds();
|
81
|
+
bool small_step_size();
|
82
|
+
|
83
|
+
|
84
|
+
const NLPDims nlpdims;
|
85
|
+
double obj_scale = 1.0;
|
86
|
+
fatrop_int n_eqs;
|
87
|
+
fatrop_int n_ineqs;
|
88
|
+
fatrop_int n_ineqs_r = 0;
|
89
|
+
FatropMemoryVecBF memvars;
|
90
|
+
FatropMemoryVecBF memeqs;
|
91
|
+
FatropMemoryVecBF memineqs;
|
92
|
+
FatropVecBF x_curr;
|
93
|
+
FatropVecBF x_next;
|
94
|
+
FatropVecBF x_backup;
|
95
|
+
FatropVecBF x_initial;
|
96
|
+
FatropVecBF delta_x;
|
97
|
+
FatropVecBF delta_x_backup;
|
98
|
+
FatropVecBF delta_x_backup_ls;
|
99
|
+
FatropVecBF x_scales;
|
100
|
+
FatropVecBF lam_curr;
|
101
|
+
FatropVecBF lam_next;
|
102
|
+
FatropVecBF lam_backup;
|
103
|
+
FatropVecBF lam_calc;
|
104
|
+
FatropVecBF lam_calc_backup;
|
105
|
+
FatropVecBF lam_calc_backup_ls;
|
106
|
+
FatropVecBF lam_scales;
|
107
|
+
FatropVecBF lam_init;
|
108
|
+
FatropVecBF g_curr;
|
109
|
+
FatropVecBF g_next;
|
110
|
+
FatropVecBF g_backup;
|
111
|
+
FatropVecBF g_soc;
|
112
|
+
FatropVecBF grad_curr_x;
|
113
|
+
FatropVecBF grad_next_x;
|
114
|
+
FatropVecBF grad_backup_x;
|
115
|
+
FatropVecBF du_inf_curr;
|
116
|
+
FatropVecBF du_inf_curr_s;
|
117
|
+
// vectors neccessary for inequality constraints
|
118
|
+
FatropVecBF s_curr;
|
119
|
+
FatropVecBF s_next;
|
120
|
+
FatropVecBF s_backup;
|
121
|
+
FatropVecBF delta_s;
|
122
|
+
FatropVecBF delta_s_backup;
|
123
|
+
FatropVecBF delta_s_backup_ls;
|
124
|
+
FatropVecBF zL_curr;
|
125
|
+
FatropVecBF zL_next;
|
126
|
+
FatropVecBF zL_backup;
|
127
|
+
FatropVecBF zL_init;
|
128
|
+
FatropVecBF zU_curr;
|
129
|
+
FatropVecBF zU_next;
|
130
|
+
FatropVecBF zU_backup;
|
131
|
+
FatropVecBF zU_init;
|
132
|
+
FatropVecBF delta_zL;
|
133
|
+
FatropVecBF delta_zU;
|
134
|
+
FatropVecBF s_lower_orig;
|
135
|
+
FatropVecBF s_upper_orig;
|
136
|
+
FatropVecBF s_lower;
|
137
|
+
FatropVecBF s_upper;
|
138
|
+
FatropVecBF sigma_L;
|
139
|
+
FatropVecBF sigma_U;
|
140
|
+
FatropVecBF sigma_total;
|
141
|
+
FatropVecBF gradb_L;
|
142
|
+
FatropVecBF gradb_U;
|
143
|
+
FatropVecBF gradb_plus;
|
144
|
+
FatropVecBF gradb_total;
|
145
|
+
FatropVecBF grad_curr_s;
|
146
|
+
FatropVecBF grad_next_s;
|
147
|
+
FatropVecBF grad_backup_s;
|
148
|
+
FatropVecBF du_inf_curr_s_wo_z;
|
149
|
+
// vector<bool> lower_bounded_v;
|
150
|
+
// vector<bool> upper_bounded_v;
|
151
|
+
struct EvalCache
|
152
|
+
{
|
153
|
+
struct Instance
|
154
|
+
{
|
155
|
+
bool evaluated = false;
|
156
|
+
double value = 0.0;
|
157
|
+
double SetValue(const double value_)
|
158
|
+
{
|
159
|
+
value = value_;
|
160
|
+
evaluated = true;
|
161
|
+
return value;
|
162
|
+
}
|
163
|
+
};
|
164
|
+
Instance cv_linf;
|
165
|
+
Instance cv_l1;
|
166
|
+
Instance lam_linf;
|
167
|
+
Instance lam_l1;
|
168
|
+
Instance du_inf_linf;
|
169
|
+
};
|
170
|
+
EvalCache cache_curr;
|
171
|
+
EvalCache cache_next;
|
172
|
+
double obj_curr = 0.0;
|
173
|
+
double obj_backup = 0.0;
|
174
|
+
double theta_min = 1e-4;
|
175
|
+
const std::shared_ptr<FatropOptions> params;
|
176
|
+
const std::shared_ptr<FatropPrinter> printer_;
|
177
|
+
// algorithm parameters
|
178
|
+
double smax;
|
179
|
+
double kappa1;
|
180
|
+
double kappa2;
|
181
|
+
double kappa_d;
|
182
|
+
double kappa_sigma;
|
183
|
+
double bound_relax_factor;
|
184
|
+
double constr_viol_tol;
|
185
|
+
double warm_start_mult_bound_push;
|
186
|
+
};
|
187
|
+
}
|
188
|
+
#endif // FATROPDATAINCLUDED
|
@@ -0,0 +1,95 @@
|
|
1
|
+
/*
|
2
|
+
* Fatrop - A fast trajectory optimization solver
|
3
|
+
* Copyright (C) 2022 - 2024 Lander Vanroye, KU Leuven. All rights reserved.
|
4
|
+
*
|
5
|
+
* This file is part of Fatrop.
|
6
|
+
*
|
7
|
+
* Fatrop is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* Fatrop is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
18
|
+
* along with Fatrop. If not, see <http://www.gnu.org/licenses/>. */
|
19
|
+
#ifndef FATROPPARAMSINCLUDED
|
20
|
+
#define FATROPPARAMSINCLUDED
|
21
|
+
#include <string>
|
22
|
+
#include <map>
|
23
|
+
#include <type_traits>
|
24
|
+
#include <iostream>
|
25
|
+
#include <vector>
|
26
|
+
#include "fatrop/auxiliary/Common.hpp"
|
27
|
+
namespace fatrop
|
28
|
+
{
|
29
|
+
template <typename T>
|
30
|
+
struct Option
|
31
|
+
{
|
32
|
+
public:
|
33
|
+
Option(){};
|
34
|
+
Option(const std::string &name, const std::string &description, T *value, T default_value);
|
35
|
+
void set(const T &new_value) const;
|
36
|
+
void set_default() const;
|
37
|
+
std::string name_;
|
38
|
+
std::string description_;
|
39
|
+
T *value = NULL;
|
40
|
+
T default_value_;
|
41
|
+
};
|
42
|
+
|
43
|
+
|
44
|
+
template <typename T>
|
45
|
+
struct NumberOption: public Option<T>
|
46
|
+
{
|
47
|
+
public:
|
48
|
+
// DoubleOption operator=(const DoubleOption &other) = default;
|
49
|
+
NumberOption(){};
|
50
|
+
NumberOption(const std::string &name, const std::string &description, T *value, T default_value, bool lower_bound_inclusive, T lower_bound, bool upper_bound_inclusive, T upper_bound);
|
51
|
+
static NumberOption<T> lower_bounded(const std::string &name, const std::string &description, T *value, T default_value, T lower_bound);
|
52
|
+
static NumberOption<T> upper_bounded(const std::string &name, const std::string &description, T *value, T default_value, T upper_bound);
|
53
|
+
static NumberOption<T> un_bounded(const std::string &name, const std::string &description, T *value, T default_value);
|
54
|
+
static NumberOption<T> box_bounded(const std::string &name, const std::string &description, T *value, T default_value, T lower_bound, T upper_bound);
|
55
|
+
void set(const T &new_value) const;
|
56
|
+
bool lower_bound_inclusive_;
|
57
|
+
T lower_bound_;
|
58
|
+
bool upper_bound_inclusive_;
|
59
|
+
T upper_bound_;
|
60
|
+
};
|
61
|
+
// define Numeric option as Option<double>
|
62
|
+
typedef NumberOption<double> DoubleOption;
|
63
|
+
typedef NumberOption<fatrop_int> IntegerOption;
|
64
|
+
typedef Option<std::string> StringOption;
|
65
|
+
typedef Option<bool> BooleanOption;
|
66
|
+
|
67
|
+
class FatropOptions
|
68
|
+
{
|
69
|
+
public:
|
70
|
+
FatropOptions();
|
71
|
+
// the following options are shared between different algorithm components:
|
72
|
+
int maxiter = 1000; // TODO this value cannot be changed to a value larger than the one used for building the solver
|
73
|
+
double kappa_d = 1e-5;
|
74
|
+
template <typename T>
|
75
|
+
void set(const std::string &option_name, T value) const;
|
76
|
+
template <typename T>
|
77
|
+
void prebuilt_set(const std::string &option_name, T value);
|
78
|
+
|
79
|
+
public:
|
80
|
+
bool has_option(const std::string &option_name) const;
|
81
|
+
void register_option(const DoubleOption &option);
|
82
|
+
void register_option(const IntegerOption &option);
|
83
|
+
void register_option(const BooleanOption &option);
|
84
|
+
void register_option(const StringOption &option);
|
85
|
+
friend auto operator<<(std::ostream &os, const FatropOptions &m) -> std::ostream &;
|
86
|
+
std::map<std::string, std::vector<DoubleOption>> numeric_options;
|
87
|
+
std::map<std::string, std::vector<IntegerOption>> integer_options;
|
88
|
+
std::map<std::string, std::vector<BooleanOption>> boolean_options;
|
89
|
+
std::map<std::string, std::vector<StringOption>> string_options;
|
90
|
+
std::map<std::string, std::string> prebuilt_string;
|
91
|
+
std::map<std::string, double> prebuilt_double;
|
92
|
+
};
|
93
|
+
|
94
|
+
} // namespace fatrop
|
95
|
+
#endif // FatropOptions
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/*
|
2
|
+
* Fatrop - A fast trajectory optimization solver
|
3
|
+
* Copyright (C) 2022 - 2024 Lander Vanroye, KU Leuven. All rights reserved.
|
4
|
+
*
|
5
|
+
* This file is part of Fatrop.
|
6
|
+
*
|
7
|
+
* Fatrop is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* Fatrop is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
18
|
+
* along with Fatrop. If not, see <http://www.gnu.org/licenses/>. */
|
19
|
+
#define PRIORITY1 PrintPriority<1>()
|
20
|
+
#ifndef FATROPPRINTERINCLUDED
|
21
|
+
#define FATROPPRINTERINCLUDED
|
22
|
+
#include <iostream>
|
23
|
+
#include <string>
|
24
|
+
#include <vector>
|
25
|
+
namespace fatrop
|
26
|
+
{
|
27
|
+
static std::ostream nullstream(nullptr);
|
28
|
+
template <int Priority>
|
29
|
+
struct PrintPriority
|
30
|
+
{
|
31
|
+
PrintPriority(){};
|
32
|
+
const int priority = Priority;
|
33
|
+
};
|
34
|
+
template <int priority>
|
35
|
+
std::ostream &operator<<(std::ostream &os, const PrintPriority<priority> &p)
|
36
|
+
{
|
37
|
+
if (p.priority >= -1)
|
38
|
+
return os;
|
39
|
+
return nullstream;
|
40
|
+
}
|
41
|
+
class FatropPrinter
|
42
|
+
{
|
43
|
+
public:
|
44
|
+
FatropPrinter(const int priority = 0, std::ostream &stream = std::cout) : priority_(priority), stream_(stream),
|
45
|
+
printf_buffer_(256) {};
|
46
|
+
std::ostream &
|
47
|
+
level(const int p)
|
48
|
+
{
|
49
|
+
if (p <= priority_)
|
50
|
+
return stream_;
|
51
|
+
return nullstream;
|
52
|
+
}
|
53
|
+
int &print_level() { return priority_; }
|
54
|
+
|
55
|
+
|
56
|
+
int printf(const char *fmt, ...);
|
57
|
+
|
58
|
+
private:
|
59
|
+
int priority_;
|
60
|
+
std::ostream& stream_;
|
61
|
+
std::vector<char> printf_buffer_;
|
62
|
+
};
|
63
|
+
|
64
|
+
} // namespace fatrop
|
65
|
+
#endif // FATROPITERATIONDATAINCLUDED
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/*
|
2
|
+
* Fatrop - A fast trajectory optimization solver
|
3
|
+
* Copyright (C) 2022 - 2024 Lander Vanroye, KU Leuven. All rights reserved.
|
4
|
+
*
|
5
|
+
* This file is part of Fatrop.
|
6
|
+
*
|
7
|
+
* Fatrop is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* Fatrop is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
18
|
+
* along with Fatrop. If not, see <http://www.gnu.org/licenses/>. */
|
19
|
+
#ifndef FATROPSTATSINCLUDED
|
20
|
+
#define FATROPSTATSINCLUDED
|
21
|
+
#include <iostream>
|
22
|
+
namespace fatrop
|
23
|
+
{
|
24
|
+
struct FatropStats
|
25
|
+
{
|
26
|
+
double compute_sd_time = 0.0;
|
27
|
+
double duinf_time = 0.0;
|
28
|
+
double eval_hess_time = 0.0;
|
29
|
+
double eval_jac_time = 0.0;
|
30
|
+
double eval_cv_time = 0.0;
|
31
|
+
double eval_grad_time = 0.0;
|
32
|
+
double eval_obj_time = 0.0;
|
33
|
+
double initialization_time = 0.0;
|
34
|
+
double time_total = 0.0;
|
35
|
+
int eval_hess_count = 0;
|
36
|
+
int eval_jac_count = 0;
|
37
|
+
int eval_cv_count = 0;
|
38
|
+
int eval_grad_count = 0;
|
39
|
+
int eval_obj_count = 0;
|
40
|
+
int iterations_count = 0;
|
41
|
+
int return_flag = 0;
|
42
|
+
void print(std::ostream& stream)
|
43
|
+
{
|
44
|
+
stream << "---- stats ----" << std::endl;
|
45
|
+
stream << "compute_sd: " << compute_sd_time << " s"<< std::endl;
|
46
|
+
stream << "duinf: " << duinf_time << " s"<< std::endl;
|
47
|
+
stream << "initialization: " << initialization_time << " s count: "<< iterations_count <<std::endl;
|
48
|
+
double time_FE = eval_hess_time + eval_jac_time + eval_cv_time + eval_grad_time + eval_obj_time ;
|
49
|
+
stream << "time_FE : " << time_FE << " s"<< std::endl;
|
50
|
+
stream << " eval hess: " << eval_hess_time << " s count: "<< eval_hess_count <<std::endl;
|
51
|
+
stream << " eval jac: " << eval_jac_time << " s count: "<< eval_jac_count <<std::endl;
|
52
|
+
stream << " eval cv: " << eval_cv_time << " s count: "<< eval_cv_count <<std::endl;
|
53
|
+
stream << " eval grad: " << eval_grad_time << " s count: "<< eval_grad_count <<std::endl;
|
54
|
+
stream << " eval obj: " << eval_obj_time << " s count: "<< eval_obj_count <<std::endl;
|
55
|
+
stream << "rest : " <<time_total - time_FE - initialization_time - duinf_time - compute_sd_time<< " s"<< std::endl;
|
56
|
+
stream << "----- "<< std::endl;
|
57
|
+
stream << "time_w/o_FE : " << time_total - time_FE << " s" << std::endl;
|
58
|
+
stream << "time_FE : " << time_FE << " s"<< std::endl;
|
59
|
+
stream << "time_total : " << time_total << " s iterations: " << iterations_count << std::endl;
|
60
|
+
}
|
61
|
+
};
|
62
|
+
} // namespace fatrop
|
63
|
+
#endif // FATROPSTATSINCLUDED
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/*
|
2
|
+
* Fatrop - A fast trajectory optimization solver
|
3
|
+
* Copyright (C) 2022 - 2024 Lander Vanroye, KU Leuven. All rights reserved.
|
4
|
+
*
|
5
|
+
* This file is part of Fatrop.
|
6
|
+
*
|
7
|
+
* Fatrop is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* Fatrop is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
18
|
+
* along with Fatrop. If not, see <http://www.gnu.org/licenses/>. */
|
19
|
+
#ifndef FILTERINCLUDED
|
20
|
+
#define FILTERINCLUDED
|
21
|
+
#include "vector"
|
22
|
+
#include "fatrop/auxiliary/Common.hpp"
|
23
|
+
namespace fatrop
|
24
|
+
{
|
25
|
+
struct FilterData
|
26
|
+
{
|
27
|
+
FilterData(){};
|
28
|
+
FilterData(const fatrop_int iteration, const double phi, const double theta):iteration(iteration),phi(phi),theta(theta){};
|
29
|
+
const fatrop_int iteration = 0;
|
30
|
+
/** \brief barrier function value */
|
31
|
+
const double phi = 0.0;
|
32
|
+
/** \brief constraint violation value */
|
33
|
+
const double theta = 0.0;
|
34
|
+
};
|
35
|
+
class Filter
|
36
|
+
{
|
37
|
+
public:
|
38
|
+
Filter(const fatrop_int size);
|
39
|
+
void augment(const FilterData &filterdata);
|
40
|
+
/** \brief check if fdin0 is dominated by fdin1 */
|
41
|
+
inline bool a_dominmates_b(const FilterData &fdin0, const FilterData &fdin1) const;
|
42
|
+
bool is_acceptable(const FilterData &fdin) const;
|
43
|
+
void reset();
|
44
|
+
fatrop_int size() const
|
45
|
+
{
|
46
|
+
return filterdata_.size();
|
47
|
+
}
|
48
|
+
|
49
|
+
private:
|
50
|
+
std::vector<FilterData> filterdata_;
|
51
|
+
};
|
52
|
+
} // namespace fatrop
|
53
|
+
|
54
|
+
#endif // FILTERINCLUDED
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*
|
2
|
+
* Fatrop - A fast trajectory optimization solver
|
3
|
+
* Copyright (C) 2022 - 2024 Lander Vanroye, KU Leuven. All rights reserved.
|
4
|
+
*
|
5
|
+
* This file is part of Fatrop.
|
6
|
+
*
|
7
|
+
* Fatrop is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* Fatrop is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
18
|
+
* along with Fatrop. If not, see <http://www.gnu.org/licenses/>. */
|
19
|
+
#ifndef FATROPITERATIONDATAINCLUDED
|
20
|
+
#define FATROPITERATIONDATAINCLUDED
|
21
|
+
#include <cmath>
|
22
|
+
#include <vector>
|
23
|
+
#include <iostream>
|
24
|
+
#include <fatrop/solver/FatropPrinter.hpp>
|
25
|
+
#include "fatrop/auxiliary/Common.hpp"
|
26
|
+
#include <memory>
|
27
|
+
namespace fatrop
|
28
|
+
{
|
29
|
+
struct IterationData
|
30
|
+
{
|
31
|
+
fatrop_int iter = 0;
|
32
|
+
double mu = 0.0;
|
33
|
+
double objective = 0.0;
|
34
|
+
double constraint_violation = 0.0;
|
35
|
+
double du_inf = 0.0;
|
36
|
+
fatrop_int ls = 0;
|
37
|
+
double reg = 0.0;
|
38
|
+
double alpha_pr = 0.0;
|
39
|
+
double alpha_du = 0.0;
|
40
|
+
char type = 'x';
|
41
|
+
bool resto = false;
|
42
|
+
};
|
43
|
+
class Journaller
|
44
|
+
{
|
45
|
+
public:
|
46
|
+
Journaller(const fatrop_int maxiter, const std::shared_ptr<FatropPrinter> &printer);
|
47
|
+
void print_iterations(bool no_header = false);
|
48
|
+
void push();
|
49
|
+
void reset();
|
50
|
+
fatrop_int print_count = 0;
|
51
|
+
std::vector<IterationData> iterationdata;
|
52
|
+
IterationData it_curr;
|
53
|
+
std::shared_ptr<FatropPrinter> printer_;
|
54
|
+
};
|
55
|
+
} // namespace fatrop
|
56
|
+
#endif // FATROPITERATIONDATAINCLUDED
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/*
|
2
|
+
* Fatrop - A fast trajectory optimization solver
|
3
|
+
* Copyright (C) 2022 - 2024 Lander Vanroye, KU Leuven. All rights reserved.
|
4
|
+
*
|
5
|
+
* This file is part of Fatrop.
|
6
|
+
*
|
7
|
+
* Fatrop is free software: you can redistribute it and/or modify
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
10
|
+
* (at your option) any later version.
|
11
|
+
*
|
12
|
+
* Fatrop is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
* GNU Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
18
|
+
* along with Fatrop. If not, see <http://www.gnu.org/licenses/>. */
|
19
|
+
#ifndef LINESEARCHINCLUDED
|
20
|
+
#define LINESEARCHINCLUDED
|
21
|
+
#include "AlgStrategy.hpp"
|
22
|
+
#include "IterationData.hpp"
|
23
|
+
#include "fatrop/templates/NLPAlg.hpp"
|
24
|
+
#include "fatrop/solver/FatropData.hpp"
|
25
|
+
#include "fatrop/solver/Filter.hpp"
|
26
|
+
#include "fatrop/solver/FatropPrinter.hpp"
|
27
|
+
#include "fatrop/auxiliary/Common.hpp"
|
28
|
+
#include <cmath>
|
29
|
+
#include <memory>
|
30
|
+
namespace fatrop
|
31
|
+
{
|
32
|
+
struct LineSearchInfo
|
33
|
+
{
|
34
|
+
fatrop_int ls = 0;
|
35
|
+
bool first_rejected_by_filter = false;
|
36
|
+
bool last_rejected_by_filter = false;
|
37
|
+
};
|
38
|
+
class LineSearch : public AlgStrategy
|
39
|
+
{
|
40
|
+
public:
|
41
|
+
LineSearch(
|
42
|
+
const std::shared_ptr<FatropOptions> &fatropparams,
|
43
|
+
const std::shared_ptr<FatropNLP> &nlp,
|
44
|
+
const std::shared_ptr<FatropData> &fatropdata, const std::shared_ptr<FatropPrinter> &printer);
|
45
|
+
virtual LineSearchInfo find_acceptable_trial_point(double mu, bool small_sd, bool from_backup) = 0;
|
46
|
+
fatrop_int eval_constr_viol_trial();
|
47
|
+
double eval_obj_trial();
|
48
|
+
void reset();
|
49
|
+
virtual fatrop_int update_trial_step(double alpha_pr, double alpha_du) const;
|
50
|
+
virtual fatrop_int initialize_second_order_correction() const;
|
51
|
+
virtual fatrop_int exit_second_order_correction() const;
|
52
|
+
virtual fatrop_int compute_second_order_correction(double alpha) const;
|
53
|
+
std::shared_ptr<FatropNLP> fatropnlp_;
|
54
|
+
std::shared_ptr<FatropData> fatropdata_;
|
55
|
+
std::shared_ptr<FatropPrinter> printer_;
|
56
|
+
fatrop_int eval_cv_count;
|
57
|
+
fatrop_int eval_obj_count;
|
58
|
+
double eval_cv_time;
|
59
|
+
double eval_obj_time;
|
60
|
+
};
|
61
|
+
|
62
|
+
class BackTrackingLineSearch : public LineSearch
|
63
|
+
{
|
64
|
+
public:
|
65
|
+
BackTrackingLineSearch(
|
66
|
+
const std::shared_ptr<FatropOptions> &fatropparams,
|
67
|
+
const std::shared_ptr<FatropNLP> &nlp,
|
68
|
+
const std::shared_ptr<FatropData> &fatropdata,
|
69
|
+
const std::shared_ptr<Filter> &filter,
|
70
|
+
const std::shared_ptr<Journaller> &journaller, const std::shared_ptr<FatropPrinter> &printer);
|
71
|
+
void initialize();
|
72
|
+
LineSearchInfo find_acceptable_trial_point(double mu, bool small_sd, bool from_backup);
|
73
|
+
std::shared_ptr<Filter> filter_;
|
74
|
+
std::shared_ptr<Journaller> journaller_;
|
75
|
+
double s_phi;
|
76
|
+
double delta;
|
77
|
+
double s_theta;
|
78
|
+
double gamma_theta;
|
79
|
+
double gamma_phi;
|
80
|
+
double eta_phi;
|
81
|
+
double gamma_alpha;
|
82
|
+
bool accept_every_trial_step = false;
|
83
|
+
fatrop_int max_soc;
|
84
|
+
};
|
85
|
+
} // namespace fatrop
|
86
|
+
#endif // LINESEARCHINCLUDED
|