|
AGXDynamics
2.31.1.0
|
#include <BoxedKellerAlgorithm.h>
Inheritance diagram for agx::BoxedKellerAlgorithm:Classes | |
| struct | PivotIndex |
| Data for pivot index with sign and current range of the most violated index. More... | |
| struct | StepLength |
| Data for step length with the different thetas and indices (r2 and r3) of other bounded equations that may change state. More... | |
Public Member Functions | |
| BoxedKellerAlgorithm (agx::Real globalTolerance, agx::UInt maxNumIterations, bool gatherStatistics) | |
| Construct given global tolerance and the maximum iterations. More... | |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| void | clearStats (size_t numEquations) |
| Ensure that the solver statistics can report data for the given number of equations. More... | |
| agx::Real | getGlobalTolerance () const |
| agx::UInt | getMaxNumIterations () const |
| int | getReferenceCount () const |
| const McpAlgorithmStats & | getStats () const |
| McpAlgorithmStats & | getStats () |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| agx::Bool | makeSolutionFeasible (Args &args, agx::UInt maxNumIterations=agx::UInt(64)) |
| Calculates a feasible solution z and switches indices. More... | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| void | resizeStats (size_t numEquations) |
| Ensure that the solver statistics can report data for the given number of equations. More... | |
| agx::NlMixedCp::McpAlgorithm::SolveReport | searchSolution (agx::NlMixedCp::McpAlgorithm::Args &args) |
| Searches solution assuming z is feasible and the index set is up to date. More... | |
| void | setGlobalTolerance (agx::Real globalTolerance) |
| Assign the tolerance (accuracy) of the solution. More... | |
| void | setMaxNumIterations (agx::UInt maxNumIterations) |
| Assign the maximum number of iterations this algorithm may perform to reach the given tolerance of the solution. More... | |
| virtual agx::NlMixedCp::McpAlgorithm::SolveReport | solve (agx::NlMixedCp::McpAlgorithm::Args &args) override |
| Solves MCP using Keller's Principal Pivot Method. More... | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
Static Public Member Functions | |
| static agx::Real | getComplementarityError (const agx::IndexSet &indexSet, const agx::SparseRangeReal &bounds, const agx::RealValarray &z, const agx::RealValarray &w) |
| Computes the complementarity error of a current solution. More... | |
| static agx::Bool | isFeasible (const SparseRangeReal &bounds, const RealValarray &z, const Real threshold) |
| Checks if the solution z is feasible, i.e., within bounds. More... | |
| static agx::Bool | saveAsHdf5 (const agx::String &filename, const SparseMatrix &m, RealValarray &z, RealValarray &q, RealValarray &signs, const agx::SparseRangeReal &bounds) |
Save matrix, solution, right hand side, sign convention and bounds to a unique problem in filename. More... | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| virtual | ~BoxedKellerAlgorithm () |
| Reference counted object - protected destructor. More... | |
| void | allocateObserverVector () const |
| void | debugCheckSolution (const RealValarray &z, const SparseRangeReal &) const |
| Asserts if z has invalid values. More... | |
| void | deleteUsingDeleteHandler () const |
| agx::Bool | doPivot (Args &args, const StepLength &sl, const PivotIndex &pi) const |
| Given step length, updates the index set. More... | |
| 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. More... | |
| void | forceToBound (RealValarray &v, const agx::SparseRangeReal &bounds, const agx::IndexSet &indexSet) const |
| Write the elements v[i] for which i is at a bound. More... | |
| void | getInitialPoint (Args &args) |
| Finds the initial starting point. More... | |
| PivotIndex | getPivotIndex (Args &args) const |
| Finds and returns the most violated index. More... | |
| agx::RealValarray | getSearchDirection (Args &args, const agx::RealValarray &pivotCol) |
| Finds the search direction given most violated index. More... | |
| void | getSlack (agx::SparseMatrix &m, agx::RealValarray &z, const agx::RealValarray &q, const agx::RealValarray &signs, agx::RealValarray &slack) const |
| Computes slack w = M z + q. More... | |
| StepLength | getStepLength (Args &args, const agx::RealValarray &searchDirection, const PivotIndex &pi, const agx::RealValarray &pivotRow) const |
| Calculates the step length given search direction. More... | |
| void | initializeIndexSet (Args &args) const |
| Initializes the index set. More... | |
| void | linearSolve (agx::SparseMatrix &m, agx::RealValarray &z, const agx::RealValarray &q, const agx::RealValarray &signs) const |
| Solves: M z = -q for z. More... | |
| void | solveInitial (agx::NlMixedCp::McpAlgorithm::Args &args) const |
| Performs linear solve and stores the solution into args.z0 AND args.z. More... | |
| void | solvePp (agx::SparseMatrix &m, agx::SparseInverse &sparseInverse, const RealValarray &z0, const agx::SparseRangeReal &bounds, const IndexSet &indexSet, const RealValarray &signs, RealValarray &z) const |
| Solve principle problem given sparse matrix, initial solution, bounds and current index set. More... | |
| void | solvePp (agx::SparseMatrix &m, const agx::SparseRangeReal &bounds, const IndexSet &indexSet, const RealValarray &signs, const RealValarray &q, RealValarray &z, RealValarray &workspace) |
| Solve principle problem given sparse matrix, initial solution, bounds and current index set. More... | |
| 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 elements z. More... | |
Static Protected Member Functions | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Protected Attributes | |
| agx::Real | m_globalTolerance |
| agx::Real | m_localTolerance |
| agx::UInt | m_maxNumIterations |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
| McpAlgorithmStats | m_stats |
Definition at line 26 of file BoxedKellerAlgorithm.h.
| agx::BoxedKellerAlgorithm::BoxedKellerAlgorithm | ( | agx::Real | globalTolerance, |
| agx::UInt | maxNumIterations, | ||
| bool | gatherStatistics | ||
| ) |
Construct given global tolerance and the maximum iterations.
|
protectedvirtual |
Reference counted object - protected destructor.
|
protectedinherited |
|
inherited |
Subclass casting.
Template type must match actual type, dynamic_cast assertion will fail otherwise.
Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().
|
inherited |
|
inherited |
Safe subclass casting, return nullptr if template type does not match.
Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().
|
inherited |
|
inherited |
Ensure that the solver statistics can report data for the given number of equations.
All previously reported statistics are set to zero.
| numEquations | The number of equations to gather statistics for. |
|
protectedinherited |
Asserts if z has invalid values.
|
protectedinherited |
|
protected |
Given step length, updates the index set.
| args | - arguments |
| sl | - step length |
| pi | - pivot index data |
|
protected |
Perform step, i.e., update z and w given search direction and step length.
| args | - arguments |
| sl | - step length |
| searchDirection | - the search direction |
| pi | - pivot index data |
| pivotCol | - pivot column data |
|
protectedinherited |
Write the elements v[i] for which i is at a bound.
|
staticinherited |
Computes the complementarity error of a current solution.
| indexSet | - index set |
| bounds | - bounded variables |
| z | - current solution |
| w | - current slack |
|
staticprotectedinherited |
|
inherited |
Finds the initial starting point.
Performs solvePp and updates z and w in args.
| args | - arguments |
|
inherited |
|
protected |
Finds and returns the most violated index.
| args | - arguments |
|
inherited |
|
protected |
Finds the search direction given most violated index.
| args | - arguments |
| pivotCol | - column data |
|
protectedinherited |
Computes slack w = M z + q.
| m | - sparse matrix | |
| z | - current solution (NOTE: multiplied with signs before matrix multiply, but and later restored, hence not const) | |
| q | - right hand side | |
| signs | - sign convention (-1 for constraints 1 for bodies) | |
| [out] | slack | - output slack |
|
inherited |
|
inherited |
|
protected |
Calculates the step length given search direction.
| args | - arguments |
| searchDirection | - the search direction |
| pi | - pivot index data |
| pivotRow | - pivot row data |
Initializes the index set.
| args | - arguments |
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::EntityStorage::getInstances(), and agx::Object::getResource().
|
staticinherited |
Checks if the solution z is feasible, i.e., within bounds.
| bounds | - bounded equations in z |
| z | - current solution |
| threshold | - feasible threshold |
|
protectedinherited |
Solves: M z = -q for z.
| m | - sparse matrix | |
| [out] | z | - solution |
| q | - right hand side | |
| signs | - sign convention (-1 for constraints 1 for bodies) |
| agx::Bool agx::BoxedKellerAlgorithm::makeSolutionFeasible | ( | Args & | args, |
| agx::UInt | maxNumIterations = agx::UInt(64) |
||
| ) |
Calculates a feasible solution z and switches indices.
The slack is also updated.
| args | - arguments |
| maxNumIterations | - maximum number of iterations used |
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
This method should be used with care, always balanced with the same number of calls to unreference.
|
inherited |
Ensure that the solver statistics can report data for the given number of equations.
Any new allocations will be initialized to zero.
| numEquations | The number of equations to gather statistics for. |
|
staticinherited |
Save matrix, solution, right hand side, sign convention and bounds to a unique problem in filename.
| filename | - name of file to save the problem to |
| m | - matrix |
| z | - solution |
| q | - rhs |
| signs | - sign convention (-1 of constraints 1 for bodies) |
| bounds | - bounds |
| agx::NlMixedCp::McpAlgorithm::SolveReport agx::BoxedKellerAlgorithm::searchSolution | ( | agx::NlMixedCp::McpAlgorithm::Args & | args | ) |
Searches solution assuming z is feasible and the index set is up to date.
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
Assign the tolerance (accuracy) of the solution.
Assign the maximum number of iterations this algorithm may perform to reach the given tolerance of the solution.
|
overridevirtual |
Solves MCP using Keller's Principal Pivot Method.
Implements agx::NlMixedCp::McpAlgorithm.
|
protectedinherited |
Performs linear solve and stores the solution into args.z0 AND args.z.
|
protectedinherited |
Solve principle problem given sparse matrix, initial solution, bounds and current index set.
| m | - sparse matrix (support solve and for unit solve) | |
| sparseInverse | - sparse inverse with storage of columns of the inverse | |
| z0 | - initial, linear solution | |
| bounds | - bounded variables | |
| indexSet | - current state of the index set | |
| signs | - sign convention (-1 for constraints 1 for bodies) | |
| [out] | z | - solution |
|
protectedinherited |
Solve principle problem given sparse matrix, initial solution, bounds and current index set.
| m | - sparse matrix (support solve and for unit solve) | |
| bounds | - bounded variables | |
| indexSet | - current state of the index set | |
| signs | - sign convention (-1 for constraints 1 for bodies) | |
| q | - right hand side | |
| [out] | z | - solution |
| workspace | Temporary vector used for storage and to avoid reallocations |
|
overrideprotectedvirtual |
Custom implementation of switch indices where slack is ignored and we only pivot on infeasible elements z.
Reimplemented from agx::NlMixedCp::McpAlgorithm.
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.
This method should be used with care, always balanced with the same number of calls to reference.
Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().
|
inherited |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.
|
staticinherited |
|
protectedinherited |
Definition at line 354 of file MixedLCP.h.
|
protected |
Definition at line 176 of file BoxedKellerAlgorithm.h.
|
protectedinherited |
Definition at line 355 of file MixedLCP.h.
|
mutableprotectedinherited |
Definition at line 240 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.
|
protectedinherited |
Definition at line 357 of file MixedLCP.h.