Skip to content

XPRESS System.AccessViolationException: Attempted to read or write protected memory (caused because inconsistent number of cols and timelimit) #1952

@davidhdezf

Description

@davidhdezf

What version of OR-tools and what language are you using?
Version: source V7.5 stable

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
XPRESS

What operating system (Linux, Windows, ...) and version?
Windows 10

What did you do?
Solved MIP matrix with a max time limit for XPRESS. The Max time limit was reached.

What did you expect to see
OR tools should return the solution values

What did you see instead?
It crashed with a System.AccessViolation message

Problem/Solution
Note: All the code below is in xpress_interface.cc

The problem is that depending in the status of the solution the next code can bring different values:

XPRSgetintattrib(mLp, XPRS_COLS, &nCols);

In my case it was bringing the Presolve number of columns. But the next code request an array with the original number of columns:

XPRSgetmipsol(mLp, x.get(), 0)

This mismatch of number of columns causes the System.AccessViolation.

In order to solve the problem, it is better to call the number of columns and rows before solving.

int const rows = XPRSgetnumrows(mLp); int const cols = XPRSgetnumcols(mLp);

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions