Skip to content

Commit

Permalink
Multi-obj: Cbc #239
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed May 27, 2024
1 parent ef4445c commit 34d867d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/source/modeling-tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Running Gurobi with option ``feasrelax 1``, we trick MP
After the solver log we see a warning of type "Tolerance violations".
There is an absolute violation of 3 and relative violation of 1 in the objective value.
Linear constraint `C2` has its absolute and relative violations reported.
Lines markes with a `*` report :ref:`Realistic violations <realistic-viols>`.
Lines marked with a `*` report :ref:`Realistic violations <realistic-viols>`.

To check the violations, we can recompute objective value and constraint slacks,
as follows:
Expand Down Expand Up @@ -426,7 +426,8 @@ Consider the following example.
.. code-block:: ampl
var x >=0, <=100;
maximize Total: if x<=5 and x>=5.00000000001 then 10;
maximize Total:
if x<=5 and x>=5.00000000001 then 10;
Most solvers apply a constraint feasibility tolerance of the order :math:`10^{-6}`.

Expand Down
2 changes: 2 additions & 0 deletions solvers/cbcmp/cbcmpmodelapi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ void CbcmpModelAPI::AddVariables(const VarArrayDef& v) {

void CbcmpModelAPI::SetLinearObjective( int iobj, const LinearObjective& lo ) {
if (iobj<1) {
for (auto i=NumVars(); i--; )
Cbc_setObjCoeff(lp(), i, 0.0);
for (int i = 0; i < lo.num_terms(); i++)
Cbc_setObjCoeff(lp(), lo.vars()[i], lo.coefs()[i]);
Cbc_setObjSense(lp(), lo.obj_sense()== obj::MAX ? -1 : 1);
Expand Down

0 comments on commit 34d867d

Please sign in to comment.