-
Notifications
You must be signed in to change notification settings - Fork 42
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
fix empty optimization result + test of infeasible ip restricted master #173
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function masteripheur_tests() | ||
infeasible_master_ip_heur_tests() | ||
end | ||
|
||
CL.to_be_pruned(n::CL.Node) = true # issue 166 | ||
|
||
struct InfeasibleMasterIpHeur <: CL.AbstractConquerStrategy end | ||
|
||
function CL.apply!(::Type{InfeasibleMasterIpHeur}, reform, node, strategy_rec::CL.StrategyRecord, params) | ||
# Apply directly master ip heuristic => infeasible | ||
mip_rec = CL.apply!(CL.MasterIpHeuristic, reform, node, strategy_rec, params) | ||
return | ||
end | ||
|
||
function infeasible_master_ip_heur_tests() | ||
@testset "play gap" begin | ||
data = CLD.GeneralizedAssignment.data("play2.txt") | ||
|
||
coluna = JuMP.with_optimizer( | ||
Coluna.Optimizer, | ||
params = CL.Params( | ||
global_strategy = CL.GlobalStrategy(InfeasibleMasterIpHeur, CL.NoBranching, CL.DepthFirst) | ||
), | ||
default_optimizer = with_optimizer(GLPK.Optimizer) | ||
) | ||
|
||
problem, x, dec = CLD.GeneralizedAssignment.model(data, coluna) | ||
|
||
JuMP.optimize!(problem) | ||
@test JuMP.objective_value(problem) == Inf | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also check the feasibility status? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It returns INFEASIBLE. I think it should be NODE_LIMIT. We should do that in another PR and tests all possible termination statuses. |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function optimizationresults_unit_test() | ||
emptyresults_tests() | ||
end | ||
|
||
function emptyresults_tests() | ||
result = CL.OptimizationResult{CL.MinSense}() | ||
@test CL.getprimalbound(result) == Inf | ||
@test CL.getdualbound(result) == -Inf | ||
@test CL.getbestprimalsol(result) == nothing | ||
@test CL.getbestdualsol(result) == nothing | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should leave it to the user to ask if there is a solution available in case he is not sure.
We could add a function
issolavailable
Anyway after calling
getbestsol
he will need to check if the return value wasnothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add
nbprimalsol()
andnbdualsol()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are already there..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what is the best behavior? In any case, the user should assure himself that there is at least one solution available, it he uses directly the result of the new
getbestsol
he might also get in troubleThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine for now if it returns nothing. I added new methods to handle this case e.g.
set_lp_primal_sol!(inc::Incumbents, ::Nothing) = false
. If the user works on the solution, he will have to test thatsolution != nothing
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means we will have to add methods for functions that expect a solution all over the place.