How to get a feasible point if the optimization model is not infeasible?
If the model has no objective, I can do this by:
using JuMP, HiGHS
m = Model(HiGHS.Optimizer)
@variable(m, x <= 1)
optimize!(m)
value(x)
But if it do have an objective, this method will no longer work:
using JuMP, HiGHS
m = Model(HiGHS.Optimizer)
@variable(m, x <= 1)
@objective(m, Min, x)
optimize!(m)
value(x)
In other words, I am asking how to delete the objective from a model, or directly, is there any more concise syntax in JuMP to check the feasibility of an objective optimization model and get one of its feasible points when it exists?
JuMP and solvers like HiGHS return a solution to the optimization problem that you formulate. If there are multiple solutions, there is no guarantee about which solution will be returned.
If you want to return a different solution, you must change the problem in some way. Either by adding a different objective, or by adding a new constraint that makes the previous solution infeasible.
Could you further clarify “by adding a different objective”? If we target a problem with a meaning objective (rather than a feasiblity problem), is “by adding a new constraint that makes the previous solution infeasible” the only choice?