Skip to content

Possible CBC presolve setting inconsistency  #3564

@danoliv

Description

@danoliv

What version of OR-Tools and what language are you using?
Version: v9.4
Language: Scala (using Java interface)

<dependency>
  <groupId>com.google.ortools</groupId>
  <artifactId>ortools-java</artifactId>
  <version>9.4.1874</version>
</dependency>

What operating system (Linux, Windows, ...) and version?
Centos 8 / Fedora 36

What did you do?
After activating the presolve with the following code:

setIntegerParam(IntegerParam.PRESOLVE, PresolveValues.PRESOLVE_OFF.ordinal())

we get the following warning :
W1124 13:22:35.789067 70380 linear_solver.cc:1958] Trying to set an unsupported parameter: 1000.
By looking at the source code we can clearly see that we apparently we cannot disable the presolver https://github.com/google/or-tools/blob/stable/ortools/linear_solver/cbc_interface.cc#L515

void CBCInterface::SetPresolveMode(int value) {
  switch (value) {
    case MPSolverParameters::PRESOLVE_ON: {
      // CBC presolve is always on.
      break;
    }
    default: {
      SetUnsupportedIntegerParam(MPSolverParameters::PRESOLVE);
    }
  }
}

and in the code this is clearly specified here https://github.com/google/or-tools/blob/stable/ortools/linear_solver/cbc_interface.cc#L379

  // Always turn presolve on (it's the CBC default and it consistently
  // improves performance).
  model.setTypePresolve(0);
  // Special way to set the relative MIP gap parameter as it cannot be set
  // through callCbc.
  model.setAllowableFractionGap(relative_mip_gap_);

BUT in the Cbc code the setting comment say the exact opposite: https://github.com/Mizux/Cbc/blob/master/src/CbcModel.hpp#L1675

/** Whether to automatically do presolve before branch and bound (subTrees).
        0 - no
        1 - ordinary presolve
        2 - integer presolve (dodgy)
    */
  inline int typePresolve() const
  {
    return presolve_;
  }
  inline void setTypePresolve(int value)
  {
    presolve_ = value;
  }

This looks like a bug, from my understanding the model.setTypePresolve should be set to 1 to be consistent with the Cbc interface or (even better) set at the correct value using the existing SetPresolveMode method.

If somebody can validate that this is the case I can open a MR to fix the issue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions