34 xy0.
insert(yKey, Vector::Constant(1, y0));
42 double yOpt = xyInit.
at(yKey)[0];
55 initLP->inequalities =
69 for (
const auto& [
key,
_] : constrainedKeyDim) {
70 size_t dim = constrainedKeyDim.at(
key);
79 double y0 = -std::numeric_limits<double>::infinity();
81 double error = factor->error(x0);
82 if (error > y0) y0 =
error;
90 std::vector<std::pair<Key, Matrix> > terms;
92 terms.push_back(make_pair(*it, factor.
getA(it)));
102 std::vector<std::pair<Key, Matrix> > terms =
collectTerms(*factor);
103 terms.push_back(make_pair(yKey, Matrix::Constant(1, 1, -1.0)));
104 double d = factor->getb()[0];
107 return slackInequalities;
EqualityFactorGraph equalities
Linear equality constraints: cE(x) = 0.
const gtsam::Symbol key('X', 0)
double compute_y0(const VectorValues &x0) const
y = max_j ( Cj*x0 - dj ) – due to the inequality constraints y >= Cx - d
std::shared_ptr< LP > shared_ptr
InequalityFactorGraph inequalities
Linear inequality constraints: cI(x) <= 0.
LP::shared_ptr buildInitialLP(Key yKey) const
build initial LP
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
iterator insert(const std::pair< Key, Vector > &key_value)
Key maxKey(const PROBLEM &problem)
std::pair< VectorValues, VectorValues > optimize(const VectorValues &initialValues, const VectorValues &duals=VectorValues(), bool useWarmStart=false) const
const_iterator end() const
InequalityFactorGraph addSlackVariableToInequalities(Key yKey, const InequalityFactorGraph &inequalities) const
Turn Cx <= d into Cx - y <= d factors.
std::shared_ptr< This > shared_ptr
shared_ptr to this class
VectorValues solve() const
Throw when the problem is either infeasible or unbounded.
GaussianFactorGraph::shared_ptr buildInitOfInitGraph() const
constexpr descr< N - 1 > _(char const (&text)[N])
const KeyDimMap & constrainedKeyDimMap() const
Policy of ActiveSetSolver to solve Linear Programming Problems.
std::map< Key, size_t > KeyDimMap
Mapping between variable's key and its corresponding dimensionality.
KeyVector::const_iterator const_iterator
Const iterator over keys.
const_iterator begin() const
std::uint64_t Key
Integer nonlinear key type.
constABlock getA(const_iterator variable) const
std::vector< std::pair< Key, Matrix > > collectTerms(const LinearInequality &factor) const
Collect all terms of a factor into a container.
This finds a feasible solution for an LP problem.