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

Help with MILP formulation. #80

Open
JavalVyas2000 opened this issue Nov 16, 2023 · 2 comments
Open

Help with MILP formulation. #80

JavalVyas2000 opened this issue Nov 16, 2023 · 2 comments

Comments

@JavalVyas2000
Copy link

I am trying to formulate a QUBO for a MILP scheduling problem which has 3 equations and an objective function. The model is formulated as

RTN=Model(Gurobi.Optimizer)
@constraint(RTN, Balance[r in R, t in T1],
X[r,t] -
(X[r,t-1]
+ ∑(
μ[i,r,θ] * N[i,t-θ]
+ ν[i,r,θ] * ξ[i,t-θ]
for i in Ir[r], θ in 0:max_tau if θ ≤ tau[i] && t-θ ≥ 1
)
+ Π[r,t])==0
)
@constraint(RTN, ResourceLB[r in R, t in T1],
X[r,t]-Xmin[r]>=0
)
@constraint(RTN, ResourceUB[r in R, t in T1],
Xmax[r]-X[r,t]>=0
)
@constraint(RTN, BatchLB[i in I, t in T1],
ξ[i,t]- ( Vmin[i] * N[i,t])>=0
)
@constraint(RTN, BatchUB[i in I, t in T1],
Vmax[i] * N[i,t]-ξ[i,t]>=0
)
@objective(RTN,
Min,
∑(N[i,t] for i in I, t in T1)
)

Here, N[i,t] is a binary variable, X[r,t] and ξ[i,t] are continous variables, rest all are parameters. I am able to solve this model with gurobi to an objective value of 5 in under a second (which it should be), but when I use the TOQUBO.jl to reformulate it as a QUBO and solve the problem my objective value reached in the range of 1e16 and takes around 300+ seconds.

To convert to QUBO, I implement the model as
RTN=Model(() -> ToQUBO.Optimizer(DWaveNeal.Optimizer))
And then write the above constraints and objective.

Am I missing something? Kindly help me with this implementation.

@pedroripper
Copy link
Member

Hi @JavalVyas2000 !

When we convert a general problem to a QUBO, the resulting model might be loosing some of its original information...

When encoding continuous variables, there is no exact solution as with integer ones. So there are probably some error being introduced at this step. Also, your original problem seems quite big, so the final QUBO probably has a large amount of variables and accumulated errors.

However, I believe that the main issue is the penalization of your constraints. Our reformulator might not be calculating the correct penalty for each of your constraints. Also, due to the fact that the variables are not integer, the bounds for the constraints may not be tight enough.

We are currently finishing an update on our code that allows the user to set the penalization value, so it would be possible to "tune" your QUBO model to with the appropriate penalizations.

I will reach out to you as soon as we are finished with the update 🙂

@JavalVyas2000
Copy link
Author

JavalVyas2000 commented Nov 19, 2023 via email

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

No branches or pull requests

2 participants