Skip to content

Commit 0587ede

Browse files
committed
add time limits to compute ideal points
1 parent 9a789dd commit 0587ede

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/MultiObjectiveAlgorithms.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,13 +559,17 @@ function MOI.delete(model::Optimizer, ci::MOI.ConstraintIndex)
559559
return
560560
end
561561

562-
function _compute_ideal_point(model::Optimizer)
562+
function _compute_ideal_point(model::Optimizer, start_time)
563563
objectives = MOI.Utilities.eachscalar(model.f)
564564
model.ideal_point = fill(NaN, length(objectives))
565565
if !MOI.get(model, ComputeIdealPoint())
566566
return
567567
end
568568
for (i, f) in enumerate(objectives)
569+
if _time_limit_exceeded(model, start_time)
570+
status = MOI.TIME_LIMIT
571+
break
572+
end
569573
MOI.set(model.inner, MOI.ObjectiveFunction{typeof(f)}(), f)
570574
MOI.optimize!(model.inner)
571575
status = MOI.get(model.inner, MOI.TerminationStatus())
@@ -584,7 +588,7 @@ function MOI.optimize!(model::Optimizer)
584588
model.termination_status = MOI.INVALID_MODEL
585589
return
586590
end
587-
_compute_ideal_point(model)
591+
_compute_ideal_point(model, start_time)
588592
algorithm = something(model.algorithm, default(Algorithm()))
589593
status, solutions = optimize_multiobjective!(algorithm, model)
590594
model.termination_status = status

0 commit comments

Comments
 (0)