Forum Discussion

FICO's avatar
FICO
Community Manager
6 years ago

How to solve MPEC (non-convex QCQP) through Python API?

I am trying to solve MPEC (non-convex QCQP) with Xpress through the Python API. I am running v8.5.13 (due to institutional license).

I get the following error: ?900 Warning: The quadratic part of row 'xx' defines a nonconvex region. Please check your model or use Xpress-SLP

I have tried turning off the convexity check and forcing the solver to Xpress-SLP as stated in the API guide.

However then I get a 'lp_unsolved' error.

Does this mean that there is an issue with my problem or with the solver settings?

I have a MILP reformulation which works correctly but is fairly slow, so am looking to use the MPEC solution information to reduce the MILP computational time.

Thanks,

Saurab

3 Replies

  • FICO's avatar
    FICO
    Community Manager

    Do you solve the problem with the solve() method? If so, the library might be attempting to use the Optimizer's QP solver. Can you try replacing

    p.solve()

    with

    p.nlpoptimize()

    and see if this works? The latter calls the nonlinear solver directly.

    Hope this helps.

  • FICO's avatar
    FICO
    Community Manager

    Thank you! Works perfectly now.

    One additional question, what is the simplest way to set initial values of the decision variables for the problem?

  • FICO's avatar
    FICO
    Community Manager

    Hi, a starting solution can be specified by either setting the xslp_defaultiv control (which sets all variables to one value) as follows:

    p = xpress.problem()

    p.controls.xslp_defaultiv = 42

    or using the xpress.problem.loadvars() method, which allows for setting a differnet initial value for each variable.

    Hope this helps.