casadi 3.6.5__cp38-none-macosx_11_0_arm64.whl → 3.6.7__cp38-none-macosx_11_0_arm64.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-cli +0 -0
- casadi/casadi.py +739 -308
- casadi/cbc +0 -0
- casadi/clp +0 -0
- casadi/cmake/casadi-config-version.cmake +1 -1
- casadi/cmake/casadi-targets.cmake +10 -6
- casadi/cmake/highs/highs-config.cmake +6 -13
- casadi/cmake/highs/highs-targets-release.cmake +13 -13
- casadi/cmake/highs/highs-targets.cmake +25 -22
- casadi/cmake/osqp/osqp-targets.cmake +10 -6
- casadi/cmake/proxsuite/proxsuiteConfigVersion.cmake +0 -5
- casadi/cmake/proxsuite/proxsuiteTargets.cmake +12 -12
- casadi/cmake/qdldl/qdldl-targets.cmake +10 -6
- casadi/cmake/sleqp/sleqp-config-version.cmake +0 -5
- casadi/cmake/sleqp/sleqp-targets.cmake +10 -6
- casadi/cmake/trlib/trlib-config-release.cmake +1 -1
- casadi/cmake/trlib/trlib-config-version.cmake +0 -5
- casadi/cmake/trlib/trlib-config.cmake +12 -12
- casadi/highs +0 -0
- casadi/include/casadi/casadi.i +3 -0
- casadi/include/casadi/casadi_c.h +2 -0
- casadi/include/casadi/config.h +9 -9
- casadi/include/casadi/core/casadi_common.hpp +1 -0
- casadi/include/casadi/core/casadi_export.h +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/highs/HConfig.h +8 -7
- casadi/include/highs/Highs.h +93 -23
- casadi/include/highs/filereaderlp/def.hpp +19 -0
- casadi/include/highs/interfaces/highs_c_api.h +200 -24
- casadi/include/highs/io/Filereader.h +1 -1
- casadi/include/highs/io/FilereaderEms.h +1 -1
- casadi/include/highs/io/FilereaderLp.h +1 -1
- casadi/include/highs/io/FilereaderMps.h +1 -1
- casadi/include/highs/io/HMPSIO.h +1 -1
- casadi/include/highs/io/HMpsFF.h +5 -3
- casadi/include/highs/io/HighsIO.h +18 -8
- casadi/include/highs/io/LoadOptions.h +1 -1
- casadi/include/highs/ipm/IpxSolution.h +35 -0
- casadi/include/highs/ipm/IpxWrapper.h +1 -1
- casadi/include/highs/ipm/basiclu/basiclu.h +161 -0
- casadi/include/highs/ipm/basiclu/basiclu_factorize.h +247 -0
- casadi/include/highs/ipm/basiclu/basiclu_get_factors.h +108 -0
- casadi/include/highs/ipm/basiclu/basiclu_initialize.h +119 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_factorize.h +34 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_free.h +19 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_get_factors.h +34 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_initialize.h +46 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_solve_dense.h +29 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_solve_for_update.h +42 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_solve_sparse.h +32 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_update.h +31 -0
- casadi/include/highs/ipm/basiclu/basiclu_object.h +30 -0
- casadi/include/highs/ipm/basiclu/basiclu_solve_dense.h +75 -0
- casadi/include/highs/ipm/basiclu/basiclu_solve_for_update.h +169 -0
- casadi/include/highs/ipm/basiclu/basiclu_solve_sparse.h +112 -0
- casadi/include/highs/ipm/basiclu/basiclu_update.h +125 -0
- casadi/include/highs/ipm/basiclu/lu_def.h +39 -0
- casadi/include/highs/ipm/basiclu/lu_file.h +21 -0
- casadi/include/highs/ipm/basiclu/lu_internal.h +220 -0
- casadi/include/highs/ipm/basiclu/lu_list.h +168 -0
- casadi/include/highs/ipm/ipx/basiclu_kernel.h +20 -0
- casadi/include/highs/ipm/ipx/basiclu_wrapper.h +47 -0
- casadi/include/highs/ipm/ipx/basis.h +351 -0
- casadi/include/highs/ipm/ipx/conjugate_residuals.h +74 -0
- casadi/include/highs/ipm/ipx/control.h +163 -0
- casadi/include/highs/ipm/ipx/crossover.h +157 -0
- casadi/include/highs/ipm/ipx/diagonal_precond.h +45 -0
- casadi/include/highs/ipm/ipx/forrest_tomlin.h +102 -0
- casadi/include/highs/ipm/ipx/guess_basis.h +21 -0
- casadi/include/highs/ipm/ipx/indexed_vector.h +113 -0
- casadi/include/highs/ipm/ipx/info.h +27 -0
- casadi/include/highs/ipm/ipx/ipm.h +94 -0
- casadi/include/highs/ipm/ipx/ipx_c.h +47 -0
- casadi/include/highs/ipm/ipx/ipx_config.h +9 -0
- casadi/include/highs/ipm/ipx/ipx_info.h +111 -0
- casadi/include/highs/ipm/ipx/ipx_internal.h +88 -0
- casadi/include/highs/ipm/ipx/ipx_parameters.h +75 -0
- casadi/include/highs/ipm/ipx/ipx_status.h +57 -0
- casadi/include/highs/ipm/ipx/iterate.h +328 -0
- casadi/include/highs/ipm/ipx/kkt_solver.h +70 -0
- casadi/include/highs/ipm/ipx/kkt_solver_basis.h +66 -0
- casadi/include/highs/ipm/ipx/kkt_solver_diag.h +48 -0
- casadi/include/highs/ipm/ipx/linear_operator.h +26 -0
- casadi/include/highs/ipm/ipx/lp_solver.h +201 -0
- casadi/include/highs/ipm/ipx/lu_factorization.h +79 -0
- casadi/include/highs/ipm/ipx/lu_update.h +129 -0
- casadi/include/highs/ipm/ipx/maxvolume.h +54 -0
- casadi/include/highs/ipm/ipx/model.h +409 -0
- casadi/include/highs/ipm/ipx/multistream.h +52 -0
- casadi/include/highs/ipm/ipx/normal_matrix.h +44 -0
- casadi/include/highs/ipm/ipx/power_method.h +44 -0
- casadi/include/highs/ipm/ipx/sparse_matrix.h +195 -0
- casadi/include/highs/ipm/ipx/sparse_utils.h +58 -0
- casadi/include/highs/ipm/ipx/splitted_normal_matrix.h +63 -0
- casadi/include/highs/ipm/ipx/starting_basis.h +39 -0
- casadi/include/highs/ipm/ipx/symbolic_invert.h +29 -0
- casadi/include/highs/ipm/ipx/timer.h +24 -0
- casadi/include/highs/ipm/ipx/utils.h +39 -0
- casadi/include/highs/lp_data/HConst.h +20 -10
- casadi/include/highs/lp_data/HStruct.h +23 -1
- casadi/include/highs/lp_data/HighsAnalysis.h +1 -1
- casadi/include/highs/lp_data/HighsCallback.h +10 -3
- casadi/include/highs/lp_data/HighsCallbackStruct.h +31 -5
- casadi/include/highs/lp_data/HighsDebug.h +1 -1
- casadi/include/highs/lp_data/HighsInfo.h +20 -2
- casadi/include/highs/lp_data/HighsInfoDebug.h +1 -1
- casadi/include/highs/lp_data/HighsLp.h +17 -1
- casadi/include/highs/lp_data/HighsLpSolverObject.h +1 -1
- casadi/include/highs/lp_data/HighsLpUtils.h +19 -19
- casadi/include/highs/lp_data/HighsModelUtils.h +1 -1
- casadi/include/highs/lp_data/HighsOptions.h +237 -10
- casadi/include/highs/lp_data/HighsRanging.h +1 -1
- casadi/include/highs/lp_data/HighsRuntimeOptions.h +2 -2
- casadi/include/highs/lp_data/HighsSolution.h +2 -2
- casadi/include/highs/lp_data/HighsSolutionDebug.h +1 -1
- casadi/include/highs/lp_data/HighsSolve.h +3 -1
- casadi/include/highs/lp_data/HighsStatus.h +1 -1
- casadi/include/highs/mip/HighsCliqueTable.h +4 -4
- casadi/include/highs/mip/HighsConflictPool.h +1 -1
- casadi/include/highs/mip/HighsCutGeneration.h +1 -1
- casadi/include/highs/mip/HighsCutPool.h +2 -2
- casadi/include/highs/mip/HighsDebugSol.h +22 -29
- casadi/include/highs/mip/HighsDomain.h +10 -2
- casadi/include/highs/mip/HighsDomainChange.h +1 -1
- casadi/include/highs/mip/HighsDynamicRowMatrix.h +5 -3
- casadi/include/highs/mip/HighsGFkSolve.h +3 -3
- casadi/include/highs/mip/HighsImplications.h +3 -3
- casadi/include/highs/mip/HighsLpAggregator.h +1 -1
- casadi/include/highs/mip/HighsLpRelaxation.h +6 -1
- casadi/include/highs/mip/HighsMipSolver.h +4 -2
- casadi/include/highs/mip/HighsMipSolverData.h +47 -4
- casadi/include/highs/mip/HighsModkSeparator.h +2 -2
- casadi/include/highs/mip/HighsNodeQueue.h +5 -3
- casadi/include/highs/mip/HighsObjectiveFunction.h +1 -1
- casadi/include/highs/mip/HighsPathSeparator.h +2 -2
- casadi/include/highs/mip/HighsPrimalHeuristics.h +1 -1
- casadi/include/highs/mip/HighsPseudocost.h +35 -23
- casadi/include/highs/mip/HighsRedcostFixing.h +1 -1
- casadi/include/highs/mip/HighsSearch.h +2 -1
- casadi/include/highs/mip/HighsSeparation.h +1 -1
- casadi/include/highs/mip/HighsSeparator.h +1 -1
- casadi/include/highs/mip/HighsTableauSeparator.h +1 -1
- casadi/include/highs/mip/HighsTransformedLp.h +1 -1
- casadi/include/highs/model/HighsHessian.h +5 -0
- casadi/include/highs/model/HighsHessianUtils.h +2 -0
- casadi/include/highs/model/HighsModel.h +10 -1
- casadi/include/highs/parallel/HighsMutex.h +2 -1
- casadi/include/highs/parallel/HighsParallel.h +7 -2
- casadi/include/highs/parallel/HighsTask.h +1 -2
- casadi/include/highs/pdlp/CupdlpWrapper.h +93 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_cs.h +41 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_defs.h +423 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_linalg.h +183 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_proj.h +19 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_restart.h +31 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_scaling_cuda.h +28 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_solver.h +98 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_step.h +33 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_utils.c +1726 -0
- casadi/include/highs/pdqsort/pdqsort.h +532 -0
- casadi/include/highs/presolve/HPresolve.h +27 -14
- casadi/include/highs/presolve/HPresolveAnalysis.h +1 -1
- casadi/include/highs/presolve/HighsPostsolveStack.h +92 -68
- casadi/include/highs/presolve/HighsSymmetry.h +6 -5
- casadi/include/highs/presolve/ICrash.h +8 -2
- casadi/include/highs/presolve/ICrashUtil.h +1 -1
- casadi/include/highs/presolve/ICrashX.h +1 -1
- casadi/include/highs/presolve/PresolveComponent.h +1 -1
- casadi/include/highs/qpsolver/a_asm.hpp +23 -12
- casadi/include/highs/qpsolver/a_quass.hpp +8 -1
- casadi/include/highs/qpsolver/basis.hpp +150 -0
- casadi/include/highs/qpsolver/crashsolution.hpp +12 -0
- casadi/include/highs/qpsolver/dantzigpricing.hpp +72 -0
- casadi/include/highs/qpsolver/devexpricing.hpp +99 -0
- casadi/include/highs/qpsolver/eventhandler.hpp +23 -0
- casadi/include/highs/qpsolver/factor.hpp +400 -0
- casadi/include/highs/qpsolver/feasibility_bounded.hpp +105 -0
- casadi/include/highs/qpsolver/feasibility_highs.hpp +270 -0
- casadi/include/highs/qpsolver/gradient.hpp +39 -0
- casadi/include/highs/qpsolver/instance.hpp +63 -0
- casadi/include/highs/qpsolver/matrix.hpp +335 -0
- casadi/include/highs/qpsolver/pricing.hpp +15 -0
- casadi/include/highs/qpsolver/qpconst.hpp +27 -0
- casadi/include/highs/qpsolver/{vector.hpp → qpvector.hpp} +25 -25
- casadi/include/highs/qpsolver/quass.hpp +1 -1
- casadi/include/highs/qpsolver/ratiotest.hpp +19 -0
- casadi/include/highs/qpsolver/runtime.hpp +38 -0
- casadi/include/highs/qpsolver/settings.hpp +57 -0
- casadi/include/highs/qpsolver/snippets.hpp +29 -0
- casadi/include/highs/qpsolver/statistics.hpp +23 -0
- casadi/include/highs/qpsolver/steepestedgepricing.hpp +167 -0
- casadi/include/highs/simplex/HApp.h +1 -1
- casadi/include/highs/simplex/HEkk.h +52 -18
- casadi/include/highs/simplex/HEkkDual.h +1 -1
- casadi/include/highs/simplex/HEkkDualRHS.h +6 -7
- casadi/include/highs/simplex/HEkkDualRow.h +2 -2
- casadi/include/highs/simplex/HEkkPrimal.h +6 -1
- casadi/include/highs/simplex/HSimplex.h +1 -3
- casadi/include/highs/simplex/HSimplexDebug.h +1 -1
- casadi/include/highs/simplex/HSimplexNla.h +1 -1
- casadi/include/highs/simplex/HSimplexReport.h +1 -1
- casadi/include/highs/simplex/HighsSimplexAnalysis.h +228 -100
- casadi/include/highs/simplex/SimplexConst.h +1 -1
- casadi/include/highs/simplex/SimplexStruct.h +2 -2
- casadi/include/highs/simplex/SimplexTimer.h +1 -1
- casadi/include/highs/test/DevKkt.h +1 -1
- casadi/include/highs/test/KktCh2.h +1 -1
- casadi/include/highs/util/FactorTimer.h +1 -1
- casadi/include/highs/util/HFactor.h +35 -6
- casadi/include/highs/util/HFactorConst.h +1 -1
- casadi/include/highs/util/HFactorDebug.h +1 -1
- casadi/include/highs/util/HSet.h +1 -1
- casadi/include/highs/util/HVector.h +1 -1
- casadi/include/highs/util/HVectorBase.h +1 -1
- casadi/include/highs/util/HighsCDouble.h +3 -3
- casadi/include/highs/util/HighsComponent.h +1 -1
- casadi/include/highs/util/HighsDataStack.h +4 -4
- casadi/include/highs/util/HighsDisjointSets.h +1 -1
- casadi/include/highs/util/HighsHash.h +28 -21
- casadi/include/highs/util/HighsHashTree.h +63 -63
- casadi/include/highs/util/HighsInt.h +1 -1
- casadi/include/highs/util/HighsIntegers.h +8 -9
- casadi/include/highs/util/HighsLinearSumBounds.h +1 -1
- casadi/include/highs/util/HighsMatrixPic.h +1 -1
- casadi/include/highs/util/HighsMatrixSlice.h +9 -6
- casadi/include/highs/util/HighsMatrixUtils.h +1 -1
- casadi/include/highs/util/HighsMemoryAllocation.h +55 -0
- casadi/include/highs/util/HighsRandom.h +27 -15
- casadi/include/highs/util/HighsRbTree.h +2 -2
- casadi/include/highs/util/HighsSort.h +7 -7
- casadi/include/highs/util/HighsSparseMatrix.h +5 -2
- casadi/include/highs/util/HighsSparseVectorSum.h +2 -2
- casadi/include/highs/util/HighsSplay.h +1 -1
- casadi/include/highs/util/HighsTimer.h +18 -9
- casadi/include/highs/util/HighsUtils.h +15 -8
- casadi/include/highs/util/stringutil.h +9 -4
- casadi/include/highs/zstr/strict_fstream.hpp +237 -0
- casadi/include/highs/zstr/zstr.hpp +472 -0
- casadi/include/highs_export.h +43 -0
- casadi/include/licenses/daqp-external/LICENSE +21 -0
- casadi/include/licenses/{alpaqa-external/LICENSE → fatrop-external/LICENSE.txt} +2 -2
- casadi/include/licenses/fatrop-external/external/blasfeo/LICENSE.txt +26 -0
- casadi/include/licenses/fatrop-external/external/pybind11/LICENSE +29 -0
- casadi/include/licenses/fatrop-external/misc/license_header.txt +17 -0
- casadi/include/licenses/highs-external/{LICENSE → LICENSE.txt} +1 -1
- casadi/include/osqp/constants.h +2 -3
- casadi/include/osqp/version.h +9 -0
- casadi/include/sleqp/defs.h +4 -4
- casadi/include/sleqp/export.h +1 -0
- casadi/lib/cmake/tinyxml2/tinyxml2-config-version.cmake +0 -5
- casadi/lib/cmake/tinyxml2/tinyxml2-static-targets.cmake +10 -6
- casadi/lib/libtinyxml2.a +0 -0
- casadi/lib/pkgconfig/tinyxml2.pc +1 -1
- casadi/libCbc.3.10.11.dylib +0 -0
- casadi/libCbc.3.dylib +0 -0
- casadi/libCbc.dylib +0 -0
- casadi/libCbc.la +2 -2
- casadi/libCbcSolver.3.10.11.dylib +0 -0
- casadi/libCbcSolver.3.dylib +0 -0
- casadi/libCbcSolver.dylib +0 -0
- casadi/libCbcSolver.la +2 -2
- casadi/libCgl.1.10.8.dylib +0 -0
- casadi/libCgl.1.dylib +0 -0
- casadi/libCgl.dylib +0 -0
- casadi/libCgl.la +2 -2
- casadi/libClp.1.14.9.dylib +0 -0
- casadi/libClp.1.dylib +0 -0
- casadi/libClp.dylib +0 -0
- casadi/libClp.la +2 -2
- casadi/libClpSolver.1.14.9.dylib +0 -0
- casadi/libClpSolver.1.dylib +0 -0
- casadi/libClpSolver.dylib +0 -0
- casadi/libClpSolver.la +2 -2
- casadi/libCoinUtils.3.11.10.dylib +0 -0
- casadi/libCoinUtils.3.dylib +0 -0
- casadi/libCoinUtils.dylib +0 -0
- casadi/libCoinUtils.la +1 -1
- casadi/libOsi.1.13.9.dylib +0 -0
- casadi/libOsi.1.dylib +0 -0
- casadi/libOsi.dylib +0 -0
- casadi/libOsi.la +2 -2
- casadi/libOsiCbc.3.10.11.dylib +0 -0
- casadi/libOsiCbc.3.dylib +0 -0
- casadi/libOsiCbc.dylib +0 -0
- casadi/libOsiCbc.la +2 -2
- casadi/libOsiClp.1.14.9.dylib +0 -0
- casadi/libOsiClp.1.dylib +0 -0
- casadi/libOsiClp.dylib +0 -0
- casadi/libOsiClp.la +2 -2
- casadi/libOsiCommonTests.1.13.9.dylib +0 -0
- casadi/libOsiCommonTests.1.dylib +0 -0
- casadi/libOsiCommonTests.dylib +0 -0
- casadi/libOsiCommonTests.la +2 -2
- casadi/libblasfeo.dylib +0 -0
- casadi/libbonmin.4.8.9.dylib +0 -0
- casadi/libbonmin.4.dylib +0 -0
- casadi/libbonmin.dylib +0 -0
- casadi/libbonmin.la +2 -2
- casadi/libc++.1.0.dylib +0 -0
- casadi/libcasadi.3.7.dylib +0 -0
- casadi/libcasadi.dylib +0 -0
- casadi/libcasadi_conic_cbc.3.7.dylib +0 -0
- casadi/libcasadi_conic_cbc.dylib +0 -0
- casadi/libcasadi_conic_clp.3.7.dylib +0 -0
- casadi/libcasadi_conic_clp.dylib +0 -0
- casadi/libcasadi_conic_cplex.3.7.dylib +0 -0
- casadi/libcasadi_conic_cplex.dylib +0 -0
- casadi/libcasadi_conic_daqp.3.7.dylib +0 -0
- casadi/libcasadi_conic_daqp.dylib +0 -0
- casadi/libcasadi_conic_fatrop.3.7.dylib +0 -0
- casadi/libcasadi_conic_fatrop.dylib +0 -0
- casadi/libcasadi_conic_gurobi.3.7.dylib +0 -0
- casadi/libcasadi_conic_gurobi.dylib +0 -0
- casadi/libcasadi_conic_highs.3.7.dylib +0 -0
- casadi/libcasadi_conic_highs.dylib +0 -0
- casadi/libcasadi_conic_ipqp.3.7.dylib +0 -0
- casadi/libcasadi_conic_ipqp.dylib +0 -0
- casadi/libcasadi_conic_nlpsol.3.7.dylib +0 -0
- casadi/libcasadi_conic_nlpsol.dylib +0 -0
- casadi/libcasadi_conic_osqp.3.7.dylib +0 -0
- casadi/libcasadi_conic_osqp.dylib +0 -0
- casadi/libcasadi_conic_proxqp.3.7.dylib +0 -0
- casadi/libcasadi_conic_proxqp.dylib +0 -0
- casadi/libcasadi_conic_qpoases.3.7.dylib +0 -0
- casadi/libcasadi_conic_qpoases.dylib +0 -0
- casadi/libcasadi_conic_qrqp.3.7.dylib +0 -0
- casadi/libcasadi_conic_qrqp.dylib +0 -0
- casadi/libcasadi_conic_superscs.3.7.dylib +0 -0
- casadi/libcasadi_conic_superscs.dylib +0 -0
- casadi/libcasadi_importer_shell.3.7.dylib +0 -0
- casadi/libcasadi_importer_shell.dylib +0 -0
- casadi/libcasadi_integrator_collocation.3.7.dylib +0 -0
- casadi/libcasadi_integrator_collocation.dylib +0 -0
- casadi/libcasadi_integrator_cvodes.3.7.dylib +0 -0
- casadi/libcasadi_integrator_cvodes.dylib +0 -0
- casadi/libcasadi_integrator_idas.3.7.dylib +0 -0
- casadi/libcasadi_integrator_idas.dylib +0 -0
- casadi/libcasadi_integrator_rk.3.7.dylib +0 -0
- casadi/libcasadi_integrator_rk.dylib +0 -0
- casadi/libcasadi_interpolant_bspline.3.7.dylib +0 -0
- casadi/libcasadi_interpolant_bspline.dylib +0 -0
- casadi/libcasadi_interpolant_linear.3.7.dylib +0 -0
- casadi/libcasadi_interpolant_linear.dylib +0 -0
- casadi/libcasadi_linsol_csparse.3.7.dylib +0 -0
- casadi/libcasadi_linsol_csparse.dylib +0 -0
- casadi/libcasadi_linsol_csparsecholesky.3.7.dylib +0 -0
- casadi/libcasadi_linsol_csparsecholesky.dylib +0 -0
- casadi/libcasadi_linsol_lapacklu.3.7.dylib +0 -0
- casadi/libcasadi_linsol_lapacklu.dylib +0 -0
- casadi/libcasadi_linsol_lapackqr.3.7.dylib +0 -0
- casadi/libcasadi_linsol_lapackqr.dylib +0 -0
- casadi/libcasadi_linsol_ldl.3.7.dylib +0 -0
- casadi/libcasadi_linsol_ldl.dylib +0 -0
- casadi/libcasadi_linsol_lsqr.3.7.dylib +0 -0
- casadi/libcasadi_linsol_lsqr.dylib +0 -0
- casadi/libcasadi_linsol_ma27.3.7.dylib +0 -0
- casadi/libcasadi_linsol_ma27.dylib +0 -0
- casadi/libcasadi_linsol_mumps.3.7.dylib +0 -0
- casadi/libcasadi_linsol_mumps.dylib +0 -0
- casadi/libcasadi_linsol_qr.3.7.dylib +0 -0
- casadi/libcasadi_linsol_qr.dylib +0 -0
- casadi/libcasadi_linsol_symbolicqr.3.7.dylib +0 -0
- casadi/libcasadi_linsol_symbolicqr.dylib +0 -0
- casadi/libcasadi_linsol_tridiag.3.7.dylib +0 -0
- casadi/libcasadi_linsol_tridiag.dylib +0 -0
- casadi/libcasadi_nlpsol_ampl.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_ampl.dylib +0 -0
- casadi/libcasadi_nlpsol_blocksqp.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_blocksqp.dylib +0 -0
- casadi/libcasadi_nlpsol_bonmin.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_bonmin.dylib +0 -0
- casadi/libcasadi_nlpsol_fatrop.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_fatrop.dylib +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.dylib +0 -0
- casadi/libcasadi_nlpsol_ipopt.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_ipopt.dylib +0 -0
- casadi/libcasadi_nlpsol_knitro.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_knitro.dylib +0 -0
- casadi/libcasadi_nlpsol_madnlp.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_madnlp.dylib +0 -0
- casadi/libcasadi_nlpsol_qrsqp.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_qrsqp.dylib +0 -0
- casadi/libcasadi_nlpsol_scpgen.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_scpgen.dylib +0 -0
- casadi/libcasadi_nlpsol_sleqp.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_sleqp.dylib +0 -0
- casadi/libcasadi_nlpsol_snopt.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_snopt.dylib +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.dylib +0 -0
- casadi/libcasadi_rootfinder_fast_newton.3.7.dylib +0 -0
- casadi/libcasadi_rootfinder_fast_newton.dylib +0 -0
- casadi/libcasadi_rootfinder_kinsol.3.7.dylib +0 -0
- casadi/libcasadi_rootfinder_kinsol.dylib +0 -0
- casadi/libcasadi_rootfinder_newton.3.7.dylib +0 -0
- casadi/libcasadi_rootfinder_newton.dylib +0 -0
- casadi/libcasadi_rootfinder_nlpsol.3.7.dylib +0 -0
- casadi/libcasadi_rootfinder_nlpsol.dylib +0 -0
- casadi/libcasadi_sundials_common.3.7.dylib +0 -0
- casadi/libcasadi_sundials_common.dylib +0 -0
- casadi/libcasadi_xmlfile_tinyxml.3.7.dylib +0 -0
- casadi/libcasadi_xmlfile_tinyxml.dylib +0 -0
- casadi/libcoinmetis.2.dylib +0 -0
- casadi/libcoinmetis.dylib +0 -0
- casadi/libcoinmetis.la +1 -1
- casadi/libcoinmumps.3.dylib +0 -0
- casadi/libcoinmumps.dylib +0 -0
- casadi/libcoinmumps.la +2 -2
- casadi/libcplex_adaptor.dylib +0 -0
- casadi/{libamd.3.0.3.dylib → libdaqp.dylib} +0 -0
- casadi/libdaqpstat.a +0 -0
- casadi/libfatrop.dylib +0 -0
- casadi/libgcc_s.1.1.dylib +0 -0
- casadi/libgfortran.5.dylib +0 -0
- casadi/libgurobi_adaptor.dylib +0 -0
- casadi/libhighs.1.7.dylib +0 -0
- casadi/libhighs.1.dylib +0 -0
- casadi/libhighs.dylib +0 -0
- casadi/libindirect.a +0 -0
- casadi/libipopt.3.dylib +0 -0
- casadi/libipopt.dylib +0 -0
- casadi/libipopt.la +2 -2
- casadi/liblinsys.a +0 -0
- casadi/{libsuitesparseconfig.7.0.1.dylib → libmatlab_ipc.dylib} +0 -0
- casadi/libosqp.a +0 -0
- casadi/libosqp.dylib +0 -0
- casadi/libqdldl.a +0 -0
- casadi/libqdldl.dylib +0 -0
- casadi/libquadmath.0.dylib +0 -0
- casadi/libsipopt.3.dylib +0 -0
- casadi/libsipopt.dylib +0 -0
- casadi/libsipopt.la +2 -2
- casadi/libsleqp.1.0.1.dylib +0 -0
- casadi/libsleqp.dylib +0 -0
- casadi/libsuperscs.a +0 -0
- casadi/libtrlib.0.4.dylib +0 -0
- casadi/libtrlib.dylib +0 -0
- casadi/libz.1.2.13.dylib +0 -0
- casadi/pkgconfig/bonmin.pc +1 -1
- casadi/pkgconfig/casadi.pc +5 -5
- casadi/pkgconfig/cbc.pc +1 -1
- casadi/pkgconfig/cgl.pc +1 -1
- casadi/pkgconfig/clp.pc +1 -1
- casadi/pkgconfig/coinmetis.pc +1 -1
- casadi/pkgconfig/coinmumps.pc +2 -2
- casadi/pkgconfig/coinutils.pc +2 -2
- casadi/pkgconfig/highs.pc +4 -4
- casadi/pkgconfig/ipopt.pc +2 -2
- casadi/pkgconfig/osi-cbc.pc +1 -1
- casadi/pkgconfig/osi-clp.pc +1 -1
- casadi/pkgconfig/osi-unittests.pc +1 -1
- casadi/pkgconfig/osi.pc +1 -1
- casadi/pkgconfig/sleqp.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 +532 -477
- casadi/cmake/alpaqa/alpaqaConfig.cmake +0 -24
- casadi/cmake/alpaqa/alpaqaConfigVersion.cmake +0 -70
- casadi/cmake/alpaqa/alpaqaTargets-release.cmake +0 -19
- casadi/cmake/alpaqa/alpaqaTargets.cmake +0 -116
- casadi/include/alpaqa/accelerators/anderson.hpp +0 -133
- casadi/include/alpaqa/accelerators/internal/anderson-helpers.hpp +0 -92
- casadi/include/alpaqa/accelerators/internal/limited-memory-qr.hpp +0 -295
- casadi/include/alpaqa/accelerators/lbfgs.hpp +0 -244
- casadi/include/alpaqa/accelerators/steihaugcg.hpp +0 -143
- casadi/include/alpaqa/alpaqa.hpp +0 -3
- casadi/include/alpaqa/casadi/CasADiControlProblem.hpp +0 -185
- casadi/include/alpaqa/casadi/CasADiFunctionWrapper.hpp +0 -104
- casadi/include/alpaqa/casadi/CasADiProblem.hpp +0 -102
- casadi/include/alpaqa/casadi-loader-export.hpp +0 -15
- casadi/include/alpaqa/casadi-ocp-loader-export.hpp +0 -15
- casadi/include/alpaqa/config/config.hpp +0 -165
- casadi/include/alpaqa/dl/dl-problem.h +0 -476
- casadi/include/alpaqa/dl/dl-problem.hpp +0 -301
- casadi/include/alpaqa/export.h +0 -42
- casadi/include/alpaqa/export.hpp +0 -30
- casadi/include/alpaqa/implementation/accelerators/lbfgs.tpp +0 -240
- casadi/include/alpaqa/implementation/casadi/CasADiControlProblem.tpp +0 -594
- casadi/include/alpaqa/implementation/casadi/CasADiLoader-util.hpp +0 -50
- casadi/include/alpaqa/implementation/casadi/CasADiProblem.tpp +0 -425
- casadi/include/alpaqa/implementation/inner/directions/panoc/structured-lbfgs.tpp +0 -164
- casadi/include/alpaqa/implementation/inner/panoc-helpers.tpp +0 -389
- casadi/include/alpaqa/implementation/inner/panoc-ocp.tpp +0 -798
- casadi/include/alpaqa/implementation/inner/panoc.tpp +0 -448
- casadi/include/alpaqa/implementation/inner/pantr.tpp +0 -474
- casadi/include/alpaqa/implementation/inner/zerofpr.tpp +0 -482
- casadi/include/alpaqa/implementation/outer/alm.tpp +0 -228
- casadi/include/alpaqa/implementation/outer/internal/alm-helpers.tpp +0 -80
- casadi/include/alpaqa/implementation/params/params.tpp +0 -158
- casadi/include/alpaqa/implementation/problem/ocproblem.tpp +0 -56
- casadi/include/alpaqa/implementation/problem/type-erased-problem.tpp +0 -211
- casadi/include/alpaqa/implementation/util/io/csv.tpp +0 -120
- casadi/include/alpaqa/implementation/util/print.tpp +0 -151
- casadi/include/alpaqa/inner/directions/panoc/anderson.hpp +0 -98
- casadi/include/alpaqa/inner/directions/panoc/lbfgs.hpp +0 -94
- casadi/include/alpaqa/inner/directions/panoc/structured-lbfgs.hpp +0 -146
- casadi/include/alpaqa/inner/directions/panoc/structured-newton.hpp +0 -264
- casadi/include/alpaqa/inner/directions/panoc-direction-update.hpp +0 -96
- casadi/include/alpaqa/inner/directions/panoc-ocp/lqr.hpp +0 -181
- casadi/include/alpaqa/inner/directions/panoc-ocp/ocp-vars.hpp +0 -492
- casadi/include/alpaqa/inner/directions/pantr/newton-tr.hpp +0 -192
- casadi/include/alpaqa/inner/directions/pantr/pantr-direction.hpp +0 -99
- casadi/include/alpaqa/inner/inner-solve-options.hpp +0 -30
- casadi/include/alpaqa/inner/internal/lipschitz.hpp +0 -27
- casadi/include/alpaqa/inner/internal/panoc-helpers.hpp +0 -10
- casadi/include/alpaqa/inner/internal/panoc-stop-crit.hpp +0 -124
- casadi/include/alpaqa/inner/internal/solverstatus.hpp +0 -42
- casadi/include/alpaqa/inner/panoc-ocp.hpp +0 -302
- casadi/include/alpaqa/inner/panoc.hpp +0 -274
- casadi/include/alpaqa/inner/pantr.hpp +0 -284
- casadi/include/alpaqa/inner/zerofpr.hpp +0 -274
- casadi/include/alpaqa/ipopt/ipopt-adapter.hpp +0 -81
- casadi/include/alpaqa/ipopt/ipopt-enums.hpp +0 -35
- casadi/include/alpaqa/lbfgsb/lbfgsb-adapter.hpp +0 -111
- casadi/include/alpaqa/newton-tr-pantr-alm.hpp +0 -27
- casadi/include/alpaqa/outer/alm.hpp +0 -190
- casadi/include/alpaqa/outer/internal/alm-helpers.hpp +0 -10
- casadi/include/alpaqa/panoc-alm.hpp +0 -27
- casadi/include/alpaqa/panoc-anderson-alm.hpp +0 -27
- casadi/include/alpaqa/params/params.hpp +0 -60
- casadi/include/alpaqa/problem/box-constr-problem.hpp +0 -220
- casadi/include/alpaqa/problem/box.hpp +0 -82
- casadi/include/alpaqa/problem/functional-problem.hpp +0 -73
- casadi/include/alpaqa/problem/kkt-error.hpp +0 -43
- casadi/include/alpaqa/problem/ocproblem-counters.hpp +0 -116
- casadi/include/alpaqa/problem/ocproblem.hpp +0 -662
- casadi/include/alpaqa/problem/problem-counters.hpp +0 -116
- casadi/include/alpaqa/problem/problem-with-counters.hpp +0 -141
- casadi/include/alpaqa/problem/type-erased-problem.hpp +0 -874
- casadi/include/alpaqa/problem/unconstr-problem.hpp +0 -37
- casadi/include/alpaqa/structured-panoc-alm.hpp +0 -27
- casadi/include/alpaqa/structured-zerofpr-alm.hpp +0 -27
- casadi/include/alpaqa/util/alloc-check.hpp +0 -23
- casadi/include/alpaqa/util/atomic-stop-signal.hpp +0 -24
- casadi/include/alpaqa/util/check-dim.hpp +0 -64
- casadi/include/alpaqa/util/copyable_unique_ptr.hpp +0 -32
- casadi/include/alpaqa/util/demangled-typename.hpp +0 -9
- casadi/include/alpaqa/util/enumerate.hpp +0 -70
- casadi/include/alpaqa/util/float.hpp +0 -25
- casadi/include/alpaqa/util/index-set.hpp +0 -97
- casadi/include/alpaqa/util/io/csv.hpp +0 -43
- casadi/include/alpaqa/util/iter-adapter.hpp +0 -68
- casadi/include/alpaqa/util/max-history.hpp +0 -47
- casadi/include/alpaqa/util/noop-delete.hpp +0 -15
- casadi/include/alpaqa/util/not-implemented.hpp +0 -12
- casadi/include/alpaqa/util/print.hpp +0 -78
- casadi/include/alpaqa/util/quadmath/quadmath-print.hpp +0 -20
- casadi/include/alpaqa/util/quadmath/quadmath.hpp +0 -137
- casadi/include/alpaqa/util/required-method.hpp +0 -29
- casadi/include/alpaqa/util/ringbuffer.hpp +0 -212
- casadi/include/alpaqa/util/set-intersection.hpp +0 -129
- casadi/include/alpaqa/util/sparse-ops.hpp +0 -164
- casadi/include/alpaqa/util/timed.hpp +0 -22
- casadi/include/alpaqa/util/type-erasure.hpp +0 -568
- casadi/include/alpaqa/util/type-traits.hpp +0 -58
- casadi/include/alpaqa/zerofpr-alm.hpp +0 -27
- casadi/include/alpaqa/zerofpr-anderson-alm.hpp +0 -27
- casadi/include/alpaqa-version.h +0 -8
- casadi/include/highs/fortran/highs_fortran_api.mod +0 -0
- casadi/include/licenses/alpaqa-external/src/thirdparty/lbfgsb/Lbfgsb.3.0/License.txt +0 -71
- casadi/libFortranHighs.dylib +0 -0
- casadi/libalpaqa.1.0.0.dylib +0 -0
- casadi/libalpaqa.dylib +0 -0
- casadi/libcamd.3.0.3.dylib +0 -0
- casadi/libcasadi_nlpsol_alpaqa.3.7.dylib +0 -0
- casadi/libcasadi_nlpsol_alpaqa.dylib +0 -0
- casadi/libccolamd.3.0.3.dylib +0 -0
- casadi/libcholmod.4.0.3.dylib +0 -0
- casadi/libcholmod_cuda.4.0.3.dylib +0 -0
- casadi/libcolamd.3.0.3.dylib +0 -0
- casadi/libhighs.1.6.0.dylib +0 -0
- casadi/libhighs.1.6.dylib +0 -0
- casadi/libumfpack.6.1.0.dylib +0 -0
- {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/WHEEL +0 -0
@@ -1,798 +0,0 @@
|
|
1
|
-
#include <alpaqa/accelerators/lbfgs.hpp>
|
2
|
-
#include <alpaqa/config/config.hpp>
|
3
|
-
#include <alpaqa/implementation/util/print.tpp>
|
4
|
-
#include <alpaqa/inner/directions/panoc-ocp/lqr.hpp>
|
5
|
-
#include <alpaqa/inner/directions/panoc-ocp/ocp-vars.hpp>
|
6
|
-
#include <alpaqa/inner/panoc-ocp.hpp>
|
7
|
-
#include <alpaqa/problem/box.hpp>
|
8
|
-
#include <alpaqa/problem/ocproblem.hpp>
|
9
|
-
#include <alpaqa/util/index-set.hpp>
|
10
|
-
#include <alpaqa/util/timed.hpp>
|
11
|
-
#include <concepts>
|
12
|
-
#include <iomanip>
|
13
|
-
#include <iostream>
|
14
|
-
#include <numeric>
|
15
|
-
#include <stdexcept>
|
16
|
-
#include <type_traits>
|
17
|
-
|
18
|
-
namespace alpaqa {
|
19
|
-
|
20
|
-
template <Config Conf>
|
21
|
-
auto PANOCOCPProgressInfo<Conf>::u() const -> vec {
|
22
|
-
return detail::extract_u(*problem, xu);
|
23
|
-
}
|
24
|
-
|
25
|
-
template <Config Conf>
|
26
|
-
auto PANOCOCPProgressInfo<Conf>::x() const -> vec {
|
27
|
-
return detail::extract_x(*problem, xu);
|
28
|
-
}
|
29
|
-
|
30
|
-
template <Config Conf>
|
31
|
-
auto PANOCOCPProgressInfo<Conf>::û() const -> vec {
|
32
|
-
return detail::extract_u(*problem, x̂u);
|
33
|
-
}
|
34
|
-
|
35
|
-
template <Config Conf>
|
36
|
-
auto PANOCOCPProgressInfo<Conf>::x̂() const -> vec {
|
37
|
-
return detail::extract_x(*problem, x̂u);
|
38
|
-
}
|
39
|
-
|
40
|
-
template <Config Conf>
|
41
|
-
std::string PANOCOCPSolver<Conf>::get_name() const {
|
42
|
-
return "PANOCOCPSolver<" + std::string(config_t::get_name()) + '>';
|
43
|
-
}
|
44
|
-
|
45
|
-
template <Config Conf>
|
46
|
-
auto PANOCOCPSolver<Conf>::operator()(
|
47
|
-
/// [in] Problem description
|
48
|
-
const Problem &problem,
|
49
|
-
/// [in] Solve options
|
50
|
-
const SolveOptions &opts,
|
51
|
-
/// [inout] Decision variable @f$ u @f$
|
52
|
-
rvec u,
|
53
|
-
/// [inout] Lagrange multipliers @f$ y @f$
|
54
|
-
rvec y,
|
55
|
-
/// [in] Penalty factors @f$ \mu @f$
|
56
|
-
crvec μ,
|
57
|
-
/// [out] Slack variable error @f$ c(x) - \Pi_D(c(x) + \mu^{-1} y) @f$
|
58
|
-
rvec err_z) -> Stats {
|
59
|
-
|
60
|
-
if (opts.check)
|
61
|
-
problem.check();
|
62
|
-
|
63
|
-
using std::chrono::nanoseconds;
|
64
|
-
auto os = opts.os ? opts.os : this->os;
|
65
|
-
auto start_time = std::chrono::steady_clock::now();
|
66
|
-
Stats s;
|
67
|
-
|
68
|
-
const auto N = problem.get_N();
|
69
|
-
const auto nu = problem.get_nu();
|
70
|
-
const auto nx = problem.get_nx();
|
71
|
-
const auto nc = problem.get_nc();
|
72
|
-
const auto nc_N = problem.get_nc_N();
|
73
|
-
const auto n = nu * N;
|
74
|
-
|
75
|
-
bool enable_lbfgs = params.gn_interval != 1;
|
76
|
-
|
77
|
-
// Allocate storage --------------------------------------------------------
|
78
|
-
|
79
|
-
// TODO: the L-BFGS objects and vectors allocate on each iteration of ALM,
|
80
|
-
// and there are more vectors than strictly necessary.
|
81
|
-
|
82
|
-
OCPEvaluator<config_t> eval{problem};
|
83
|
-
auto &vars = eval.vars;
|
84
|
-
alpaqa::detail::IndexSet<config_t> J{N, nu};
|
85
|
-
using LQRFactor = alpaqa::StatefulLQRFactor<config_t>;
|
86
|
-
LQRFactor lqr{{.N = N, .nx = nx, .nu = nu}};
|
87
|
-
LBFGS<config_t> lbfgs{params.lbfgs_params, enable_lbfgs ? n : 0};
|
88
|
-
mat jacs = vars.create_AB();
|
89
|
-
vec qr = vars.create_qr();
|
90
|
-
|
91
|
-
vec q(n); // Newton step, including states
|
92
|
-
Box<config_t> U = Box<config_t>::NaN(nu);
|
93
|
-
Box<config_t> D = Box<config_t>::NaN(nc);
|
94
|
-
Box<config_t> D_N = Box<config_t>::NaN(nc_N);
|
95
|
-
|
96
|
-
// Workspace storage
|
97
|
-
vec work_2x(nx * 2);
|
98
|
-
|
99
|
-
// ALM
|
100
|
-
assert(μ.size() == nc * N + nc_N);
|
101
|
-
assert(y.size() == nc * N + nc_N);
|
102
|
-
|
103
|
-
// Functions for accessing the LQR matrices and index sets
|
104
|
-
auto ABk = [&](index_t i) -> crmat { return vars.ABk(jacs, i); };
|
105
|
-
auto Qk = [&](rvec storage) {
|
106
|
-
return [&, storage](index_t k) {
|
107
|
-
return [&, k](rmat out) {
|
108
|
-
alpaqa::util::Timed t{s.time_hessians};
|
109
|
-
return eval.Qk(storage, y, μ, D, D_N, k, out);
|
110
|
-
};
|
111
|
-
};
|
112
|
-
};
|
113
|
-
auto Rk = [&](rvec storage) {
|
114
|
-
return [&, storage](index_t k) {
|
115
|
-
return [&, k](crindexvec mask, rmat out) {
|
116
|
-
alpaqa::util::Timed t{s.time_hessians};
|
117
|
-
return eval.Rk(storage, k, mask, out);
|
118
|
-
};
|
119
|
-
};
|
120
|
-
};
|
121
|
-
auto Sk = [&](rvec storage) {
|
122
|
-
return [&, storage](index_t k) {
|
123
|
-
return [&, k](crindexvec mask, rmat out) {
|
124
|
-
alpaqa::util::Timed t{s.time_hessians};
|
125
|
-
return eval.Sk(storage, k, mask, out);
|
126
|
-
};
|
127
|
-
};
|
128
|
-
};
|
129
|
-
auto Rk_prod = [&](rvec storage) {
|
130
|
-
return [&, storage](index_t k) {
|
131
|
-
return [&, k](crindexvec mask_J, crindexvec mask_K, crvec v,
|
132
|
-
rvec out) {
|
133
|
-
alpaqa::util::Timed t{s.time_hessians};
|
134
|
-
return eval.Rk_prod(storage, k, mask_J, mask_K, v, out);
|
135
|
-
};
|
136
|
-
};
|
137
|
-
};
|
138
|
-
auto Sk_prod = [&](rvec storage) {
|
139
|
-
return [&, storage](index_t k) {
|
140
|
-
return [&, k](crindexvec mask_K, crvec v, rvec out) {
|
141
|
-
alpaqa::util::Timed t{s.time_hessians};
|
142
|
-
return eval.Sk_prod(storage, k, mask_K, v, out);
|
143
|
-
};
|
144
|
-
};
|
145
|
-
};
|
146
|
-
auto mut_qrk = [&](index_t k) -> rvec { return vars.qrk(qr, k); };
|
147
|
-
auto mut_q_N = [&]() -> rvec { return vars.qk(qr, N); };
|
148
|
-
auto qk = [&](index_t k) -> crvec { return vars.qk(qr, k); };
|
149
|
-
auto rk = [&](index_t k) -> crvec { return vars.rk(qr, k); };
|
150
|
-
auto uk_eq = [&](index_t k) -> crvec { return q.segment(k * nu, nu); };
|
151
|
-
auto Jk = [&](index_t k) -> crindexvec { return J.indices(k); };
|
152
|
-
auto Kk = [&](index_t k) -> crindexvec { return J.compl_indices(k); };
|
153
|
-
|
154
|
-
// Iterates ----------------------------------------------------------------
|
155
|
-
|
156
|
-
// Represents an iterate in the algorithm, keeping track of some
|
157
|
-
// intermediate values and function evaluations.
|
158
|
-
struct Iterate {
|
159
|
-
vec xu; //< Inputs u interleaved with states x
|
160
|
-
vec xû; //< Inputs u interleaved with states x after prox grad
|
161
|
-
vec grad_ψ; //< Gradient of cost in u
|
162
|
-
vec p; //< Proximal gradient step in u
|
163
|
-
vec u; //< Inputs u (used for L-BFGS only)
|
164
|
-
real_t ψu = NaN<config_t>; //< Cost in u
|
165
|
-
real_t ψû = NaN<config_t>; //< Cost in û
|
166
|
-
real_t γ = NaN<config_t>; //< Step size γ
|
167
|
-
real_t L = NaN<config_t>; //< Lipschitz estimate L
|
168
|
-
real_t pᵀp = NaN<config_t>; //< Norm squared of p
|
169
|
-
real_t grad_ψᵀp = NaN<config_t>; //< Dot product of gradient and p
|
170
|
-
|
171
|
-
// @pre @ref ψu, @ref pᵀp, @pre grad_ψᵀp
|
172
|
-
// @return φγ
|
173
|
-
real_t fbe() const { return ψu + pᵀp / (2 * γ) + grad_ψᵀp; }
|
174
|
-
|
175
|
-
Iterate(const OCPVariables<config_t> &vars, bool enable_lbfgs)
|
176
|
-
: xu{vars.create()}, xû{vars.create()}, grad_ψ{vars.N * vars.nu()},
|
177
|
-
p{vars.N * vars.nu()}, u{enable_lbfgs ? vars.N * vars.nu() : 0} {}
|
178
|
-
} iterates[2]{
|
179
|
-
{vars, enable_lbfgs},
|
180
|
-
{vars, enable_lbfgs},
|
181
|
-
};
|
182
|
-
Iterate *curr = &iterates[0];
|
183
|
-
Iterate *next = &iterates[1];
|
184
|
-
|
185
|
-
// Helper functions --------------------------------------------------------
|
186
|
-
|
187
|
-
auto eval_proj_grad_step_box = [&U](real_t γ, crvec x, crvec grad_ψ, rvec x̂,
|
188
|
-
rvec p) {
|
189
|
-
using binary_real_f = real_t (*)(real_t, real_t);
|
190
|
-
p = (-γ * grad_ψ)
|
191
|
-
.binaryExpr(U.lowerbound - x, binary_real_f(std::fmax))
|
192
|
-
.binaryExpr(U.upperbound - x, binary_real_f(std::fmin));
|
193
|
-
x̂ = x + p;
|
194
|
-
};
|
195
|
-
|
196
|
-
auto eval_prox_impl = [&](real_t γ, crvec xu, crvec grad_ψ, rvec x̂u,
|
197
|
-
rvec p) {
|
198
|
-
alpaqa::util::Timed t{s.time_prox};
|
199
|
-
real_t pᵀp = 0;
|
200
|
-
real_t grad_ψᵀp = 0;
|
201
|
-
for (index_t t = 0; t < N; ++t) {
|
202
|
-
auto &&grad_ψ_t = grad_ψ.segment(t * nu, nu);
|
203
|
-
auto &&p_t = p.segment(t * nu, nu);
|
204
|
-
eval_proj_grad_step_box(γ, vars.uk(xu, t), grad_ψ_t,
|
205
|
-
/* in ⟹ out */ vars.uk(x̂u, t), p_t);
|
206
|
-
// Calculate ∇ψ(x)ᵀp and ‖p‖²
|
207
|
-
pᵀp += p_t.squaredNorm();
|
208
|
-
grad_ψᵀp += grad_ψ_t.dot(p_t);
|
209
|
-
}
|
210
|
-
return std::make_tuple(pᵀp, grad_ψᵀp);
|
211
|
-
};
|
212
|
-
|
213
|
-
auto calc_error_stop_crit = [this, &eval_prox_impl](
|
214
|
-
real_t γ, crvec xuₖ, crvec grad_ψₖ,
|
215
|
-
crvec pₖ, real_t pₖᵀpₖ, rvec work_xu,
|
216
|
-
rvec work_p) {
|
217
|
-
switch (params.stop_crit) {
|
218
|
-
case PANOCStopCrit::ProjGradNorm: {
|
219
|
-
return vec_util::norm_inf(pₖ);
|
220
|
-
}
|
221
|
-
case PANOCStopCrit::ProjGradNorm2: {
|
222
|
-
return std::sqrt(pₖᵀpₖ);
|
223
|
-
}
|
224
|
-
case PANOCStopCrit::ProjGradUnitNorm: {
|
225
|
-
eval_prox_impl(1, xuₖ, grad_ψₖ, work_xu, work_p);
|
226
|
-
return vec_util::norm_inf(work_p);
|
227
|
-
}
|
228
|
-
case PANOCStopCrit::ProjGradUnitNorm2: {
|
229
|
-
auto [pTp, gTp] =
|
230
|
-
eval_prox_impl(1, xuₖ, grad_ψₖ, work_xu, work_p);
|
231
|
-
return std::sqrt(pTp);
|
232
|
-
}
|
233
|
-
case PANOCStopCrit::FPRNorm: {
|
234
|
-
return vec_util::norm_inf(pₖ) / γ;
|
235
|
-
}
|
236
|
-
case PANOCStopCrit::FPRNorm2: {
|
237
|
-
return std::sqrt(pₖᵀpₖ) / γ;
|
238
|
-
}
|
239
|
-
case PANOCStopCrit::ApproxKKT: [[fallthrough]];
|
240
|
-
case PANOCStopCrit::ApproxKKT2: [[fallthrough]];
|
241
|
-
case PANOCStopCrit::Ipopt: [[fallthrough]];
|
242
|
-
case PANOCStopCrit::LBFGSBpp: [[fallthrough]];
|
243
|
-
default:
|
244
|
-
throw std::invalid_argument("Unsupported stopping criterion");
|
245
|
-
}
|
246
|
-
};
|
247
|
-
|
248
|
-
auto check_all_stop_conditions =
|
249
|
-
[this, &opts](
|
250
|
-
/// [in] Time elapsed since the start of the algorithm
|
251
|
-
auto time_elapsed,
|
252
|
-
/// [in] The current iteration number
|
253
|
-
unsigned iteration,
|
254
|
-
/// [in] Tolerance of the current iterate
|
255
|
-
real_t εₖ,
|
256
|
-
/// [in] The number of successive iterations no progress was made
|
257
|
-
unsigned no_progress) {
|
258
|
-
auto max_time = params.max_time;
|
259
|
-
if (opts.max_time)
|
260
|
-
max_time = std::min(max_time, *opts.max_time);
|
261
|
-
auto tolerance = opts.tolerance > 0 ? opts.tolerance : real_t(1e-8);
|
262
|
-
bool out_of_time = time_elapsed > max_time;
|
263
|
-
bool out_of_iter = iteration == params.max_iter;
|
264
|
-
bool interrupted = stop_signal.stop_requested();
|
265
|
-
bool not_finite = not std::isfinite(εₖ);
|
266
|
-
bool conv = εₖ <= tolerance;
|
267
|
-
bool max_no_progress = no_progress > params.max_no_progress;
|
268
|
-
return conv ? SolverStatus::Converged
|
269
|
-
: out_of_time ? SolverStatus::MaxTime
|
270
|
-
: out_of_iter ? SolverStatus::MaxIter
|
271
|
-
: not_finite ? SolverStatus::NotFinite
|
272
|
-
: max_no_progress ? SolverStatus::NoProgress
|
273
|
-
: interrupted ? SolverStatus::Interrupted
|
274
|
-
: SolverStatus::Busy;
|
275
|
-
};
|
276
|
-
|
277
|
-
auto assign_interleave_xu = [&vars](crvec u, rvec xu) {
|
278
|
-
detail::assign_interleave_xu(vars, u, xu);
|
279
|
-
};
|
280
|
-
auto assign_extract_u = [&vars](crvec xu, rvec u) {
|
281
|
-
detail::assign_extract_u(vars, xu, u);
|
282
|
-
};
|
283
|
-
|
284
|
-
auto write_solution = [&](Iterate &it) {
|
285
|
-
// Update multipliers and constraint error
|
286
|
-
if (nc > 0 || nc_N > 0) {
|
287
|
-
for (index_t t = 0; t < N; ++t) {
|
288
|
-
auto ct = vars.ck(it.xû, t);
|
289
|
-
auto yt = y.segment(nc * t, nc);
|
290
|
-
auto μt = μ.segment(nc * t, nc);
|
291
|
-
auto ζ = ct + μt.asDiagonal().inverse() * yt;
|
292
|
-
auto et = err_z.segment(nc * t, nc);
|
293
|
-
et = projecting_difference(ζ, D);
|
294
|
-
et -= μt.asDiagonal().inverse() * yt;
|
295
|
-
yt += μt.asDiagonal() * et;
|
296
|
-
}
|
297
|
-
auto ct = vars.ck(it.xû, N);
|
298
|
-
auto yt = y.segment(nc * N, nc_N);
|
299
|
-
auto μt = μ.segment(nc * N, nc_N);
|
300
|
-
auto ζ = ct + μt.asDiagonal().inverse() * yt;
|
301
|
-
auto et = err_z.segment(nc * N, nc_N);
|
302
|
-
et = projecting_difference(ζ, D_N);
|
303
|
-
et -= μt.asDiagonal().inverse() * yt;
|
304
|
-
yt += μt.asDiagonal() * et;
|
305
|
-
}
|
306
|
-
assign_extract_u(it.xû, u);
|
307
|
-
};
|
308
|
-
|
309
|
-
// @pre @ref Iterate::γ, @ref Iterate::xu, @ref Iterate::grad_ψ
|
310
|
-
// @post @ref Iterate::xû, @ref Iterate::p, @ref Iterate::pᵀp,
|
311
|
-
// @ref Iterate::grad_ψᵀp
|
312
|
-
auto eval_prox = [&](Iterate &i) {
|
313
|
-
std::tie(i.pᵀp, i.grad_ψᵀp) =
|
314
|
-
eval_prox_impl(i.γ, i.xu, i.grad_ψ, i.xû, i.p);
|
315
|
-
};
|
316
|
-
|
317
|
-
// @pre @ref Iterate::xu
|
318
|
-
// @post @ref Iterate::ψu
|
319
|
-
auto eval_forward = [&](Iterate &i) {
|
320
|
-
alpaqa::util::Timed t{s.time_forward};
|
321
|
-
i.ψu = eval.forward(i.xu, D, D_N, μ, y);
|
322
|
-
};
|
323
|
-
// @pre @ref Iterate::xû
|
324
|
-
// @post @ref Iterate::ψû
|
325
|
-
auto eval_forward_hat = [&](Iterate &i) {
|
326
|
-
alpaqa::util::Timed t{s.time_forward};
|
327
|
-
i.ψû = eval.forward(i.xû, D, D_N, μ, y);
|
328
|
-
};
|
329
|
-
|
330
|
-
// @pre @ref Iterate::xu
|
331
|
-
// @post @ref Iterate::grad_ψ, q, q_N
|
332
|
-
auto eval_backward = [&](Iterate &i) {
|
333
|
-
alpaqa::util::Timed t{s.time_backward};
|
334
|
-
eval.backward(i.xu, i.grad_ψ, mut_qrk, mut_q_N, D, D_N, μ, y);
|
335
|
-
};
|
336
|
-
|
337
|
-
auto qub_violated = [this](const Iterate &i) {
|
338
|
-
real_t margin =
|
339
|
-
(1 + std::abs(i.ψu)) * params.quadratic_upperbound_tolerance_factor;
|
340
|
-
return i.ψû > i.ψu + i.grad_ψᵀp + real_t(0.5) * i.L * i.pᵀp + margin;
|
341
|
-
};
|
342
|
-
|
343
|
-
auto linesearch_violated = [this](const Iterate &curr,
|
344
|
-
const Iterate &next) {
|
345
|
-
real_t β = params.linesearch_strictness_factor;
|
346
|
-
real_t σ = β * (1 - curr.γ * curr.L) / (2 * curr.γ);
|
347
|
-
real_t φγ = curr.fbe();
|
348
|
-
real_t margin = (1 + std::abs(φγ)) * params.linesearch_tolerance_factor;
|
349
|
-
return next.fbe() > φγ - σ * curr.pᵀp + margin;
|
350
|
-
};
|
351
|
-
|
352
|
-
auto initial_lipschitz_estimate =
|
353
|
-
[&](
|
354
|
-
/// Iterate, updates xu, ψ, grad_ψ, have_jacobians, L
|
355
|
-
Iterate *it,
|
356
|
-
/// [in] Finite difference step size relative to x
|
357
|
-
real_t ε,
|
358
|
-
/// [in] Minimum absolute finite difference step size
|
359
|
-
real_t δ,
|
360
|
-
/// [in] Minimum allowed Lipschitz estimate.
|
361
|
-
real_t L_min,
|
362
|
-
/// [in] Maximum allowed Lipschitz estimate.
|
363
|
-
real_t L_max,
|
364
|
-
/// Workspace with the same dimensions as xu, with x_init
|
365
|
-
rvec work_xu,
|
366
|
-
/// Workspace with the same dimensions as grad_ψ
|
367
|
-
rvec work_grad_ψ) {
|
368
|
-
// Calculate ψ(x₀), ∇ψ(x₀)
|
369
|
-
eval_forward(*it);
|
370
|
-
eval_backward(*it);
|
371
|
-
// Select a small step h for finite differences
|
372
|
-
auto h = it->grad_ψ.unaryExpr([&](real_t g) {
|
373
|
-
return g > 0 ? std::max(g * ε, δ) : std::min(g * ε, -δ);
|
374
|
-
});
|
375
|
-
real_t norm_h = h.norm();
|
376
|
-
// work_xu = xu - h
|
377
|
-
for (index_t t = 0; t < N; ++t)
|
378
|
-
vars.uk(work_xu, t) =
|
379
|
-
vars.uk(it->xu, t) - h.segment(t * nu, nu);
|
380
|
-
|
381
|
-
{ // Calculate ψ(x₀ - h)
|
382
|
-
alpaqa::util::Timed t{s.time_forward};
|
383
|
-
eval.forward_simulate(work_xu); // needed for backwards sweep
|
384
|
-
}
|
385
|
-
{ // Calculate ∇ψ(x₀ + h)
|
386
|
-
alpaqa::util::Timed t{s.time_backward};
|
387
|
-
eval.backward(work_xu, work_grad_ψ, mut_qrk, mut_q_N, D, D_N, μ,
|
388
|
-
y);
|
389
|
-
}
|
390
|
-
// Estimate Lipschitz constant using finite differences
|
391
|
-
it->L = (work_grad_ψ - it->grad_ψ).norm() / norm_h;
|
392
|
-
it->L = std::clamp(it->L, L_min, L_max);
|
393
|
-
};
|
394
|
-
|
395
|
-
// Printing ----------------------------------------------------------------
|
396
|
-
|
397
|
-
std::array<char, 64> print_buf;
|
398
|
-
auto print_real = [&](real_t x) {
|
399
|
-
return float_to_str_vw(print_buf, x, params.print_precision);
|
400
|
-
};
|
401
|
-
auto print_real3 = [&](real_t x) {
|
402
|
-
return float_to_str_vw(print_buf, x, 3);
|
403
|
-
};
|
404
|
-
auto print_progress_1 = [&](unsigned k, real_t φₖ, real_t ψₖ, crvec grad_ψₖ,
|
405
|
-
real_t pₖᵀpₖ, real_t γₖ, real_t εₖ) {
|
406
|
-
if (k == 0)
|
407
|
-
*os << "┌─[PANOCOCP]\n";
|
408
|
-
else
|
409
|
-
*os << "├─ " << std::setw(6) << k << '\n';
|
410
|
-
*os << "│ φγ = " << print_real(φₖ) //
|
411
|
-
<< ", ψ = " << print_real(ψₖ) //
|
412
|
-
<< ", ‖∇ψ‖ = " << print_real(grad_ψₖ.norm()) //
|
413
|
-
<< ", ‖p‖ = " << print_real(std::sqrt(pₖᵀpₖ)) //
|
414
|
-
<< ", γ = " << print_real(γₖ) //
|
415
|
-
<< ", ε = " << print_real(εₖ) << '\n';
|
416
|
-
};
|
417
|
-
auto print_progress_2 = [&](crvec qₖ, real_t τₖ, bool did_gn, length_t nJ,
|
418
|
-
real_t min_rcond, bool reject) {
|
419
|
-
const char *color = τₖ == 1 ? "\033[0;32m"
|
420
|
-
: τₖ > 0 ? "\033[0;33m"
|
421
|
-
: "\033[0;35m";
|
422
|
-
*os << "│ ‖q‖ = " << print_real(qₖ.norm()) //
|
423
|
-
<< ", #J = " << std::setw(7 + params.print_precision) << nJ //
|
424
|
-
<< ", cond = " << print_real3(real_t(1) / min_rcond) //
|
425
|
-
<< ", τ = " << color << print_real3(τₖ) << "\033[0m" //
|
426
|
-
<< ", " << (did_gn ? "GN" : "L-BFGS") //
|
427
|
-
<< ", dir update "
|
428
|
-
<< (reject ? "\033[0;31mrejected\033[0m"
|
429
|
-
: "\033[0;32maccepted\033[0m") //
|
430
|
-
<< std::endl; // Flush for Python buffering
|
431
|
-
};
|
432
|
-
auto print_progress_n = [&](SolverStatus status) {
|
433
|
-
*os << "└─ " << status << " ──"
|
434
|
-
<< std::endl; // Flush for Python buffering
|
435
|
-
};
|
436
|
-
|
437
|
-
auto do_progress_cb = [this, &s, &problem, &lqr,
|
438
|
-
&opts](unsigned k, Iterate &curr, crvec q, real_t τ,
|
439
|
-
real_t εₖ, bool did_gn, index_t nJ,
|
440
|
-
SolverStatus status) {
|
441
|
-
if (!progress_cb)
|
442
|
-
return;
|
443
|
-
ScopedMallocAllower ma;
|
444
|
-
alpaqa::util::Timed t{s.time_progress_callback};
|
445
|
-
progress_cb({
|
446
|
-
.k = k,
|
447
|
-
.status = status,
|
448
|
-
.xu = curr.xu,
|
449
|
-
.p = curr.p,
|
450
|
-
.norm_sq_p = curr.pᵀp,
|
451
|
-
.x̂u = curr.xû,
|
452
|
-
.φγ = curr.fbe(),
|
453
|
-
.ψ = curr.ψu,
|
454
|
-
.grad_ψ = curr.grad_ψ,
|
455
|
-
.ψ_hat = curr.ψû,
|
456
|
-
.q = q,
|
457
|
-
.gn = did_gn,
|
458
|
-
.nJ = nJ,
|
459
|
-
.lqr_min_rcond = lqr.min_rcond,
|
460
|
-
.L = curr.L,
|
461
|
-
.γ = curr.γ,
|
462
|
-
.τ = status == SolverStatus::Busy ? τ : NaN<config_t>,
|
463
|
-
.ε = εₖ,
|
464
|
-
.outer_iter = opts.outer_iter,
|
465
|
-
.problem = &problem,
|
466
|
-
.params = ¶ms,
|
467
|
-
});
|
468
|
-
};
|
469
|
-
|
470
|
-
// Initialize inputs and initial state (do not simulate states yet) --------
|
471
|
-
|
472
|
-
assign_interleave_xu(u, curr->xu); // initial guess
|
473
|
-
problem.get_x_init(curr->xu.topRows(nx)); // initial state
|
474
|
-
curr->xû.topRows(nx) = curr->xu.topRows(nx); // initial state
|
475
|
-
next->xu.topRows(nx) = curr->xu.topRows(nx); // initial state
|
476
|
-
next->xû.topRows(nx) = curr->xu.topRows(nx); // initial state
|
477
|
-
if (enable_lbfgs)
|
478
|
-
curr->u = u;
|
479
|
-
|
480
|
-
problem.get_U(U); // input box constraints
|
481
|
-
problem.get_D(D); // general constraints
|
482
|
-
problem.get_D_N(D_N); // general terminal constraints
|
483
|
-
|
484
|
-
bool do_gn_step = params.gn_interval > 0 and !params.disable_acceleration;
|
485
|
-
bool did_gn = false;
|
486
|
-
|
487
|
-
// Make sure that we don't allocate any memory in the inner loop
|
488
|
-
ScopedMallocBlocker mb;
|
489
|
-
|
490
|
-
// Estimate Lipschitz constant ---------------------------------------------
|
491
|
-
|
492
|
-
// Finite difference approximation of ∇²ψ in starting point
|
493
|
-
if (params.Lipschitz.L_0 <= 0) {
|
494
|
-
initial_lipschitz_estimate(curr, params.Lipschitz.ε, params.Lipschitz.δ,
|
495
|
-
params.L_min, params.L_max, next->xu,
|
496
|
-
next->grad_ψ);
|
497
|
-
}
|
498
|
-
// Initial Lipschitz constant provided by the user
|
499
|
-
else {
|
500
|
-
curr->L = params.Lipschitz.L_0;
|
501
|
-
// Calculate ψ(x₀), ∇ψ(x₀)
|
502
|
-
eval_forward(*curr);
|
503
|
-
eval_backward(*curr);
|
504
|
-
}
|
505
|
-
if (not std::isfinite(curr->L)) {
|
506
|
-
s.status = SolverStatus::NotFinite;
|
507
|
-
return s;
|
508
|
-
}
|
509
|
-
curr->γ = params.Lipschitz.Lγ_factor / curr->L;
|
510
|
-
eval_prox(*curr);
|
511
|
-
eval_forward_hat(*curr);
|
512
|
-
|
513
|
-
unsigned k = 0;
|
514
|
-
real_t τ = NaN<config_t>;
|
515
|
-
length_t nJ = -1;
|
516
|
-
|
517
|
-
// Keep track of how many successive iterations didn't update the iterate
|
518
|
-
unsigned no_progress = 0;
|
519
|
-
|
520
|
-
// Main PANOC loop
|
521
|
-
// =========================================================================
|
522
|
-
while (true) {
|
523
|
-
|
524
|
-
// Check stop condition ------------------------------------------------
|
525
|
-
|
526
|
-
real_t εₖ = calc_error_stop_crit(curr->γ, curr->xu, curr->grad_ψ,
|
527
|
-
curr->p, curr->pᵀp, next->xû, next->p);
|
528
|
-
|
529
|
-
// Print progress ------------------------------------------------------
|
530
|
-
bool do_print =
|
531
|
-
params.print_interval != 0 && k % params.print_interval == 0;
|
532
|
-
if (do_print)
|
533
|
-
print_progress_1(k, curr->fbe(), curr->ψu, curr->grad_ψ, curr->pᵀp,
|
534
|
-
curr->γ, εₖ);
|
535
|
-
|
536
|
-
// Return solution -----------------------------------------------------
|
537
|
-
|
538
|
-
auto time_elapsed = std::chrono::steady_clock::now() - start_time;
|
539
|
-
auto stop_status =
|
540
|
-
check_all_stop_conditions(time_elapsed, k, εₖ, no_progress);
|
541
|
-
if (stop_status != SolverStatus::Busy) {
|
542
|
-
do_progress_cb(k, *curr, null_vec<config_t>, -1, εₖ, false, 0,
|
543
|
-
stop_status);
|
544
|
-
bool do_final_print = params.print_interval != 0;
|
545
|
-
if (!do_print && do_final_print)
|
546
|
-
print_progress_1(k, curr->fbe(), curr->ψu, curr->grad_ψ,
|
547
|
-
curr->pᵀp, curr->γ, εₖ);
|
548
|
-
if (do_print || do_final_print)
|
549
|
-
print_progress_n(stop_status);
|
550
|
-
if (stop_status == SolverStatus::Converged ||
|
551
|
-
stop_status == SolverStatus::Interrupted ||
|
552
|
-
opts.always_overwrite_results) {
|
553
|
-
write_solution(*curr);
|
554
|
-
}
|
555
|
-
s.iterations = k;
|
556
|
-
s.ε = εₖ;
|
557
|
-
s.elapsed_time = duration_cast<nanoseconds>(time_elapsed);
|
558
|
-
s.time_lqr_factor -= s.time_hessians;
|
559
|
-
s.status = stop_status;
|
560
|
-
s.final_γ = curr->γ;
|
561
|
-
s.final_ψ = curr->ψû;
|
562
|
-
s.final_h = 0; // only box constraints
|
563
|
-
s.final_φγ = curr->fbe();
|
564
|
-
return s;
|
565
|
-
}
|
566
|
-
|
567
|
-
// Calculate Gauss-Newton step -----------------------------------------
|
568
|
-
|
569
|
-
real_t τ_init = 1;
|
570
|
-
did_gn = do_gn_step;
|
571
|
-
if (params.disable_acceleration) {
|
572
|
-
τ_init = 0;
|
573
|
-
} else if (do_gn_step) {
|
574
|
-
auto is_constr_inactive = [&](index_t t, index_t i) {
|
575
|
-
real_t ui = vars.uk(curr->xu, t)(i);
|
576
|
-
// Gradient descent step.
|
577
|
-
real_t gs = ui - curr->γ * curr->grad_ψ(t * nu + i);
|
578
|
-
// Check whether the box constraints are active for this index.
|
579
|
-
bool active_lb = gs <= U.lowerbound(i);
|
580
|
-
bool active_ub = gs >= U.upperbound(i);
|
581
|
-
if (active_ub) {
|
582
|
-
q(nu * t + i) = U.upperbound(i) - ui;
|
583
|
-
return false;
|
584
|
-
} else if (active_lb) {
|
585
|
-
q(nu * t + i) = U.lowerbound(i) - ui;
|
586
|
-
return false;
|
587
|
-
} else { // Store inactive indices
|
588
|
-
return true;
|
589
|
-
}
|
590
|
-
};
|
591
|
-
{ // Find active indices J
|
592
|
-
alpaqa::util::Timed t{s.time_indices};
|
593
|
-
J.update(is_constr_inactive);
|
594
|
-
nJ = J.sizes().sum();
|
595
|
-
}
|
596
|
-
{ // evaluate the Jacobians
|
597
|
-
alpaqa::util::Timed t{s.time_jacobians};
|
598
|
-
for (index_t t = 0; t < N; ++t)
|
599
|
-
problem.eval_jac_f(t, vars.xk(curr->xu, t),
|
600
|
-
vars.uk(curr->xu, t), vars.ABk(jacs, t));
|
601
|
-
}
|
602
|
-
{ // LQR factor
|
603
|
-
alpaqa::util::Timed t{s.time_lqr_factor};
|
604
|
-
lqr.factor_masked(ABk, Qk(curr->xu), Rk(curr->xu), Sk(curr->xu),
|
605
|
-
Rk_prod(curr->xu), Sk_prod(curr->xu), qk, rk,
|
606
|
-
uk_eq, Jk, Kk, params.lqr_factor_cholesky);
|
607
|
-
}
|
608
|
-
{ // LQR solve
|
609
|
-
alpaqa::util::Timed t{s.time_lqr_solve};
|
610
|
-
lqr.solve_masked(ABk, Jk, q, work_2x);
|
611
|
-
}
|
612
|
-
} else {
|
613
|
-
if (!enable_lbfgs)
|
614
|
-
throw std::logic_error("enable_lbfgs");
|
615
|
-
|
616
|
-
// Find inactive indices J
|
617
|
-
auto is_constr_inactive = [&](index_t t, index_t i) {
|
618
|
-
real_t ui = vars.uk(curr->xu, t)(i);
|
619
|
-
real_t grad_i = curr->grad_ψ(t * nu + i);
|
620
|
-
// Gradient descent step.
|
621
|
-
real_t gs = ui - curr->γ * grad_i;
|
622
|
-
// Check whether the box constraints are active for this index.
|
623
|
-
bool active_lb = gs <= U.lowerbound(i);
|
624
|
-
bool active_ub = gs >= U.upperbound(i);
|
625
|
-
if (active_ub || active_lb) {
|
626
|
-
q(t * nu + i) = curr->p(t * nu + i);
|
627
|
-
return false;
|
628
|
-
} else { // Store inactive indices
|
629
|
-
q(t * nu + i) = -grad_i;
|
630
|
-
return true;
|
631
|
-
}
|
632
|
-
};
|
633
|
-
|
634
|
-
auto J_idx = J.indices();
|
635
|
-
nJ = 0;
|
636
|
-
{
|
637
|
-
alpaqa::util::Timed t{s.time_lbfgs_indices};
|
638
|
-
for (index_t t = 0; t < N; ++t)
|
639
|
-
for (index_t i = 0; i < nu; ++i)
|
640
|
-
if (is_constr_inactive(t, i))
|
641
|
-
J_idx(nJ++) = t * nu + i;
|
642
|
-
}
|
643
|
-
auto J_lbfgs = J_idx.topRows(nJ);
|
644
|
-
|
645
|
-
// If all indices are inactive, we can use standard L-BFGS,
|
646
|
-
// if there are active indices, we need the specialized version
|
647
|
-
// that only applies L-BFGS to the inactive indices
|
648
|
-
bool success = [&] {
|
649
|
-
alpaqa::util::Timed t{s.time_lbfgs_apply};
|
650
|
-
return lbfgs.apply_masked(q, curr->γ, J_lbfgs);
|
651
|
-
}();
|
652
|
-
// If L-BFGS application failed, qₖ(J) still contains
|
653
|
-
// -∇ψ(x)(J) - HqK(J) or -∇ψ(x)(J), which is not a valid step.
|
654
|
-
if (not success)
|
655
|
-
τ_init = 0;
|
656
|
-
}
|
657
|
-
|
658
|
-
// Make sure quasi-Newton step is valid
|
659
|
-
if (not q.allFinite()) {
|
660
|
-
τ_init = 0;
|
661
|
-
// Is there anything we can do?
|
662
|
-
if (not did_gn)
|
663
|
-
lbfgs.reset();
|
664
|
-
}
|
665
|
-
s.lbfgs_failures += (τ_init == 0 && k > 0);
|
666
|
-
|
667
|
-
bool do_next_gn = params.gn_interval > 0 &&
|
668
|
-
((k + 1) % params.gn_interval) == 0 &&
|
669
|
-
!params.disable_acceleration;
|
670
|
-
do_gn_step = do_next_gn || (do_gn_step && params.gn_sticky);
|
671
|
-
|
672
|
-
// Line search ---------------------------------------------------------
|
673
|
-
|
674
|
-
next->γ = curr->γ;
|
675
|
-
next->L = curr->L;
|
676
|
-
τ = τ_init;
|
677
|
-
real_t τ_prev = -1;
|
678
|
-
bool dir_rejected = true;
|
679
|
-
|
680
|
-
// xₖ₊₁ = xₖ + pₖ
|
681
|
-
auto take_safe_step = [&] {
|
682
|
-
next->xu = curr->xû;
|
683
|
-
next->ψu = curr->ψû;
|
684
|
-
// Calculate ∇ψ(xₖ₊₁)
|
685
|
-
eval_backward(*next);
|
686
|
-
};
|
687
|
-
|
688
|
-
// xₖ₊₁ = xₖ + (1-τ) pₖ + τ qₖ
|
689
|
-
auto take_accelerated_step = [&](real_t τ) {
|
690
|
-
if (τ == 1) {
|
691
|
-
for (index_t t = 0; t < N; ++t)
|
692
|
-
vars.uk(next->xu, t) =
|
693
|
-
vars.uk(curr->xu, t) + q.segment(t * nu, nu);
|
694
|
-
} else {
|
695
|
-
do_gn_step = do_next_gn;
|
696
|
-
for (index_t t = 0; t < N; ++t)
|
697
|
-
vars.uk(next->xu, t) =
|
698
|
-
vars.uk(curr->xu, t) +
|
699
|
-
(1 - τ) * curr->p.segment(t * nu, nu) +
|
700
|
-
τ * q.segment(t * nu, nu);
|
701
|
-
}
|
702
|
-
// Calculate ψ(xₖ₊₁), ∇ψ(xₖ₊₁)
|
703
|
-
eval_forward(*next); // Not necessary for DDP
|
704
|
-
eval_backward(*next);
|
705
|
-
};
|
706
|
-
|
707
|
-
// Backtracking line search loop
|
708
|
-
while (!stop_signal.stop_requested()) {
|
709
|
-
|
710
|
-
// Recompute step only if τ changed
|
711
|
-
if (τ != τ_prev) {
|
712
|
-
τ != 0 ? take_accelerated_step(τ) : take_safe_step();
|
713
|
-
τ_prev = τ;
|
714
|
-
}
|
715
|
-
|
716
|
-
// If the cost is not finite, or if the quadratic upper bound could
|
717
|
-
// not be satisfied, abandon the direction entirely, don't even
|
718
|
-
// bother backtracking.
|
719
|
-
bool fail = next->L >= params.L_max || !std::isfinite(next->ψu);
|
720
|
-
if (τ > 0 && fail) {
|
721
|
-
// Don't allow a bad accelerated step to destroy the FBS step
|
722
|
-
// size
|
723
|
-
next->L = curr->L;
|
724
|
-
next->γ = curr->γ;
|
725
|
-
// Line search failed
|
726
|
-
τ = 0;
|
727
|
-
if (enable_lbfgs)
|
728
|
-
lbfgs.reset();
|
729
|
-
continue;
|
730
|
-
}
|
731
|
-
|
732
|
-
// Calculate x̂ₖ₊₁, ψ(x̂ₖ₊₁)
|
733
|
-
eval_prox(*next);
|
734
|
-
eval_forward_hat(*next);
|
735
|
-
|
736
|
-
// Quadratic upper bound step size condition
|
737
|
-
if (next->L < params.L_max && qub_violated(*next)) {
|
738
|
-
next->γ /= 2;
|
739
|
-
next->L *= 2;
|
740
|
-
if (τ > 0)
|
741
|
-
τ = τ_init;
|
742
|
-
++s.stepsize_backtracks;
|
743
|
-
continue;
|
744
|
-
}
|
745
|
-
|
746
|
-
// Line search condition
|
747
|
-
if (τ > 0 && linesearch_violated(*curr, *next)) {
|
748
|
-
τ /= 2;
|
749
|
-
if (τ < params.min_linesearch_coefficient)
|
750
|
-
τ = 0;
|
751
|
-
++s.linesearch_backtracks;
|
752
|
-
continue;
|
753
|
-
}
|
754
|
-
|
755
|
-
// QUB and line search satisfied (or τ is 0 and L > L_max)
|
756
|
-
break;
|
757
|
-
}
|
758
|
-
|
759
|
-
// If τ < τ_min the line search failed and we accepted the prox step
|
760
|
-
s.linesearch_failures += (τ == 0 && τ_init > 0);
|
761
|
-
s.τ_1_accepted += τ == 1;
|
762
|
-
s.count_τ += (τ_init > 0);
|
763
|
-
s.sum_τ += τ;
|
764
|
-
|
765
|
-
// Check if we made any progress
|
766
|
-
if (no_progress > 0 || k % params.max_no_progress == 0)
|
767
|
-
no_progress = curr->xu == next->xu ? no_progress + 1 : 0;
|
768
|
-
|
769
|
-
// Update L-BFGS -------------------------------------------------------
|
770
|
-
|
771
|
-
if (enable_lbfgs) {
|
772
|
-
const bool force = true;
|
773
|
-
assign_extract_u(next->xu, next->u);
|
774
|
-
bool reset_because_gn = did_gn && params.reset_lbfgs_on_gn_step;
|
775
|
-
if (reset_because_gn || curr->γ != next->γ) {
|
776
|
-
lbfgs.reset();
|
777
|
-
}
|
778
|
-
if (!reset_because_gn) { // TODO: this may be too restrictive
|
779
|
-
alpaqa::util::Timed t{s.time_lbfgs_update};
|
780
|
-
s.lbfgs_rejected += dir_rejected = not lbfgs.update(
|
781
|
-
curr->u, next->u, curr->grad_ψ, next->grad_ψ,
|
782
|
-
LBFGS<config_t>::Sign::Positive, force);
|
783
|
-
}
|
784
|
-
}
|
785
|
-
|
786
|
-
// Print ---------------------------------------------------------------
|
787
|
-
do_progress_cb(k, *curr, q, τ, εₖ, did_gn, nJ, SolverStatus::Busy);
|
788
|
-
if (do_print && (k != 0 || did_gn))
|
789
|
-
print_progress_2(q, τ, did_gn, nJ, lqr.min_rcond, dir_rejected);
|
790
|
-
|
791
|
-
// Advance step --------------------------------------------------------
|
792
|
-
std::swap(curr, next);
|
793
|
-
++k;
|
794
|
-
}
|
795
|
-
throw std::logic_error("[PANOC] loop error");
|
796
|
-
}
|
797
|
-
|
798
|
-
} // namespace alpaqa
|