I just inherited a piece of code, which solves a mixed integer programming problem using OR Tools. Integrating OR Tools into VS 2019 was a headache of its own (well, I'm not that used to C++). Now the program is running, but I am getting:
Access violation reading location 0x0000000000000020
According to the debugger, it looks like solver.MutableObjective() is returning null.
Other functions like MakeRowConstraint seem to work fine though, and they don't return null. Any clue what's going on? Could it be something I misconfigured when installing the library maybe?
MPSolver solver("simple_mip_program", MPSolver::SCIP_MIXED_INTEGER_PROGRAMMING);
//...
MPObjective* FObj = solver.MutableObjective(); // <-- NULL
//therefore the below throws exception.
//The arrays `variables` and `F` are populated as expected
for (int i = 0; i < n; i++) FObj->SetCoefficient(variables[i], F[i]);
FObj->SetMaximization();
Edit: A little more details, I am using ORTools 64bit_v8.1.8487, on Windows 10 and Visual Studio 2019.
I also tried running the sample MIP problem from GitHub, and same error occurred on line 54.