Skip to content

Commit 610d7a6

Browse files
committed
Update
1 parent 4e097b6 commit 610d7a6

File tree

11 files changed

+37
-9
lines changed

11 files changed

+37
-9
lines changed

src/MultiObjectiveAlgorithms.jl

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module MultiObjectiveAlgorithms
77

88
import Combinatorics
99
import MathOptInterface as MOI
10+
import Printf
1011

1112
"""
1213
struct SolutionPoint
@@ -648,8 +649,6 @@ function MOI.delete(model::Optimizer, ci::MOI.ConstraintIndex)
648649
return
649650
end
650651

651-
import Printf
652-
653652
"""
654653
optimize_inner!(model::Optimizer)
655654
@@ -689,7 +688,7 @@ Log the solution. We have a pre-computed point.
689688
"""
690689
function _log_solution(model::Optimizer, Y)
691690
if !model.silent
692-
print(_format(model.subproblem_count))
691+
print(_format(model.subproblem_count), " ")
693692
for y in Y
694693
print(" ", _format(y))
695694
end
@@ -704,8 +703,8 @@ Log the solution. Assume the subproblem failed to solve.
704703
"""
705704
function _log_solution(model::Optimizer, msg::String)
706705
if !model.silent
707-
print(_format(model.subproblem_count), " ")
708-
print(rpad(msg, 13 * MOI.output_dimension(model.f) - 3))
706+
print(_format(model.subproblem_count), " ")
707+
print(rpad(msg, 13 * MOI.output_dimension(model.f)))
709708
println(" ", _format(time() - model.start_time))
710709
end
711710
return
@@ -834,11 +833,18 @@ function _optimize!(model::Optimizer)
834833
return
835834
end
836835
if !model.silent
837-
print("Iter.")
836+
rule = "-"^(7 + 13 * (MOI.output_dimension(model.f) + 1))
837+
println(rule)
838+
println(" MultiObjectiveAlgorithms.jl")
839+
println(rule)
840+
println("Algorithm: ", _describe(model.algorithm))
841+
println(rule)
842+
print("solve #")
838843
for i in 1:MOI.output_dimension(model.f)
839844
print(lpad("Obj. $i ", 13))
840845
end
841846
println(" Time ")
847+
println(rule)
842848
end
843849
# We need to clear the ideal point prior to starting the solve. Algorithms
844850
# may update this during the solve, otherwise we will update it at the end.
@@ -851,7 +857,10 @@ function _optimize!(model::Optimizer)
851857
_sort!(model.solutions, MOI.get(model, MOI.ObjectiveSense()))
852858
end
853859
if !model.silent
854-
println("Found $(length(model.solutions)) solutions")
860+
println(rule)
861+
println("Terminating with status: ", status)
862+
println("Number of non-dominated solutions: ", length(model.solutions))
863+
println(rule)
855864
end
856865
if MOI.get(model, ComputeIdealPoint())
857866
_compute_ideal_point(model)

src/algorithms/Chalmet.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ This algorithm is restricted to problems with:
2525
"""
2626
struct Chalmet <: AbstractAlgorithm end
2727

28+
_describe(::Chalmet) = "Chalmet()"
29+
2830
function _solve_constrained_model(
2931
model::Optimizer,
3032
::Chalmet,

src/algorithms/Dichotomy.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ mutable struct Dichotomy <: AbstractAlgorithm
3030
Dichotomy() = new(nothing)
3131
end
3232

33+
_describe(::Dichotomy) = "Dichotomy()"
34+
3335
"""
3436
NISE()
3537

src/algorithms/DominguezRios.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ This algorithm is restricted to problems with:
2626
"""
2727
struct DominguezRios <: AbstractAlgorithm end
2828

29+
_describe(::DominguezRios) = "DominguezRios()"
30+
2931
mutable struct _DominguezRiosBox
3032
l::Vector{Float64}
3133
u::Vector{Float64}

src/algorithms/EpsilonConstraint.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ mutable struct EpsilonConstraint <: AbstractAlgorithm
3636
EpsilonConstraint() = new(nothing, nothing)
3737
end
3838

39+
_describe(::EpsilonConstraint) = "EpsilonConstraint()"
40+
3941
MOI.supports(::EpsilonConstraint, ::SolutionLimit) = true
4042

4143
function MOI.set(alg::EpsilonConstraint, ::SolutionLimit, value)

src/algorithms/Hierarchical.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ mutable struct Hierarchical <: AbstractAlgorithm
3737
Hierarchical() = new(Int[], Float64[], Float64[])
3838
end
3939

40+
_describe(::Hierarchical) = "Hierarchical()"
41+
4042
MOI.supports(::Hierarchical, ::ObjectivePriority) = true
4143

4244
function MOI.get(alg::Hierarchical, attr::ObjectivePriority)

src/algorithms/KirlikSayin.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ This algorithm is restricted to problems with:
3131
"""
3232
struct KirlikSayin <: AbstractAlgorithm end
3333

34+
_describe(::KirlikSayin) = "KirlikSayin()"
35+
3436
struct _Rectangle
3537
l::Vector{Float64}
3638
u::Vector{Float64}

src/algorithms/Lexicographic.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ mutable struct Lexicographic <: AbstractAlgorithm
4343
end
4444
end
4545

46+
_describe(::Lexicographic) = "Lexicographic()"
47+
4648
MOI.supports(::Lexicographic, ::ObjectiveRelativeTolerance) = true
4749

4850
function MOI.get(alg::Lexicographic, attr::ObjectiveRelativeTolerance)
@@ -102,8 +104,7 @@ function optimize_multiobjective!(algorithm::Lexicographic, model::Optimizer)
102104
solutions = SolutionPoint[]
103105
status = MOI.OPTIMAL
104106
for sequence in Combinatorics.permutations(sequence)
105-
status, solution =
106-
_solve_in_sequence(algorithm, model, sequence)
107+
status, solution = _solve_in_sequence(algorithm, model, sequence)
107108
if !isempty(solution)
108109
push!(solutions, solution[1])
109110
end

src/algorithms/RandomWeighting.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ mutable struct RandomWeighting <: AbstractAlgorithm
2727
RandomWeighting() = new(nothing)
2828
end
2929

30+
_describe(::RandomWeighting) = "RandomWeighting()"
31+
3032
MOI.supports(::RandomWeighting, ::SolutionLimit) = true
3133

3234
function MOI.set(alg::RandomWeighting, ::SolutionLimit, value)

src/algorithms/Sandwiching.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ algorithm = MOA.Sandwiching(0.0)
2828
mutable struct Sandwiching <: AbstractAlgorithm
2929
precision::Float64
3030
end
31+
32+
_describe(alg::Sandwiching) = "Sandwiching($(alg.precision))"

0 commit comments

Comments
 (0)