casadi 3.6.4__cp312-none-manylinux2014_i686.whl → 3.6.6__cp312-none-manylinux2014_i686.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 +984 -500
- casadi/cbc +0 -0
- casadi/clp +0 -0
- casadi/cmake/casadi-config-version.cmake +1 -1
- casadi/cmake/highs/highs-config.cmake +6 -13
- casadi/cmake/highs/highs-targets-release.cmake +13 -13
- casadi/cmake/highs/highs-targets.cmake +13 -10
- casadi/highs +0 -0
- casadi/include/casadi/casadi.i +33 -15
- 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 +13 -0
- casadi/include/casadi/core/casadi_types.hpp +3 -2
- casadi/include/casadi/core/code_generator.hpp +59 -2
- casadi/include/casadi/core/core.hpp +1 -0
- casadi/include/casadi/core/generic_expression.hpp +1 -1
- casadi/include/casadi/core/generic_type.hpp +25 -1
- casadi/include/casadi/core/global_options.hpp +2 -0
- casadi/include/casadi/core/matrix_decl.hpp +15 -0
- casadi/include/casadi/core/mx.hpp +13 -3
- casadi/include/casadi/core/optistack.hpp +23 -0
- casadi/include/casadi/core/runtime/casadi_nlp.hpp +133 -6
- 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/runtime/casadi_sqpmethod.hpp +11 -1
- casadi/include/casadi/core/serializing_stream.hpp +2 -2
- casadi/include/casadi/core/sparsity.hpp +12 -3
- casadi/include/casadi/core/tools.hpp +67 -0
- casadi/include/casadi/doc.i +2283 -1491
- casadi/include/casadi/doc_merged.i +1522 -1065
- casadi/include/casadi/mem.h +1 -0
- casadi/include/coin-or/IpAlgBuilder.hpp +417 -0
- casadi/include/coin-or/IpAlgStrategy.hpp +201 -0
- casadi/include/coin-or/IpAlgTypes.hpp +64 -0
- casadi/include/coin-or/IpAugSystemSolver.hpp +212 -0
- casadi/include/coin-or/IpBlas.hpp +426 -0
- casadi/include/coin-or/IpCachedResults.hpp +897 -0
- casadi/include/coin-or/IpCompoundMatrix.hpp +423 -0
- casadi/include/coin-or/IpCompoundSymMatrix.hpp +348 -0
- casadi/include/coin-or/IpCompoundVector.hpp +395 -0
- casadi/include/coin-or/IpConvCheck.hpp +97 -0
- casadi/include/coin-or/IpDebug.hpp +167 -0
- casadi/include/coin-or/IpDenseVector.hpp +626 -0
- casadi/include/coin-or/IpDiagMatrix.hpp +158 -0
- casadi/include/coin-or/IpEqMultCalculator.hpp +76 -0
- casadi/include/coin-or/IpException.hpp +156 -0
- casadi/include/coin-or/IpExpansionMatrix.hpp +245 -0
- casadi/include/coin-or/IpGenTMatrix.hpp +290 -0
- casadi/include/coin-or/IpHessianUpdater.hpp +73 -0
- casadi/include/coin-or/IpIdentityMatrix.hpp +167 -0
- casadi/include/coin-or/IpIpoptAlg.hpp +257 -0
- casadi/include/coin-or/IpIpoptApplication.hpp +367 -0
- casadi/include/coin-or/IpIpoptCalculatedQuantities.hpp +1009 -0
- casadi/include/coin-or/IpIpoptData.hpp +966 -0
- casadi/include/coin-or/IpIpoptNLP.hpp +328 -0
- casadi/include/coin-or/IpIterateInitializer.hpp +68 -0
- casadi/include/coin-or/IpIteratesVector.hpp +840 -0
- casadi/include/coin-or/IpIterationOutput.hpp +78 -0
- casadi/include/coin-or/IpJournalist.hpp +573 -0
- casadi/include/coin-or/IpLapack.hpp +227 -0
- casadi/include/coin-or/IpLibraryLoader.hpp +76 -0
- casadi/include/coin-or/IpLineSearch.hpp +106 -0
- casadi/include/coin-or/IpLinearSolvers.h +46 -0
- casadi/include/coin-or/IpMatrix.hpp +434 -0
- casadi/include/coin-or/IpMuUpdate.hpp +77 -0
- casadi/include/coin-or/IpNLP.hpp +306 -0
- casadi/include/coin-or/IpNLPScaling.hpp +582 -0
- casadi/include/coin-or/IpObserver.hpp +422 -0
- casadi/include/coin-or/IpOptionsList.hpp +412 -0
- casadi/include/coin-or/IpOrigIpoptNLP.hpp +603 -0
- casadi/include/coin-or/IpPDSystemSolver.hpp +137 -0
- casadi/include/coin-or/IpReferenced.hpp +262 -0
- casadi/include/coin-or/IpRegOptions.hpp +1152 -0
- casadi/include/coin-or/IpReturnCodes.h +23 -0
- casadi/include/coin-or/IpReturnCodes.hpp +18 -0
- casadi/include/coin-or/IpReturnCodes.inc +71 -0
- casadi/include/coin-or/IpReturnCodes_inc.h +45 -0
- casadi/include/coin-or/IpScaledMatrix.hpp +291 -0
- casadi/include/coin-or/IpSearchDirCalculator.hpp +72 -0
- casadi/include/coin-or/IpSmartPtr.hpp +865 -0
- casadi/include/coin-or/IpSolveStatistics.hpp +210 -0
- casadi/include/coin-or/IpSparseSymLinearSolverInterface.hpp +260 -0
- casadi/include/coin-or/IpStdAugSystemSolver.cpp +555 -0
- casadi/include/coin-or/IpStdCInterface.h +428 -0
- casadi/include/coin-or/IpSumSymMatrix.hpp +186 -0
- casadi/include/coin-or/IpSymLinearSolver.hpp +141 -0
- casadi/include/coin-or/IpSymMatrix.hpp +167 -0
- casadi/include/coin-or/IpSymScaledMatrix.hpp +255 -0
- casadi/include/coin-or/IpSymTMatrix.hpp +275 -0
- casadi/include/coin-or/IpTNLP.hpp +820 -0
- casadi/include/coin-or/IpTNLPAdapter.hpp +648 -0
- casadi/include/coin-or/IpTNLPReducer.hpp +274 -0
- casadi/include/coin-or/IpTaggedObject.hpp +128 -0
- casadi/include/coin-or/IpTimedTask.hpp +218 -0
- casadi/include/coin-or/IpTimingStatistics.hpp +323 -0
- casadi/include/coin-or/IpTripletHelper.hpp +308 -0
- casadi/include/coin-or/IpTypes.h +81 -0
- casadi/include/coin-or/IpTypes.hpp +30 -0
- casadi/include/coin-or/IpUtils.hpp +166 -0
- casadi/include/coin-or/IpVector.hpp +892 -0
- casadi/include/coin-or/IpZeroSymMatrix.hpp +155 -0
- casadi/include/coin-or/IpoptConfig.h +45 -0
- casadi/include/coin-or/SensAlgorithm.hpp +114 -0
- casadi/include/coin-or/SensApplication.hpp +188 -0
- casadi/include/coin-or/SensBacksolver.hpp +36 -0
- casadi/include/coin-or/SensMeasurement.hpp +56 -0
- casadi/include/coin-or/SensPCalculator.hpp +137 -0
- casadi/include/coin-or/SensRegOp.hpp +21 -0
- casadi/include/coin-or/SensSchurData.hpp +182 -0
- casadi/include/coin-or/SensSchurDriver.hpp +118 -0
- casadi/include/coin-or/SensSimpleBacksolver.hpp +49 -0
- casadi/include/coin-or/SensStepCalc.hpp +85 -0
- casadi/include/coin-or/SensUtils.hpp +63 -0
- casadi/include/coin-or/metis/defs.h +161 -0
- casadi/include/coin-or/metis/macros.h +143 -0
- casadi/include/coin-or/metis/metis.h +37 -0
- casadi/include/coin-or/metis/proto.h +505 -0
- casadi/include/coin-or/metis/rename.h +418 -0
- casadi/include/coin-or/metis/struct.h +251 -0
- casadi/include/coin-or/mumps/dmumps_c.h +142 -0
- casadi/include/coin-or/mumps/mumps_c_types.h +72 -0
- casadi/include/coin-or/mumps/mumps_compat.h +27 -0
- casadi/include/coin-or/mumps/mumps_int_def.h +11 -0
- casadi/include/coin-or/mumps/mumps_mpi.h +67 -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/highs/HConfig.h +6 -5
- 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/licenses/daqp-external/LICENSE +21 -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/lib/libtinyxml2.a +0 -0
- casadi/libCbc.so +0 -0
- casadi/libCbc.so.3 +0 -0
- casadi/libCbc.so.3.10.11 +0 -0
- casadi/libCbcSolver.so +0 -0
- casadi/libCbcSolver.so.3 +0 -0
- casadi/libCbcSolver.so.3.10.11 +0 -0
- casadi/libCgl.so +0 -0
- casadi/libCgl.so.1 +0 -0
- casadi/libCgl.so.1.10.8 +0 -0
- casadi/libClp.so +0 -0
- casadi/libClp.so.1 +0 -0
- casadi/libClp.so.1.14.9 +0 -0
- casadi/libClpSolver.so +0 -0
- casadi/libClpSolver.so.1 +0 -0
- casadi/libClpSolver.so.1.14.9 +0 -0
- casadi/libCoinUtils.so +0 -0
- casadi/libCoinUtils.so.3 +0 -0
- casadi/libCoinUtils.so.3.11.10 +0 -0
- casadi/libOsi.so +0 -0
- casadi/libOsi.so.1 +0 -0
- casadi/libOsi.so.1.13.9 +0 -0
- casadi/libOsiCbc.so +0 -0
- casadi/libOsiCbc.so.3 +0 -0
- casadi/libOsiCbc.so.3.10.11 +0 -0
- casadi/libOsiClp.so +0 -0
- casadi/libOsiClp.so.1 +0 -0
- casadi/libOsiClp.so.1.14.9 +0 -0
- casadi/libOsiCommonTests.so +0 -0
- casadi/libOsiCommonTests.so.1 +0 -0
- casadi/libOsiCommonTests.so.1.13.9 +0 -0
- casadi/libbonmin.so +0 -0
- casadi/libbonmin.so.4 +0 -0
- casadi/libbonmin.so.4.8.9 +0 -0
- casadi/libcasadi.so +0 -0
- casadi/libcasadi.so.3.7 +0 -0
- casadi/libcasadi_conic_cbc.so +0 -0
- casadi/libcasadi_conic_cbc.so.3.7 +0 -0
- casadi/libcasadi_conic_clp.so +0 -0
- casadi/libcasadi_conic_clp.so.3.7 +0 -0
- casadi/libcasadi_conic_daqp.so +0 -0
- casadi/libcasadi_conic_daqp.so.3.7 +0 -0
- casadi/libcasadi_conic_gurobi.so +0 -0
- casadi/libcasadi_conic_gurobi.so.3.7 +0 -0
- casadi/libcasadi_conic_highs.so +0 -0
- casadi/libcasadi_conic_highs.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_bonmin.so +0 -0
- casadi/libcasadi_nlpsol_bonmin.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_sleqp.so +0 -0
- casadi/libcasadi_nlpsol_sleqp.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/libdaqp.so +0 -0
- casadi/libdaqpstat.a +0 -0
- casadi/libhighs.so +0 -0
- casadi/libhighs.so.1 +0 -0
- casadi/libhighs.so.1.7.2 +0 -0
- casadi/libindirect.a +0 -0
- casadi/libipopt.so +0 -0
- casadi/libipopt.so.3 +0 -0
- casadi/libipopt.so.3.14.11 +0 -0
- casadi/liblinsys.a +0 -0
- casadi/libmatlab_ipc.so +0 -0
- casadi/libosqp.a +0 -0
- casadi/libosqp.so +0 -0
- casadi/libqdldl.a +0 -0
- casadi/libsipopt.so +0 -0
- casadi/libsipopt.so.3 +0 -0
- casadi/libsipopt.so.3.14.11 +0 -0
- casadi/libsleqp.so +0 -0
- casadi/libsleqp.so.1.0.1 +0 -0
- casadi/libspral.a +0 -0
- casadi/libsuperscs.a +0 -0
- casadi/pkgconfig/casadi.pc +1 -1
- casadi/pkgconfig/highs.pc +1 -1
- casadi/tools/__init__.py +4 -0
- casadi/tools/bounds.py +3 -3
- {casadi-3.6.4.dist-info → casadi-3.6.6.dist-info}/METADATA +12 -4
- {casadi-3.6.4.dist-info → casadi-3.6.6.dist-info}/RECORD +490 -281
- casadi/include/highs/fortran/highs_fortran_api.mod +0 -0
- casadi/libFortranHighs.so +0 -0
- casadi/libhighs.so.1.6 +0 -0
- casadi/libhighs.so.1.6.0 +0 -0
- {casadi-3.6.4.dist-info → casadi-3.6.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,865 @@
|
|
1
|
+
// Copyright (C) 2004, 2011 International Business Machines and others.
|
2
|
+
// All Rights Reserved.
|
3
|
+
// This code is published under the Eclipse Public License.
|
4
|
+
//
|
5
|
+
// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
|
6
|
+
|
7
|
+
#ifndef __IPSMARTPTR_HPP__
|
8
|
+
#define __IPSMARTPTR_HPP__
|
9
|
+
|
10
|
+
#include "IpReferenced.hpp"
|
11
|
+
|
12
|
+
#include "IpDebug.hpp"
|
13
|
+
#if IPOPT_CHECKLEVEL > 2
|
14
|
+
# define IP_DEBUG_SMARTPTR
|
15
|
+
#endif
|
16
|
+
|
17
|
+
namespace Ipopt
|
18
|
+
{
|
19
|
+
|
20
|
+
/** Template class for Smart Pointers.
|
21
|
+
*
|
22
|
+
* A SmartPtr behaves much like a raw pointer, but manages the lifetime
|
23
|
+
* of an object, deleting the object automatically. This class implements
|
24
|
+
* a reference-counting, intrusive smart pointer design, where all
|
25
|
+
* objects pointed to must inherit off of ReferencedObject, which
|
26
|
+
* stores the reference count. Although this is intrusive (native types
|
27
|
+
* and externally authored classes require wrappers to be referenced
|
28
|
+
* by smart pointers), it is a safer design. A more detailed discussion of
|
29
|
+
* these issues follows after the usage information.
|
30
|
+
*
|
31
|
+
* Usage Example:
|
32
|
+
* Note: to use the SmartPtr, all objects to which you point MUST
|
33
|
+
* inherit off of ReferencedObject.
|
34
|
+
*
|
35
|
+
* \verbatim
|
36
|
+
*
|
37
|
+
* In MyClass.hpp...
|
38
|
+
*
|
39
|
+
* #include "IpReferenced.hpp"
|
40
|
+
|
41
|
+
* namespace Ipopt {
|
42
|
+
*
|
43
|
+
* class MyClass : public ReferencedObject // must derive from ReferencedObject
|
44
|
+
* {
|
45
|
+
* ...
|
46
|
+
* }
|
47
|
+
* } // namespace Ipopt
|
48
|
+
*
|
49
|
+
*
|
50
|
+
* In my_usage.cpp...
|
51
|
+
*
|
52
|
+
* #include "IpSmartPtr.hpp"
|
53
|
+
* #include "MyClass.hpp"
|
54
|
+
*
|
55
|
+
* void func(AnyObject& obj)
|
56
|
+
* {
|
57
|
+
* SmartPtr<MyClass> ptr_to_myclass = new MyClass(...);
|
58
|
+
* // ptr_to_myclass now points to a new MyClass,
|
59
|
+
* // and the reference count is 1
|
60
|
+
*
|
61
|
+
* ...
|
62
|
+
*
|
63
|
+
* obj.SetMyClass(ptr_to_myclass);
|
64
|
+
* // Here, let's assume that AnyObject uses a
|
65
|
+
* // SmartPtr<MyClass> internally here.
|
66
|
+
* // Now, both ptr_to_myclass and the internal
|
67
|
+
* // SmartPtr in obj point to the same MyClass object
|
68
|
+
* // and its reference count is 2.
|
69
|
+
*
|
70
|
+
* ...
|
71
|
+
*
|
72
|
+
* // No need to delete ptr_to_myclass, this
|
73
|
+
* // will be done automatically when the
|
74
|
+
* // reference count drops to zero.
|
75
|
+
*
|
76
|
+
* }
|
77
|
+
*
|
78
|
+
* \endverbatim
|
79
|
+
*
|
80
|
+
* It is not necessary to use SmartPtr's in all cases where an
|
81
|
+
* object is used that has been allocated "into" a SmartPtr. It is
|
82
|
+
* possible to just pass objects by reference or regular pointers,
|
83
|
+
* even if lower down in the stack a SmartPtr is to be held on to.
|
84
|
+
* Everything should work fine as long as a pointer created by "new"
|
85
|
+
* is immediately passed into a SmartPtr, and if SmartPtr's are used
|
86
|
+
* to hold on to objects.
|
87
|
+
*
|
88
|
+
* Other Notes:
|
89
|
+
* The SmartPtr implements both dereference operators -> & *.
|
90
|
+
* The SmartPtr does NOT implement a conversion operator to
|
91
|
+
* the raw pointer. Use the GetRawPtr() method when this
|
92
|
+
* is necessary. Make sure that the raw pointer is NOT
|
93
|
+
* deleted.
|
94
|
+
* The SmartPtr implements the comparison operators == & !=
|
95
|
+
* for a variety of types. Use these instead of
|
96
|
+
* \verbatim
|
97
|
+
* if (GetRawPtr(smrt_ptr) == ptr) // Don't use this
|
98
|
+
* \endverbatim
|
99
|
+
* SmartPtr's, as currently implemented, do NOT handle circular references.
|
100
|
+
* For example: consider a higher level object using SmartPtrs to point to
|
101
|
+
* A and B, but A and B also point to each other (i.e. A has a SmartPtr
|
102
|
+
* to B and B has a SmartPtr to A). In this scenario, when the higher
|
103
|
+
* level object is finished with A and B, their reference counts will
|
104
|
+
* never drop to zero (since they reference each other) and they
|
105
|
+
* will not be deleted. This can be detected by memory leak tools like
|
106
|
+
* valgrind. If the circular reference is necessary, the problem can be
|
107
|
+
* overcome by a number of techniques:
|
108
|
+
*
|
109
|
+
* 1) A and B can have a method that "releases" each other, that is
|
110
|
+
* they set their internal SmartPtrs to NULL.
|
111
|
+
* \verbatim
|
112
|
+
* void AClass::ReleaseCircularReferences()
|
113
|
+
* {
|
114
|
+
* smart_ptr_to_B = NULL;
|
115
|
+
* }
|
116
|
+
* \endverbatim
|
117
|
+
* Then, the higher level class can call these methods before
|
118
|
+
* it is done using A & B.
|
119
|
+
*
|
120
|
+
* 2) Raw pointers can be used in A and B to reference each other.
|
121
|
+
* Here, an implicit assumption is made that the lifetime is
|
122
|
+
* controlled by the higher level object and that A and B will
|
123
|
+
* both exist in a controlled manner. Although this seems
|
124
|
+
* dangerous, in many situations, this type of referencing
|
125
|
+
* is very controlled and this is reasonably safe.
|
126
|
+
*
|
127
|
+
* 3) This SmartPtr class could be redesigned with the Weak/Strong
|
128
|
+
* design concept. Here, the SmartPtr is identified as being
|
129
|
+
* Strong (controls lifetime of the object) or Weak (merely
|
130
|
+
* referencing the object). The Strong SmartPtr increments
|
131
|
+
* (and decrements) the reference count in ReferencedObject
|
132
|
+
* but the Weak SmartPtr does not. In the example above,
|
133
|
+
* the higher level object would have Strong SmartPtrs to
|
134
|
+
* A and B, but A and B would have Weak SmartPtrs to each
|
135
|
+
* other. Then, when the higher level object was done with
|
136
|
+
* A and B, they would be deleted. The Weak SmartPtrs in A
|
137
|
+
* and B would not decrement the reference count and would,
|
138
|
+
* of course, not delete the object. This idea is very similar
|
139
|
+
* to item (2), where it is implied that the sequence of events
|
140
|
+
* is controlled such that A and B will not call anything using
|
141
|
+
* their pointers following the higher level delete (i.e. in
|
142
|
+
* their destructors!). This is somehow safer, however, because
|
143
|
+
* code can be written (however expensive) to perform run-time
|
144
|
+
* detection of this situation. For example, the ReferencedObject
|
145
|
+
* could store pointers to all Weak SmartPtrs that are referencing
|
146
|
+
* it and, in its destructor, tell these pointers that it is
|
147
|
+
* dying. They could then set themselves to NULL, or set an
|
148
|
+
* internal flag to detect usage past this point.
|
149
|
+
*
|
150
|
+
* Comments on Non-Intrusive Design:
|
151
|
+
* In a non-intrusive design, the reference count is stored somewhere other
|
152
|
+
* than the object being referenced. This means, unless the reference
|
153
|
+
* counting pointer is the first referencer, it must get a pointer to the
|
154
|
+
* referenced object from another smart pointer (so it has access to the
|
155
|
+
* reference count location). In this non-intrusive design, if we are
|
156
|
+
* pointing to an object with a smart pointer (or a number of smart
|
157
|
+
* pointers), and we then give another smart pointer the address through
|
158
|
+
* a RAW pointer, we will have two independent, AND INCORRECT, reference
|
159
|
+
* counts. To avoid this pitfall, we use an intrusive reference counting
|
160
|
+
* technique where the reference count is stored in the object being
|
161
|
+
* referenced.
|
162
|
+
*/
|
163
|
+
template<class T>
|
164
|
+
class SmartPtr: public Referencer
|
165
|
+
{
|
166
|
+
public:
|
167
|
+
#define ipopt_dbg_smartptr_verbosity 0
|
168
|
+
|
169
|
+
/**@name Constructors/Destructors */
|
170
|
+
///@{
|
171
|
+
/** Default constructor, initialized to NULL */
|
172
|
+
SmartPtr();
|
173
|
+
|
174
|
+
/** Copy constructor, initialized from copy of type T */
|
175
|
+
SmartPtr(
|
176
|
+
const SmartPtr<T>& copy
|
177
|
+
);
|
178
|
+
|
179
|
+
/** Copy constructor, initialized from copy of type U */
|
180
|
+
template<class U>
|
181
|
+
SmartPtr(
|
182
|
+
const SmartPtr<U>& copy
|
183
|
+
);
|
184
|
+
|
185
|
+
/** Constructor, initialized from T* ptr */
|
186
|
+
SmartPtr(
|
187
|
+
T* ptr
|
188
|
+
);
|
189
|
+
|
190
|
+
/** Destructor, automatically decrements the
|
191
|
+
* reference count and deletes the object if
|
192
|
+
* necessary.
|
193
|
+
*/
|
194
|
+
~SmartPtr();
|
195
|
+
///@}
|
196
|
+
|
197
|
+
/**@name Overloaded operators. */
|
198
|
+
///@{
|
199
|
+
/** Overloaded arrow operator, allows the user to call
|
200
|
+
* methods using the contained pointer.
|
201
|
+
*/
|
202
|
+
T* operator->() const;
|
203
|
+
|
204
|
+
/** Overloaded dereference operator, allows the user
|
205
|
+
* to dereference the contained pointer.
|
206
|
+
*/
|
207
|
+
T& operator*() const;
|
208
|
+
|
209
|
+
/** Overloaded equals operator, allows the user to
|
210
|
+
* set the value of the SmartPtr from a raw pointer
|
211
|
+
*/
|
212
|
+
SmartPtr<T>& operator=(
|
213
|
+
T* rhs
|
214
|
+
);
|
215
|
+
|
216
|
+
/** Overloaded equals operator, allows the user to
|
217
|
+
* set the value of the SmartPtr from another
|
218
|
+
* SmartPtr
|
219
|
+
*/
|
220
|
+
SmartPtr<T>& operator=(
|
221
|
+
const SmartPtr<T>& rhs
|
222
|
+
);
|
223
|
+
|
224
|
+
/** Overloaded equals operator, allows the user to
|
225
|
+
* set the value of the SmartPtr from another
|
226
|
+
* SmartPtr of a different type
|
227
|
+
*/
|
228
|
+
template<class U>
|
229
|
+
// cppcheck-suppress operatorEq ; wrong cppcheck suggestion
|
230
|
+
SmartPtr<T>& operator=(
|
231
|
+
const SmartPtr<U>& rhs);
|
232
|
+
|
233
|
+
/** Overloaded equality comparison operator, allows the
|
234
|
+
* user to compare the value of two SmartPtrs
|
235
|
+
*/
|
236
|
+
template<class U1, class U2>
|
237
|
+
friend
|
238
|
+
bool operator==(
|
239
|
+
const SmartPtr<U1>& lhs,
|
240
|
+
const SmartPtr<U2>& rhs
|
241
|
+
);
|
242
|
+
|
243
|
+
/** Overloaded equality comparison operator, allows the
|
244
|
+
* user to compare the value of a SmartPtr with a raw pointer.
|
245
|
+
*/
|
246
|
+
template<class U1, class U2>
|
247
|
+
friend
|
248
|
+
bool operator==(
|
249
|
+
const SmartPtr<U1>& lhs,
|
250
|
+
U2* raw_rhs
|
251
|
+
);
|
252
|
+
|
253
|
+
/** Overloaded equality comparison operator, allows the
|
254
|
+
* user to compare the value of a raw pointer with a SmartPtr.
|
255
|
+
*/
|
256
|
+
template<class U1, class U2>
|
257
|
+
friend
|
258
|
+
bool operator==(
|
259
|
+
U1* lhs,
|
260
|
+
const SmartPtr<U2>& raw_rhs
|
261
|
+
);
|
262
|
+
|
263
|
+
/** Overloaded in-equality comparison operator, allows the
|
264
|
+
* user to compare the value of two SmartPtrs
|
265
|
+
*/
|
266
|
+
template<class U1, class U2>
|
267
|
+
friend
|
268
|
+
bool operator!=(
|
269
|
+
const SmartPtr<U1>& lhs,
|
270
|
+
const SmartPtr<U2>& rhs
|
271
|
+
);
|
272
|
+
|
273
|
+
/** Overloaded in-equality comparison operator, allows the
|
274
|
+
* user to compare the value of a SmartPtr with a raw pointer.
|
275
|
+
*/
|
276
|
+
template<class U1, class U2>
|
277
|
+
friend
|
278
|
+
bool operator!=(
|
279
|
+
const SmartPtr<U1>& lhs,
|
280
|
+
U2* raw_rhs
|
281
|
+
);
|
282
|
+
|
283
|
+
/** Overloaded in-equality comparison operator, allows the
|
284
|
+
* user to compare the value of a SmartPtr with a raw pointer.
|
285
|
+
*/
|
286
|
+
template<class U1, class U2>
|
287
|
+
friend
|
288
|
+
bool operator!=(
|
289
|
+
U1* lhs,
|
290
|
+
const SmartPtr<U2>& raw_rhs
|
291
|
+
);
|
292
|
+
|
293
|
+
/** Overloaded less-than comparison operator, allows the
|
294
|
+
* user to compare the value of two SmartPtrs
|
295
|
+
*/
|
296
|
+
template<class U>
|
297
|
+
friend
|
298
|
+
bool operator<(
|
299
|
+
const SmartPtr<U>& lhs,
|
300
|
+
const SmartPtr<U>& rhs
|
301
|
+
);
|
302
|
+
///@}
|
303
|
+
|
304
|
+
/**@name friend method declarations */
|
305
|
+
///@{
|
306
|
+
/** Returns the raw pointer contained.
|
307
|
+
*
|
308
|
+
* Use to get the value of
|
309
|
+
* the raw ptr (i.e. to pass to other
|
310
|
+
* methods/functions, etc.)
|
311
|
+
* Note: This method does NOT copy,
|
312
|
+
* therefore, modifications using this
|
313
|
+
* value modify the underlying object
|
314
|
+
* contained by the SmartPtr,
|
315
|
+
* NEVER delete this returned value.
|
316
|
+
*/
|
317
|
+
template<class U>
|
318
|
+
friend U* GetRawPtr(
|
319
|
+
const SmartPtr<U>& smart_ptr
|
320
|
+
);
|
321
|
+
|
322
|
+
/** Returns a const pointer */
|
323
|
+
template<class U>
|
324
|
+
friend SmartPtr<const U> ConstPtr(
|
325
|
+
const SmartPtr<U>& smart_ptr
|
326
|
+
);
|
327
|
+
|
328
|
+
/** Returns true if the SmartPtr is NOT NULL.
|
329
|
+
*
|
330
|
+
* Use this to check if the SmartPtr is not NULL.
|
331
|
+
* This is preferred to if(GetRawPtr(sp) != NULL)
|
332
|
+
*/
|
333
|
+
template<class U>
|
334
|
+
friend
|
335
|
+
bool IsValid(
|
336
|
+
const SmartPtr<U>& smart_ptr
|
337
|
+
);
|
338
|
+
|
339
|
+
/** Returns true if the SmartPtr is NULL.
|
340
|
+
*
|
341
|
+
* Use this to check if the SmartPtr is NULL.
|
342
|
+
* This is preferred to if(GetRawPtr(sp) == NULL)
|
343
|
+
*/
|
344
|
+
template<class U>
|
345
|
+
friend
|
346
|
+
bool IsNull(
|
347
|
+
const SmartPtr<U>& smart_ptr
|
348
|
+
);
|
349
|
+
///@}
|
350
|
+
|
351
|
+
private:
|
352
|
+
/**@name Private Data/Methods */
|
353
|
+
///@{
|
354
|
+
/** Actual raw pointer to the object. */
|
355
|
+
T* ptr_;
|
356
|
+
|
357
|
+
/** Set the value of the internal raw pointer
|
358
|
+
* from another raw pointer, releasing the
|
359
|
+
* previously referenced object if necessary.
|
360
|
+
*/
|
361
|
+
SmartPtr<T>& SetFromRawPtr_(
|
362
|
+
T* rhs
|
363
|
+
);
|
364
|
+
|
365
|
+
/** Set the value of the internal raw pointer
|
366
|
+
* from a SmartPtr, releasing the previously referenced
|
367
|
+
* object if necessary.
|
368
|
+
*/
|
369
|
+
SmartPtr<T>& SetFromSmartPtr_(
|
370
|
+
const SmartPtr<T>& rhs
|
371
|
+
);
|
372
|
+
|
373
|
+
/** Release the currently referenced object. */
|
374
|
+
void ReleasePointer_();
|
375
|
+
///@}
|
376
|
+
};
|
377
|
+
|
378
|
+
/**@name SmartPtr friend function declarations */
|
379
|
+
///@{
|
380
|
+
template<class U>
|
381
|
+
U* GetRawPtr(
|
382
|
+
const SmartPtr<U>& smart_ptr
|
383
|
+
);
|
384
|
+
|
385
|
+
template<class U>
|
386
|
+
SmartPtr<const U> ConstPtr(
|
387
|
+
const SmartPtr<U>& smart_ptr
|
388
|
+
);
|
389
|
+
|
390
|
+
template<class U>
|
391
|
+
bool IsNull(
|
392
|
+
const SmartPtr<U>& smart_ptr
|
393
|
+
);
|
394
|
+
|
395
|
+
template<class U>
|
396
|
+
bool IsValid(
|
397
|
+
const SmartPtr<U>& smart_ptr
|
398
|
+
);
|
399
|
+
|
400
|
+
template<class U1, class U2>
|
401
|
+
bool operator==(
|
402
|
+
const SmartPtr<U1>& lhs,
|
403
|
+
const SmartPtr<U2>& rhs
|
404
|
+
);
|
405
|
+
|
406
|
+
template<class U1, class U2>
|
407
|
+
bool operator==(
|
408
|
+
const SmartPtr<U1>& lhs,
|
409
|
+
U2* raw_rhs
|
410
|
+
);
|
411
|
+
|
412
|
+
template<class U1, class U2>
|
413
|
+
bool operator==(
|
414
|
+
U1* lhs,
|
415
|
+
const SmartPtr<U2>& raw_rhs
|
416
|
+
);
|
417
|
+
|
418
|
+
template<class U1, class U2>
|
419
|
+
bool operator!=(
|
420
|
+
const SmartPtr<U1>& lhs,
|
421
|
+
const SmartPtr<U2>& rhs);
|
422
|
+
|
423
|
+
template<class U1, class U2>
|
424
|
+
bool operator!=(
|
425
|
+
const SmartPtr<U1>& lhs,
|
426
|
+
U2* raw_rhs
|
427
|
+
);
|
428
|
+
|
429
|
+
template<class U1, class U2>
|
430
|
+
bool operator!=(
|
431
|
+
U1* lhs,
|
432
|
+
const SmartPtr<U2>& raw_rhs
|
433
|
+
);
|
434
|
+
|
435
|
+
///@}
|
436
|
+
|
437
|
+
template<class T>
|
438
|
+
SmartPtr<T>::SmartPtr()
|
439
|
+
: ptr_(0)
|
440
|
+
{
|
441
|
+
#ifdef IP_DEBUG_SMARTPTR
|
442
|
+
DBG_START_METH("SmartPtr<T>::SmartPtr()", ipopt_dbg_smartptr_verbosity);
|
443
|
+
#endif
|
444
|
+
|
445
|
+
#ifndef NDEBUG
|
446
|
+
// cppcheck-suppress unreadVariable
|
447
|
+
const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_;
|
448
|
+
#endif
|
449
|
+
}
|
450
|
+
|
451
|
+
template<class T>
|
452
|
+
SmartPtr<T>::SmartPtr(
|
453
|
+
const SmartPtr<T>& copy
|
454
|
+
)
|
455
|
+
: ptr_(0)
|
456
|
+
{
|
457
|
+
#ifdef IP_DEBUG_SMARTPTR
|
458
|
+
DBG_START_METH("SmartPtr<T>::SmartPtr(const SmartPtr<T>& copy)", ipopt_dbg_smartptr_verbosity);
|
459
|
+
#endif
|
460
|
+
|
461
|
+
#ifndef NDEBUG
|
462
|
+
// cppcheck-suppress unreadVariable
|
463
|
+
const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ =
|
464
|
+
ptr_;
|
465
|
+
#endif
|
466
|
+
|
467
|
+
(void) SetFromSmartPtr_(copy);
|
468
|
+
}
|
469
|
+
|
470
|
+
template<class T>
|
471
|
+
template<class U>
|
472
|
+
SmartPtr<T>::SmartPtr(
|
473
|
+
const SmartPtr<U>& copy
|
474
|
+
)
|
475
|
+
: ptr_(0)
|
476
|
+
{
|
477
|
+
#ifdef IP_DEBUG_SMARTPTR
|
478
|
+
DBG_START_METH("SmartPtr<T>::SmartPtr(const SmartPtr<U>& copy)", ipopt_dbg_smartptr_verbosity);
|
479
|
+
#endif
|
480
|
+
|
481
|
+
#ifndef NDEBUG
|
482
|
+
// cppcheck-suppress unreadVariable
|
483
|
+
const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ =
|
484
|
+
ptr_;
|
485
|
+
#endif
|
486
|
+
|
487
|
+
(void) SetFromSmartPtr_(GetRawPtr(copy));
|
488
|
+
}
|
489
|
+
|
490
|
+
template<class T>
|
491
|
+
SmartPtr<T>::SmartPtr(
|
492
|
+
T* ptr
|
493
|
+
)
|
494
|
+
: ptr_(0)
|
495
|
+
{
|
496
|
+
#ifdef IP_DEBUG_SMARTPTR
|
497
|
+
DBG_START_METH("SmartPtr<T>::SmartPtr(T* ptr)", ipopt_dbg_smartptr_verbosity);
|
498
|
+
#endif
|
499
|
+
|
500
|
+
#ifndef NDEBUG
|
501
|
+
// cppcheck-suppress unreadVariable
|
502
|
+
const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ =
|
503
|
+
ptr_;
|
504
|
+
#endif
|
505
|
+
|
506
|
+
(void) SetFromRawPtr_(ptr);
|
507
|
+
}
|
508
|
+
|
509
|
+
template<class T>
|
510
|
+
SmartPtr<T>::~SmartPtr()
|
511
|
+
{
|
512
|
+
#ifdef IP_DEBUG_SMARTPTR
|
513
|
+
DBG_START_METH("SmartPtr<T>::~SmartPtr(T* ptr)", ipopt_dbg_smartptr_verbosity);
|
514
|
+
#endif
|
515
|
+
|
516
|
+
ReleasePointer_();
|
517
|
+
}
|
518
|
+
|
519
|
+
template<class T>
|
520
|
+
T* SmartPtr<T>::operator->() const
|
521
|
+
{
|
522
|
+
#ifdef IP_DEBUG_SMARTPTR
|
523
|
+
DBG_START_METH("T* SmartPtr<T>::operator->()", ipopt_dbg_smartptr_verbosity);
|
524
|
+
#endif
|
525
|
+
|
526
|
+
// cannot deref a null pointer
|
527
|
+
#if IPOPT_CHECKLEVEL > 0
|
528
|
+
assert(ptr_);
|
529
|
+
#endif
|
530
|
+
|
531
|
+
return ptr_;
|
532
|
+
}
|
533
|
+
|
534
|
+
template<class T>
|
535
|
+
T& SmartPtr<T>::operator*() const
|
536
|
+
{
|
537
|
+
#ifdef IP_DEBUG_SMARTPTR
|
538
|
+
DBG_START_METH("T& SmartPtr<T>::operator*()", ipopt_dbg_smartptr_verbosity);
|
539
|
+
#endif
|
540
|
+
|
541
|
+
// cannot dereference a null pointer
|
542
|
+
#if IPOPT_CHECKLEVEL > 0
|
543
|
+
assert(ptr_);
|
544
|
+
#endif
|
545
|
+
|
546
|
+
return *ptr_;
|
547
|
+
}
|
548
|
+
|
549
|
+
template<class T>
|
550
|
+
SmartPtr<T>& SmartPtr<T>::operator=(
|
551
|
+
T* rhs
|
552
|
+
)
|
553
|
+
{
|
554
|
+
#ifdef IP_DEBUG_SMARTPTR
|
555
|
+
DBG_START_METH("SmartPtr<T>& SmartPtr<T>::operator=(T* rhs)", ipopt_dbg_smartptr_verbosity);
|
556
|
+
#endif
|
557
|
+
|
558
|
+
return SetFromRawPtr_(rhs);
|
559
|
+
}
|
560
|
+
|
561
|
+
template<class T>
|
562
|
+
SmartPtr<T>& SmartPtr<T>::operator=(
|
563
|
+
const SmartPtr<T>& rhs
|
564
|
+
)
|
565
|
+
{
|
566
|
+
#ifdef IP_DEBUG_SMARTPTR
|
567
|
+
DBG_START_METH(
|
568
|
+
"SmartPtr<T>& SmartPtr<T>::operator=(const SmartPtr<T>& rhs)",
|
569
|
+
ipopt_dbg_smartptr_verbosity);
|
570
|
+
#endif
|
571
|
+
|
572
|
+
return SetFromSmartPtr_(rhs);
|
573
|
+
}
|
574
|
+
|
575
|
+
template<class T>
|
576
|
+
template<class U>
|
577
|
+
SmartPtr<T>& SmartPtr<T>::operator=(
|
578
|
+
const SmartPtr<U>& rhs
|
579
|
+
)
|
580
|
+
{
|
581
|
+
#ifdef IP_DEBUG_SMARTPTR
|
582
|
+
DBG_START_METH(
|
583
|
+
"SmartPtr<T>& SmartPtr<T>::operator=(const SmartPtr<U>& rhs)",
|
584
|
+
ipopt_dbg_smartptr_verbosity);
|
585
|
+
#endif
|
586
|
+
|
587
|
+
return SetFromSmartPtr_(GetRawPtr(rhs));
|
588
|
+
}
|
589
|
+
|
590
|
+
template<class T>
|
591
|
+
SmartPtr<T>& SmartPtr<T>::SetFromRawPtr_(
|
592
|
+
T* rhs
|
593
|
+
)
|
594
|
+
{
|
595
|
+
#ifdef IP_DEBUG_SMARTPTR
|
596
|
+
DBG_START_METH(
|
597
|
+
"SmartPtr<T>& SmartPtr<T>::SetFromRawPtr_(T* rhs)", ipopt_dbg_smartptr_verbosity);
|
598
|
+
#endif
|
599
|
+
|
600
|
+
if( rhs != 0 )
|
601
|
+
{
|
602
|
+
rhs->AddRef(this);
|
603
|
+
}
|
604
|
+
|
605
|
+
// Release any old pointer
|
606
|
+
ReleasePointer_();
|
607
|
+
|
608
|
+
ptr_ = rhs;
|
609
|
+
|
610
|
+
return *this;
|
611
|
+
}
|
612
|
+
|
613
|
+
template<class T>
|
614
|
+
SmartPtr<T>& SmartPtr<T>::SetFromSmartPtr_(
|
615
|
+
const SmartPtr<T>& rhs
|
616
|
+
)
|
617
|
+
{
|
618
|
+
#ifdef IP_DEBUG_SMARTPTR
|
619
|
+
DBG_START_METH(
|
620
|
+
"SmartPtr<T>& SmartPtr<T>::SetFromSmartPtr_(const SmartPtr<T>& rhs)",
|
621
|
+
ipopt_dbg_smartptr_verbosity);
|
622
|
+
#endif
|
623
|
+
|
624
|
+
SetFromRawPtr_(GetRawPtr(rhs));
|
625
|
+
|
626
|
+
return (*this);
|
627
|
+
}
|
628
|
+
|
629
|
+
template<class T>
|
630
|
+
void SmartPtr<T>::ReleasePointer_()
|
631
|
+
{
|
632
|
+
#ifdef IP_DEBUG_SMARTPTR
|
633
|
+
DBG_START_METH(
|
634
|
+
"void SmartPtr<T>::ReleasePointer()",
|
635
|
+
ipopt_dbg_smartptr_verbosity);
|
636
|
+
#endif
|
637
|
+
|
638
|
+
if( ptr_ )
|
639
|
+
{
|
640
|
+
ptr_->ReleaseRef(this);
|
641
|
+
if( ptr_->ReferenceCount() == 0 )
|
642
|
+
{
|
643
|
+
delete ptr_;
|
644
|
+
}
|
645
|
+
}
|
646
|
+
}
|
647
|
+
|
648
|
+
template<class U>
|
649
|
+
U* GetRawPtr(
|
650
|
+
const SmartPtr<U>& smart_ptr
|
651
|
+
)
|
652
|
+
{
|
653
|
+
#ifdef IP_DEBUG_SMARTPTR
|
654
|
+
DBG_START_FUN(
|
655
|
+
"T* GetRawPtr(const SmartPtr<T>& smart_ptr)",
|
656
|
+
0);
|
657
|
+
#endif
|
658
|
+
|
659
|
+
return smart_ptr.ptr_;
|
660
|
+
}
|
661
|
+
|
662
|
+
template<class U>
|
663
|
+
SmartPtr<const U> ConstPtr(
|
664
|
+
const SmartPtr<U>& smart_ptr
|
665
|
+
)
|
666
|
+
{
|
667
|
+
// compiler should implicitly cast
|
668
|
+
return GetRawPtr(smart_ptr);
|
669
|
+
}
|
670
|
+
|
671
|
+
template<class U>
|
672
|
+
bool IsValid(
|
673
|
+
const SmartPtr<U>& smart_ptr
|
674
|
+
)
|
675
|
+
{
|
676
|
+
return !IsNull(smart_ptr);
|
677
|
+
}
|
678
|
+
|
679
|
+
template<class U>
|
680
|
+
bool IsNull(
|
681
|
+
const SmartPtr<U>& smart_ptr
|
682
|
+
)
|
683
|
+
{
|
684
|
+
#ifdef IP_DEBUG_SMARTPTR
|
685
|
+
DBG_START_FUN(
|
686
|
+
"bool IsNull(const SmartPtr<T>& smart_ptr)",
|
687
|
+
0);
|
688
|
+
#endif
|
689
|
+
|
690
|
+
return (smart_ptr.ptr_ == 0);
|
691
|
+
}
|
692
|
+
|
693
|
+
template<class U1, class U2>
|
694
|
+
bool ComparePointers(
|
695
|
+
const U1* lhs,
|
696
|
+
const U2* rhs
|
697
|
+
)
|
698
|
+
{
|
699
|
+
#ifdef IP_DEBUG_SMARTPTR
|
700
|
+
DBG_START_FUN(
|
701
|
+
"bool ComparePtrs(const U1* lhs, const U2* rhs)",
|
702
|
+
ipopt_dbg_smartptr_verbosity);
|
703
|
+
#endif
|
704
|
+
|
705
|
+
// Even if lhs and rhs point to the same object
|
706
|
+
// with different interfaces U1 and U2, we cannot guarantee that
|
707
|
+
// the value of the pointers will be equivalent. We can
|
708
|
+
// guarantee this if we convert to ReferencedObject* (see also #162)
|
709
|
+
const ReferencedObject* v_lhs = lhs;
|
710
|
+
const ReferencedObject* v_rhs = rhs;
|
711
|
+
|
712
|
+
return v_lhs == v_rhs;
|
713
|
+
}
|
714
|
+
|
715
|
+
template<class U1, class U2>
|
716
|
+
bool operator==(
|
717
|
+
const SmartPtr<U1>& lhs,
|
718
|
+
const SmartPtr<U2>& rhs
|
719
|
+
)
|
720
|
+
{
|
721
|
+
#ifdef IP_DEBUG_SMARTPTR
|
722
|
+
DBG_START_FUN(
|
723
|
+
"bool operator==(const SmartPtr<U1>& lhs, const SmartPtr<U2>& rhs)",
|
724
|
+
ipopt_dbg_smartptr_verbosity);
|
725
|
+
#endif
|
726
|
+
|
727
|
+
U1* raw_lhs = GetRawPtr(lhs);
|
728
|
+
U2* raw_rhs = GetRawPtr(rhs);
|
729
|
+
return ComparePointers(raw_lhs, raw_rhs);
|
730
|
+
}
|
731
|
+
|
732
|
+
template<class U1, class U2>
|
733
|
+
bool operator==(
|
734
|
+
const SmartPtr<U1>& lhs,
|
735
|
+
U2* raw_rhs
|
736
|
+
)
|
737
|
+
{
|
738
|
+
#ifdef IP_DEBUG_SMARTPTR
|
739
|
+
DBG_START_FUN(
|
740
|
+
"bool operator==(SmartPtr<U1>& lhs, U2* rhs)",
|
741
|
+
ipopt_dbg_smartptr_verbosity);
|
742
|
+
#endif
|
743
|
+
|
744
|
+
U1* raw_lhs = GetRawPtr(lhs);
|
745
|
+
return ComparePointers(raw_lhs, raw_rhs);
|
746
|
+
}
|
747
|
+
|
748
|
+
template<class U1, class U2>
|
749
|
+
bool operator==(
|
750
|
+
U1* raw_lhs,
|
751
|
+
const SmartPtr<U2>& rhs
|
752
|
+
)
|
753
|
+
{
|
754
|
+
#ifdef IP_DEBUG_SMARTPTR
|
755
|
+
DBG_START_FUN(
|
756
|
+
"bool operator==(U1* raw_lhs, SmartPtr<U2>& rhs)",
|
757
|
+
ipopt_dbg_smartptr_verbosity);
|
758
|
+
#endif
|
759
|
+
|
760
|
+
const U2* raw_rhs = GetRawPtr(rhs);
|
761
|
+
return ComparePointers(raw_lhs, raw_rhs);
|
762
|
+
}
|
763
|
+
|
764
|
+
template<class U1, class U2>
|
765
|
+
bool operator!=(
|
766
|
+
const SmartPtr<U1>& lhs,
|
767
|
+
const SmartPtr<U2>& rhs
|
768
|
+
)
|
769
|
+
{
|
770
|
+
#ifdef IP_DEBUG_SMARTPTR
|
771
|
+
DBG_START_FUN(
|
772
|
+
"bool operator!=(const SmartPtr<U1>& lhs, const SmartPtr<U2>& rhs)",
|
773
|
+
ipopt_dbg_smartptr_verbosity);
|
774
|
+
#endif
|
775
|
+
|
776
|
+
bool retValue = operator==(lhs, rhs);
|
777
|
+
return !retValue;
|
778
|
+
}
|
779
|
+
|
780
|
+
template<class U1, class U2>
|
781
|
+
bool operator!=(
|
782
|
+
const SmartPtr<U1>& lhs,
|
783
|
+
U2* raw_rhs
|
784
|
+
)
|
785
|
+
{
|
786
|
+
#ifdef IP_DEBUG_SMARTPTR
|
787
|
+
DBG_START_FUN(
|
788
|
+
"bool operator!=(SmartPtr<U1>& lhs, U2* rhs)",
|
789
|
+
ipopt_dbg_smartptr_verbosity);
|
790
|
+
#endif
|
791
|
+
|
792
|
+
bool retValue = operator==(lhs, raw_rhs);
|
793
|
+
return !retValue;
|
794
|
+
}
|
795
|
+
|
796
|
+
template<class U1, class U2>
|
797
|
+
bool operator!=(
|
798
|
+
U1* raw_lhs,
|
799
|
+
const SmartPtr<U2>& rhs
|
800
|
+
)
|
801
|
+
{
|
802
|
+
#ifdef IP_DEBUG_SMARTPTR
|
803
|
+
DBG_START_FUN(
|
804
|
+
"bool operator!=(U1* raw_lhs, SmartPtr<U2>& rhs)",
|
805
|
+
ipopt_dbg_smartptr_verbosity);
|
806
|
+
#endif
|
807
|
+
|
808
|
+
bool retValue = operator==(raw_lhs, rhs);
|
809
|
+
return !retValue;
|
810
|
+
}
|
811
|
+
|
812
|
+
template<class T>
|
813
|
+
void swap(
|
814
|
+
SmartPtr<T>& a,
|
815
|
+
SmartPtr<T>& b
|
816
|
+
)
|
817
|
+
{
|
818
|
+
#ifdef IP_DEBUG_REFERENCED
|
819
|
+
SmartPtr<T> tmp(a);
|
820
|
+
a = b;
|
821
|
+
b = tmp;
|
822
|
+
#else
|
823
|
+
std::swap(a.prt_, b.ptr_);
|
824
|
+
#endif
|
825
|
+
}
|
826
|
+
|
827
|
+
template<class T>
|
828
|
+
bool operator<(
|
829
|
+
const SmartPtr<T>& lhs,
|
830
|
+
const SmartPtr<T>& rhs
|
831
|
+
)
|
832
|
+
{
|
833
|
+
return lhs.ptr_ < rhs.ptr_;
|
834
|
+
}
|
835
|
+
|
836
|
+
template<class T>
|
837
|
+
bool operator>(
|
838
|
+
const SmartPtr<T>& lhs,
|
839
|
+
const SmartPtr<T>& rhs
|
840
|
+
)
|
841
|
+
{
|
842
|
+
return rhs < lhs;
|
843
|
+
}
|
844
|
+
|
845
|
+
template<class T> bool operator<=(
|
846
|
+
const SmartPtr<T>& lhs,
|
847
|
+
const SmartPtr<T>& rhs
|
848
|
+
)
|
849
|
+
{
|
850
|
+
return !(rhs < lhs);
|
851
|
+
}
|
852
|
+
|
853
|
+
template<class T> bool operator>=(
|
854
|
+
const SmartPtr<T>& lhs,
|
855
|
+
const SmartPtr<T>& rhs
|
856
|
+
)
|
857
|
+
{
|
858
|
+
return !(lhs < rhs);
|
859
|
+
}
|
860
|
+
|
861
|
+
} // namespace Ipopt
|
862
|
+
|
863
|
+
#undef ipopt_dbg_smartptr_verbosity
|
864
|
+
|
865
|
+
#endif
|