0

I am working with C API of CPLEX. I have a bunch of optional binary variables (which can constitute any percentage of the total number of variables). I tried solving my BIP model both ways: (i) fixing them to 0 and (ii) not having these variables altogether in the model. On average I could not find any significant difference in the computational times. I want to know if there is something wrong or CPLEX works that way. I expected that with fewer variables, the model should have run much faster in the second case.

  • I've never used CPLEX, but this optimization is expected. So you should be fine fixing variables instead of manually removing them. – ziggystar Dec 03 '19 at 14:18
  • 1
    If you fix the value of (some) variables in your problem, then the CPLEX pre-solve can substitute the value for the variable in most cases, and the solve time should be very similar. You should be able to see what the pre-solve processing has done to your model in the log file (lines like pre-solve has removed nnn variables etc.). If you have a lot of fixed variables, then there may be some small benefit in reduced memory footprint etc if you remove those variables before passing the model to CPLEX, but not usually very significant unless they are a large proportion of your problem. – TimChippingtonDerrick Dec 04 '19 at 14:35

1 Answers1

1

This is expected behavior. Fixed variables are removed in a first presolve path which is usually very fast. Then CPLEX internally works only on the presolved model, i.e., the same model as the one that did not have those variables in the first place.

Daniel Junglas
  • 5,830
  • 1
  • 5
  • 22