fix a crash due to problems with boost adaptors on rvalue (https://svn.boost.org/trac/boost/ticket/9578)
parent
c90304398e
commit
3b897950a6
|
@ -183,11 +183,11 @@ pair<VectorValues, VectorValues> QPSolver::optimize(
|
||||||
pair<VectorValues, VectorValues> QPSolver::optimize() const {
|
pair<VectorValues, VectorValues> QPSolver::optimize() const {
|
||||||
//Make an LP with any linear cost function. It doesn't matter for initialization.
|
//Make an LP with any linear cost function. It doesn't matter for initialization.
|
||||||
LP initProblem;
|
LP initProblem;
|
||||||
Key newKey = 0; // make an unrelated key for a random variable cost
|
// make an unrelated key for a random variable cost: max key + 1
|
||||||
for (Key key : qp_.cost.getKeyDimMap() | boost::adaptors::map_keys)
|
std::array<Key, 3> maxKeys = {*qp_.cost.keys().rbegin(),
|
||||||
if (newKey < key)
|
*qp_.equalities.keys().rbegin(),
|
||||||
newKey = key;
|
*qp_.inequalities.keys().rbegin()};
|
||||||
newKey++;
|
Key newKey = *std::max_element(maxKeys.begin(), maxKeys.end()) + 1;
|
||||||
initProblem.cost = LinearCost(newKey, Vector::Ones(1));
|
initProblem.cost = LinearCost(newKey, Vector::Ones(1));
|
||||||
initProblem.equalities = qp_.equalities;
|
initProblem.equalities = qp_.equalities;
|
||||||
initProblem.inequalities = qp_.inequalities;
|
initProblem.inequalities = qp_.inequalities;
|
||||||
|
|
Loading…
Reference in New Issue