17 #ifndef AGX_BOXEDKELLERALGORITHM_H
18 #define AGX_BOXEDKELLERALGORITHM_H
88 std::vector<int> inner_iterations;
90 std::vector<int> updates;
92 int projection_deletions;
95 Stats(
size_t n ) : inner_iterations(), updates(n, -1), rank_update(0), projections(0),
96 projection_deletions(0), variables(n), active(0){}
#define AGXPHYSICS_EXPORT
agx::Bool makeSolutionFeasible(Args &args, agx::UInt maxNumIterations=agx::UInt(64))
Calculates a feasible solution z and switches indices.
void initializeIndexSet(Args &args) const
Initializes the index set.
agx::RealValarray getSearchDirection(Args &args, const agx::RealValarray &pivotCol)
Finds the search direction given most violated index.
agx::Bool doPivot(Args &args, const StepLength &sl, const PivotIndex &pi) const
Given step length, updates the index set.
PivotIndex getPivotIndex(Args &args) const
Finds and returns the most violated index.
StepLength getStepLength(Args &args, const agx::RealValarray &searchDirection, const PivotIndex &pi, const agx::RealValarray &pivotRow) const
Calculates the step length given search direction.
virtual ~BoxedKellerAlgorithm()
Reference counted object - protected destructor.
virtual agx::UInt switchIndices(const agx::RealValarray &z, const agx::RealValarray &w, const agx::SparseRangeReal &bounds, agx::IndexSet &indexSet, agx::Real tolerance=agx::Real(1E-8)) const override
Custom implementation of switch indices where slack is ignored and we only pivot on infeasible elemen...
void doStep(Args &args, const StepLength &sl, agx::RealValarray &searchDirection, const PivotIndex &pi, const agx::RealValarray &pivotCol) const
Perform step, i.e., update z and w given search direction and step length.
virtual agx::NlMixedCp::McpAlgorithm::SolveReport solve(agx::NlMixedCp::McpAlgorithm::Args &args) override
Solves MCP using Keller's Principal Pivot Method.
BoxedKellerAlgorithm(agx::Real globalTolerance, agx::UInt maxNumIterations, bool gatherStatistics)
Construct given global tolerance and the maximum iterations.
agx::NlMixedCp::McpAlgorithm::SolveReport searchSolution(agx::NlMixedCp::McpAlgorithm::Args &args)
Searches solution assuming z is feasible and the index set is up to date.
agx::Real m_localTolerance
void getInitialPoint(Args &args)
Finds the initial starting point.
Interface class for algorithm to solve general mixed complementarity problem.
Essentially a sparse array of bounds.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::ref_ptr< BoxedKellerAlgorithm > BoxedKellerAlgorithmRef
std::valarray< agx::Real > RealValarray
For this module, vectors are defined using valarray.
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
Data for pivot index with sign and current range of the most violated index.
Data for step length with the different thetas and indices (r2 and r3) of other bounded equations tha...
Structure for all the arguments passed around.