Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection of non-linear/non-convex problem #274

Open
trulsf opened this issue Aug 21, 2024 · 5 comments
Open

Detection of non-linear/non-convex problem #274

trulsf opened this issue Aug 21, 2024 · 5 comments

Comments

@trulsf
Copy link

trulsf commented Aug 21, 2024

The current implementation calls a different optimization routine depending on internal classification schemes

    if model.has_nlp_constraints
        @checked Lib.XPRSnlpoptimize(model.inner, model.solve_method)
    elseif is_mip(model)
        @checked Lib.XPRSmipoptimize(model.inner, model.solve_method)
    else
        @checked Lib.XPRSlpoptimize(model.inner, model.solve_method)
    end

This does not seem to work properly for non-convex quadratic problems which are not set as having nonlinear constraints and thus failing when calling XPRSlpoptimize. Here is a small example that fails:

using Xpress

m = Model(Xpress.Optimizer)
@variable(m, x >= 0)
@variable(m, y >= 0)
@constraint(m, x + y + x*y <= 5)
@objective(m, Max, x + y)
optimize!(m)

Instead of relying on an internal classification scheme would it not be better to let the choice of algorithm be left for Xpress using the more general XPRSoptimize function? The type of optimization used can then be queried afterwards using the XPRS_OPTIMIZETYPEUSED-attribute if this is needed before solution retrieval.

@odow
Copy link
Member

odow commented Aug 21, 2024

Is this on the latest tagged version or the latest master?

@odow
Copy link
Member

odow commented Aug 21, 2024

Ah it's

if model.has_nlp_constraints
@checked Lib.XPRSnlpoptimize(model.inner, model.solve_method)
elseif is_mip(model)
@checked Lib.XPRSmipoptimize(model.inner, model.solve_method)
else
@checked Lib.XPRSlpoptimize(model.inner, model.solve_method)
end

@odow
Copy link
Member

odow commented Aug 21, 2024

I think the issue was that

Xpress.jl/src/Lib/xprs.jl

Lines 479 to 482 in 60ae1dd

# Function does not exist in v33
function XPRSoptimize(prob, flags, solvestatus, solstatus)
ccall((:XPRSoptimize, libxprs), Cint, (XPRSprob, Cstring, Ptr{Cint}, Ptr{Cint}), prob, flags, solvestatus, solstatus)
end

and some users of Xpress.jl are still stuck on quite outdated versions of Xpress.

@trulsf
Copy link
Author

trulsf commented Aug 22, 2024

That is a pretty old version of Xpress to support. But is it not possible to have code that checks the version of Xpress available and adjusts accordingly? With the current implementation we do not get access to the capabilities of the global solver for nonconvex quadratic problems (nor MIQCQPs where the quadratic part defines a non-convex region).
Alternatively, having some control mechanism to activate the global solver when calling optimize!.

@odow
Copy link
Member

odow commented Aug 22, 2024

But is it not possible to have code that checks the version of Xpress available and adjusts accordingly?

Yeah, we can probably do that. Especially now that we have CI for old and new versions.

That is a pretty old version of Xpress to support

I won't name and shame the customer...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants