void CliquePartitionProblem::gradient(IndexedList const & v,
                                      DoubleVector & result) const {
  ASSERT_CHECK(v.max_size()==nV());
  result.assign(v.max_size(), 0);
  for (auto const & e : _costs) {
    if (v.contains(e._j)) {
      result[e._i] += e._v;
    }
    if (v.contains(e._i)) {
      result[e._j] += e._v;
    }
  }
}
示例#2
0
void CplexSolver::dual(DoubleVector & result) const {
	result.assign(nrows(), 0);
	CPXgetpi(_env, _prob, result.data(), 0, nrows() - 1);
}