Skip to content

Commit

Permalink
Multi-obj: Copt #239
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed May 27, 2024
1 parent 34d867d commit 55693c2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions solvers/copt/coptmodelapi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ void CoptModelAPI::SetLinearObjective( int iobj, const LinearObjective& lo ) {
if (iobj<1) {
COPT_CCALL(COPT_SetObjSense(lp(),
obj::Type::MAX==lo.obj_sense() ? COPT_MAXIMIZE : COPT_MINIMIZE) );
double zero_out = 0.0;
for (int i=NumVars(); i--; )
COPT_CCALL(COPT_SetColObj(lp(), 1, &i, &zero_out));
COPT_CCALL(COPT_SetColObj(lp(), lo.num_terms(),
lo.vars().data(), lo.coefs().data()) );
} else {
Expand Down

0 comments on commit 55693c2

Please sign in to comment.