Forum Discussion

FICO's avatar
FICO
Community Manager
3 years ago

Rare occurrences of exception xpress.InterfaceError: Incorrect control name

We have an optimization job that ~2% of the time fails with xpress.InterfaceError: Incorrect control name when trying to set xp.controls.miprelstop. This is the first line of code in our solver function (we are using Python and the FICO Python interface via import xpress as xp). Could we avoid this error by calling with xp.init(): as the first line in the function to initialize the environment? Not sure if it's relevant but we are using a floating license and have our xpauth.xpr file saved locally to the instance where our job is being run.

3 Replies

  • FICO's avatar
    FICO
    Community Manager

    Could it be that in those 2% of the cases in which setting miprelstop fails the license is not available? In order to set a control without having an xpress.problem instance a license is required since otherwise the Xpress API cannot check whether the control you are setting actually exists.

    Since you are modifying controls before creating an xpress.problem instance, it is indeed recommended that you explicitly call xprs.init() before doing that (it is recommended to do this using a context manager, see the documentation of that function).

    In general, is it important that you set these controls globally? Unless you are creating many xpress.problem instances in different places and all instances need this setting, I think it would be better to change the control values on the xpress.problem instances:

    with xp.problem() as p:
        p.controls.miprelstop = 0.01
  • FICO's avatar
    FICO
    Community Manager

    That makes sense, we have a wrapper that attempts to catch a "Xpress licensing error 4" message, but sounds like a no license available error could manifest differently if the first thing we try to do is set this control parameter. We've made a change to put our modeling code within a `with xp.init():` context.

  • FICO's avatar
    FICO
    Community Manager

    I confirm that in this particular case a missing license will manifest as "incorrect control name". I have filed a bug report to get this fixed.