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

Xpress ignore LP warm starts #127

Closed
odow opened this issue May 12, 2021 · 8 comments · Fixed by #226
Closed

Xpress ignore LP warm starts #127

odow opened this issue May 12, 2021 · 8 comments · Fixed by #226
Labels

Comments

@odow
Copy link
Member

odow commented May 12, 2021

It looks like it does, but I couldn't find any evidence these are actually passed to the solver

function MOI.set(
model::Optimizer,
::MOI.VariablePrimalStart,
x::MOI.VariableIndex,
value::Union{Nothing, Float64}
)
info = _info(model, x)
info.start = value
return
end
function MOI.get(
model::Optimizer, ::MOI.VariablePrimalStart, x::MOI.VariableIndex
)
return _info(model, x).start
end
function MOI.supports(
::Optimizer, ::MOI.VariablePrimalStart, ::Type{MOI.VariableIndex})
return true
end

Reported on Discourse: https://discourse.julialang.org/t/warmstarting-variables-does-not-work-with-xpress/60989

@henriquebecker91
Copy link
Contributor

I would like to get this working as soon as possible. Someone has already tried something? Is there some hint from what is the source of the bug? I will probably work this weekend on this problem. I am almost sure the warm start is really being ignored because I currently warm start a model with a feasible solution of a subset of the model (a model with less columns) and the XPress spends hours without finding any feasible solution.

@metab0t
Copy link
Contributor

metab0t commented Sep 29, 2021

https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/XPRSaddmipsol.html
I think this function can solve that issue. You need to pass the start value to Xpress solver with this function.

@henriquebecker91
Copy link
Contributor

henriquebecker91 commented Sep 29, 2021

Before making the change, let me confirm if I understood correctly. The solution is to call the aforementioned XPRESS function inside MOI.optimize, before the actual solve, using the values saved in the start field of the Variable wrapper, correct?

Is the aforementioned XPRESS function already wrapped or do I need to write the CCall myself?

Ah, I found it, is this addmipsol(prob::XpressProblem, ilength, mipsolval, mipsolcol, solname).

@metab0t
Copy link
Contributor

metab0t commented Sep 30, 2021

You can write as follows:

function MOI.set( 
     model::Optimizer, 
     ::MOI.VariablePrimalStart, 
     x::MOI.VariableIndex, 
     value::Union{Nothing, Float64} 
 ) 
     info = _info(model, x)
     info.start = value
     if value !== nothing
         Xpress.addmipsol(model.inner, 1, [value], [info.column], C_NULL)
     end
     return 
 end

@henriquebecker91
Copy link
Contributor

Created a PR (#148) to solve the problem. The solution is considerably more complex. Not only because I believe that Xpress.addmipsol does not work one-variable-at-time (I am almost sure it adds a whole solution, even if incomplete, each time; so each variable would be considered a distinct incomplete solution in your example.), but mainly because of another reasons discussed in the PR.

joaquimg added a commit that referenced this issue Oct 1, 2021
Fix issue #127 (Xpress ignore warm starts).
@joaquimg joaquimg changed the title Xpress ignore warm starts Xpress ignore LP warm starts Oct 2, 2021
@joaquimg
Copy link
Member

joaquimg commented Oct 2, 2021

Since #148, MIP warmstart is accepted.

LP warmstart for xpress is harder because we need a basis (see https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/XPRSloadbasis.html)

@henriquebecker91
Copy link
Contributor

If I can raise two questions:

  1. Currently solving an LP multiple consecutive times (adding variables between solves) does reuse the previous base, right? At least this is my impression in practice.
  2. Does JuMP have an API for LP warmstarts? Because set_start_value seems to be only for MIP-starts and I found nothing equivalent for LP.

@joaquimg
Copy link
Member

joaquimg commented Oct 2, 2021

Yes, xpress does re-use the last solution for LPs.

JuMP API for start values is not restricted to MIP by definition. Although it fits well on Xpress' mip start and fits poorly on xpress lp start because it would require converting the solution into a basis.
JuMP also accepts generic atributes if we want to pass something else useful.

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

Successfully merging a pull request may close this issue.

4 participants