Merge remote-tracking branch 'origin/feature/LPSolver' into feature/LPSolver
commit
1102a0e425
|
|
@ -183,11 +183,13 @@ pair<VectorValues, VectorValues> QPSolver::optimize(
|
|||
pair<VectorValues, VectorValues> QPSolver::optimize() const {
|
||||
//Make an LP with any linear cost function. It doesn't matter for initialization.
|
||||
LP initProblem;
|
||||
Key newKey = 0; // make an unrelated key for a random variable cost
|
||||
for (Key key : qp_.cost.getKeyDimMap() | boost::adaptors::map_keys)
|
||||
if (newKey < key)
|
||||
newKey = key;
|
||||
newKey++;
|
||||
// make an unrelated key for a random variable cost: max key + 1
|
||||
Key newKey = *qp_.cost.keys().rbegin();
|
||||
if (!qp_.equalities.empty())
|
||||
newKey = std::max(newKey, *qp_.equalities.keys().rbegin());
|
||||
if (!qp_.inequalities.empty())
|
||||
newKey = std::max(newKey, *qp_.inequalities.keys().rbegin());
|
||||
++newKey;
|
||||
initProblem.cost = LinearCost(newKey, Vector::Ones(1));
|
||||
initProblem.equalities = qp_.equalities;
|
||||
initProblem.inequalities = qp_.inequalities;
|
||||
|
|
|
|||
Loading…
Reference in New Issue