Using IntVar in OR-tools

Viewed 1558

I'm using Google's OR-Tools to solve a problem where some decision variables are integers while others are just positive real.

With pywraplp and glp.Solver.GLOP_LINEAR_PROGRAMMING, I set the integer decision variables as IntVar, whereas the other variables are NumVar

Upon running the solver, I get a feasible solution, but the solution gives non-integer values for the variables which were supposed to integers. How should I use IntVars if i want to get integer values ?

1 Answers

Just ran into the same issue. Below code worked for me:

    solver = pywraplp.Solver("", pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
Related