-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
An efficient way to verify the feasibility of provided solution #693
Comments
We don't currently have a tidy way to do this. Maybe most general current approach would be to use the MathProgBase interface to write a "solver" which collects all the problem data in matrix form (for LP/QP/conic models) and checks feasibility that way. |
Oh, I see. I will check with MathProgBase. Thank you. |
@chenzjames, did you figure out how to implement an efficient check of feasibility? If so, would you mind sharing some of the details? |
Sorry, not yet.
…On Sat, 14 Jan 2017 at 21:43, gdowdy3 ***@***.***> wrote:
@chenzjames <https://github.com/chenzjames>, did you figure out how to
implement an efficient check of feasibility? If so, would you mind sharing
some of the details?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#693 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQqbD_kEoXMML8Q9xyEfXZIsj2TTH6tPks5rSNELgaJpZM4HqruI>
.
|
Alright, I've got a solution. It may not be the most efficient computationally, but it is relatively easy to implement. Suggestions for improvements are welcome. Suppose your model "m" has a vector of decision variables x defined by
and a bunch of constraints defined by lines of the form
Suppose you've got another vector z which you want to test for feasibility. You can do this by: (1) adding constraints fixing the values of x, like so
(2) setting the objective function to zero, like so
(3) and calling the solver, like so
If the status is :Optimal, then z is a feasible solution to your problem. On the other hand, if the status is :Infeasible, then z is not a feasible solution. Note that this procedure could potentially give erroneous results because of numerical imprecision. If you are trying to check the feasibility of a solution x returned by the solver, you need to insert a step (0): (0) extract the numerical values of the solver's solution, like so
If the decision variables are supposed to be binary, it's a good idea to round in this extraction process:
|
I put together a simple Julia package to help with this type of model diagnostics. Suggestions, comments and bug reports are welcome. |
@blegat maybe you can highlight here the internal MOI functions that could be used for computing value of constraints. |
You should get the function with the |
Hi,
I am looking for an automatic way to to verify whether a solution is feasible or not to a built up model, especially for model with a large number of constraints.
I am thinking of defining a function whose input is a possible solution of decision variables, then copying all constraints defined in the built up model and associating each of them with a flag or boolean. The final output will be the union of all flags, which indicates the feasibility of the input solution.
Is there any other quick way? Or is it already provided by JuMP but I could not find it.
Thanks, all.
The text was updated successfully, but these errors were encountered: