|
TVM
0.9.4
|
#include <tvm/solver/abstract/HierarchicalLeastSquareSolver.h>

Classes | |
| struct | ImpactFromChanges |
| struct | MarkedAssignment |
Public Types | |
| template<typename K , typename T > | |
| using | map = utils::internal::map< K, T > |
| using | AssignmentVector = std::vector< std::unique_ptr< MarkedAssignment > > |
| using | AssignmentPtrVector = std::vector< MarkedAssignment * > |
| using | MapToAssignment = map< constraint::abstract::LinearConstraint *, AssignmentPtrVector > |
Public Member Functions | |
| HierarchicalLeastSquareSolver (bool verbose=false) | |
| HierarchicalLeastSquareSolver (const HierarchicalLeastSquareSolver &)=delete | |
| HierarchicalLeastSquareSolver & | operator= (const HierarchicalLeastSquareSolver &)=delete |
| virtual | ~HierarchicalLeastSquareSolver ()=default |
| void | startBuild (const VariableVector &x, const std::vector< int > &nEq, const std::vector< int > &nIneq, bool useBounds, const hint::internal::Substitutions *const subs=nullptr) |
| void | finalizeBuild () |
| void | addBound (LinearConstraintPtr bound) |
| void | addConstraint (LinearConstraintPtr cstr, SolvingRequirementsPtr req) |
| void | setMinimumNorm () |
| bool | solve () |
| const Eigen::VectorXd & | result () const |
| int | constraintSize (const constraint::abstract::LinearConstraint &c) const |
| void | process (const internal::SolverEvents &se) |
| int | numberOfLevels () const |
Protected Member Functions | |
| virtual void | initializeBuild_ (const std::vector< int > &nEq, const std::vector< int > &nIneq, bool useBounds)=0 |
| virtual ImpactFromChanges | resize_ (const std::vector< int > &nEq, const std::vector< int > &nIneq, bool useBounds)=0 |
| virtual void | addBound_ (LinearConstraintPtr bound, RangePtr range, bool first)=0 |
| virtual void | addEqualityConstraint_ (LinearConstraintPtr cstr, SolvingRequirementsPtr req)=0 |
| virtual void | addIneqalityConstraint_ (LinearConstraintPtr cstr, SolvingRequirementsPtr req)=0 |
| virtual void | setMinimumNorm_ ()=0 |
| virtual void | resetBounds_ ()=0 |
| virtual void | preAssignmentProcess_ () |
| virtual void | postAssignmentProcess_ () |
| virtual bool | solve_ ()=0 |
| virtual const Eigen::VectorXd & | result_ () const =0 |
| virtual bool | handleDoubleSidedConstraint_ () const =0 |
| virtual Range | nextEqualityConstraintRange_ (int lvl, const constraint::abstract::LinearConstraint &cstr) const =0 |
| virtual Range | nextInequalityConstraintRange_ (int lvl, const constraint::abstract::LinearConstraint &cstr) const =0 |
| virtual void | removeBounds_ (const Range &range)=0 |
| virtual void | updateEqualityTargetData (int lvl, scheme::internal::AssignmentTarget &target)=0 |
| virtual void | updateInequalityTargetData (int lvl, scheme::internal::AssignmentTarget &target)=0 |
| virtual void | updateBoundTargetData (scheme::internal::AssignmentTarget &target)=0 |
| virtual void | applyImpactLogic (ImpactFromChanges &impact) |
| virtual void | printProblemData_ () const =0 |
| virtual void | printDiagnostic_ () const =0 |
| const VariableVector & | variables () const |
| const hint::internal::Substitutions * | substitutions () const |
| template<typename... Args> | |
| void | addAssignement (Args &&... args) |
Protected Attributes | |
| bool | useBounds_ = false |
| std::vector< int > | nEq_ |
| std::vector< int > | nIneq_ |
| std::vector< int > | eqSize_ |
| std::vector< int > | ineqSize_ |
Base class for a hierarchical least-square solver.
The problem to be solved has the general form lex.min. (||v_1||^2, ||w_1||^2, ...., ||v_p||^2, ||w_p||^2) s.t. A_i x + v_i = b_i i= 1..p l_i <= C_i x + w_i <= u_i i= 1..p
where l_i or u_i might be set to -inf or +inf.
When deriving this class, also remember to derive the factory class HLSSolverFactory as well.
| using tvm::solver::abstract::HierarchicalLeastSquareSolver::AssignmentPtrVector = std::vector<MarkedAssignment *> |
| using tvm::solver::abstract::HierarchicalLeastSquareSolver::AssignmentVector = std::vector<std::unique_ptr<MarkedAssignment> > |
| using tvm::solver::abstract::HierarchicalLeastSquareSolver::map = utils::internal::map<K, T> |
| using tvm::solver::abstract::HierarchicalLeastSquareSolver::MapToAssignment = map<constraint::abstract::LinearConstraint *, AssignmentPtrVector> |
| tvm::solver::abstract::HierarchicalLeastSquareSolver::HierarchicalLeastSquareSolver | ( | bool | verbose = false | ) |
|
delete |
|
virtualdefault |
|
inlineprotected |
| void tvm::solver::abstract::HierarchicalLeastSquareSolver::addBound | ( | LinearConstraintPtr | bound | ) |
Add a bound constraint to the solver at the top priority level. If multiple bounds appears on the same variable, their intersection is taken.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
| void tvm::solver::abstract::HierarchicalLeastSquareSolver::addConstraint | ( | LinearConstraintPtr | cstr, |
| SolvingRequirementsPtr | req | ||
| ) |
Add a constraint to the solver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedvirtual |
If for a derived class, the change on a category implies the change on others, impact is changed accordingly.
Reimplemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
| int tvm::solver::abstract::HierarchicalLeastSquareSolver::constraintSize | ( | const constraint::abstract::LinearConstraint & | c | ) | const |
Return the constraint size for the solver. This can be different from the actual constraint size if the constraint is a double-sided inequality but the solver only accept simple sided constraints
| void tvm::solver::abstract::HierarchicalLeastSquareSolver::finalizeBuild | ( | ) |
Finalize the build.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
inline |
Number of priority levels
|
delete |
|
inlineprotectedvirtual |
Reimplemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
inlineprotectedvirtual |
Reimplemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
| void tvm::solver::abstract::HierarchicalLeastSquareSolver::process | ( | const internal::SolverEvents & | se | ) |
Update the data according to the events
|
protectedpure virtual |
Remove the bounds on variable at given range from the data passed to the solver (e.g. set the bounds to -/+Inf).
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
| const Eigen::VectorXd& tvm::solver::abstract::HierarchicalLeastSquareSolver::result | ( | ) | const |
Get the result of the previous call to solve()
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
| void tvm::solver::abstract::HierarchicalLeastSquareSolver::setMinimumNorm | ( | ) |
Set x = 0 as the last priority level of the problem.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
| bool tvm::solver::abstract::HierarchicalLeastSquareSolver::solve | ( | ) |
Solve the problem
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
| void tvm::solver::abstract::HierarchicalLeastSquareSolver::startBuild | ( | const VariableVector & | x, |
| const std::vector< int > & | nEq, | ||
| const std::vector< int > & | nIneq, | ||
| bool | useBounds, | ||
| const hint::internal::Substitutions *const | subs = nullptr |
||
| ) |
Open a build sequence for a problem on the current variables (set through the inherited ProblemComputationData::addVariable) with the specified dimensions, allocating the memory needed.
| x | The variables of the problem. The object need to be valid until ::finalizeBuild is called. |
| nEq | For each priority level, the row size of A_i. |
| nIneq | For each priority level the row size of C_i. |
| useBounds | Presence of explicit bounds as the first priority level in the problem. |
| subs | Possible substitutions used for solving. |
Once a build is started, constraints and bounds can be added through ::addConstraint and ::addBound, until ::finalizeBuild is called.
|
inlineprotected |
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
protectedpure virtual |
Implemented in tvm::solver::LexLSHierarchicalLeastSquareSolver.
|
inlineprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |