Forum Discussion

FICO's avatar
FICO
Community Manager
1 year ago

Different path taken by Xpress Optimizer for solving

We are using Xpress Optimizer version 9.4.0 and have observed differences in how the same problem is solved when:

  1. The model is constructed programmatically by creating constraints, variables, etc.
  2. The model is loaded from an LP file and then solved.

Observations:

  • The logs show differences in the starting solution at the root node and in how heuristics are applied.
  • This results in different solving behavior and potentially different solutions.

Questions:

  1. What could be the reason for this difference in behavior?
  2. How can we ensure deterministic performance and solution across both methods?

Additional Notes:

  • The problem definition remains identical across both cases.
  • Any insights or suggestions on enforcing consistency would be greatly appreciated!

Thanks in advance!

2 Replies

  • FICO's avatar
    FICO
    Community Manager

    The simple answer is that the order of columns (variables) will be different, and that leads to different results. This is because when reading an lp file the variables are discovered on the fly. This is not specific to Xpress, most solvers behave the same way.

    One way to try to mitigate that is to put all the variables in the correct order in the objective, with a coefficient of 0 if needed. For example:

    Minimize

    __OBJ___: 0 x1 + 0 x2 + 0 x3 + x4

    This way the order of columns is x1, x2, x3, x4, while using

    Minimize

    __OBJ___: x4

    x4 will be the very first variable.

    There can be more subtle differences, for example the accuracy to which the numbers are written to the lp file.

  • FICO's avatar
    FICO
    Community Manager

    Understood. Thank you for the reply.