Closed
Description
In trying to set-up a basic 3-obj problem, I observed (if I am not wrong) two cases of inconsistent outputs with the KirlikSayin and the TambyVanderpooten implementations.
The code is given below.
- result_count(model) returns 0 for KirlikSayin. DominguezRios and TambyVanderpooten return 1 non-dominated point and the corresponding solution is valid.
----- KirlikSayin -----
Statut: OPTIMAL
number of non-dominated points: 0
----- DominguezRios -----
Statut: OPTIMAL
number of non-dominated points: 1
Variables (number of trucks) :
x[1,1] = 5.0
x[1,2] = 0.0
x[1,3] = 5.0
x[2,1] = 0.0
x[2,2] = 8.0
x[2,3] = -0.0
Objectives :
- Total cost = 2380.0
- Total time = 46.0
- Total truck = 18.0
----- TambyVanderpooten -----
Statut: OPTIMAL
number of non-dominated points: 1
Variables (number of trucks) :
x[1,1] = 5.0
x[1,2] = 0.0
x[1,3] = 5.0
x[2,1] = 0.0
x[2,2] = 8.0
x[2,3] = -0.0
Objectives :
- Total cost = 2380.0
- Total time = 46.0
- Total truck = 18.0
- I modified 1 value in the matrix
time
as follow[ 8 4 5; 3 2 4 ]
in order to get a problem with more non-dominated points:
- KirlikSayin: result_count(model) returns 0
- DominguezRios: result_count(model) returns 6; all solutions are valid
- TambyVanderpooten: result_count(model) returns 1; the solution is valid (and provided also by DominguezRios)
----- KirlikSayin -----
Statut: OPTIMAL
number of non-dominated points: 0
----- DominguezRios -----
Statut: OPTIMAL
number of non-dominated points: 6
Variables (number of trucks) :
x[1,1] = 3.0
x[1,2] = 2.0
x[1,3] = 5.0
x[2,1] = 2.0
x[2,2] = 6.0
x[2,3] = 0.0
Objectives :
- Total cost = 2500.0
- Total time = 75.0
- Total truck = 18.0
Variables (number of trucks) :
x[1,1] = 2.0
x[1,2] = 3.0
x[1,3] = 5.0
x[2,1] = 3.0
x[2,2] = 5.0
x[2,3] = 0.0
Objectives :
- Total cost = 2560.0
- Total time = 72.0
- Total truck = 18.0
Variables (number of trucks) :
x[1,1] = 4.0
x[1,2] = 1.0
x[1,3] = 5.0
x[2,1] = 1.0
x[2,2] = 7.0
x[2,3] = 0.0
Objectives :
- Total cost = 2440.0
- Total time = 78.0
- Total truck = 18.0
Variables (number of trucks) :
x[1,1] = 1.0
x[1,2] = 4.0
x[1,3] = 5.0
x[2,1] = 4.0
x[2,2] = 4.0
x[2,3] = 0.0
Objectives :
- Total cost = 2620.0
- Total time = 69.0
- Total truck = 18.0
Variables (number of trucks) :
x[1,1] = -8.881784197001252e-16
x[1,2] = 5.000000000000001
x[1,3] = 5.0
x[2,1] = 5.000000000000001
x[2,2] = 2.999999999999999
x[2,3] = 0.0
Objectives :
- Total cost = 2680.0
- Total time = 66.0
- Total truck = 18.0
Variables (number of trucks) :
x[1,1] = 5.0
x[1,2] = 0.0
x[1,3] = 5.0
x[2,1] = -0.0
x[2,2] = 8.0
x[2,3] = 0.0
Objectives :
- Total cost = 2380.0
- Total time = 81.0
- Total truck = 18.0
----- TambyVanderpooten -----
Statut: OPTIMAL
number of non-dominated points: 1
Variables (number of trucks) :
x[1,1] = 5.0
x[1,2] = 0.0
x[1,3] = 5.0
x[2,1] = 0.0
x[2,2] = 8.0
x[2,3] = -0.0
Objectives :
- Total cost = 2380.0
- Total time = 81.0
- Total truck = 18.0
Here the JuMP+MOA model and the 3 optimizations:
using JuMP, HiGHS
import MultiObjectiveAlgorithms as MOA
# Data
cost = [ 100 150 200; # warehouse 1 to customers 1, 2, 3
120 110 170 # warehouse 2 to customers 1, 2, 3
]
time = [ 1 4 5;
3 2 4
]
capacity = [100, 80] # capacity of warehouse (in units)
demand = [50, 80, 50] # demand of customers (in units)
truck_capacity = 10 # capacity a truck
nWarehouses, nCustomers = size(cost)
model = Model()
set_silent(model)
set_optimizer(model,()->MOA.Optimizer(HiGHS.Optimizer))
# variables: x[i,j] = nb of trucks from i to j
@variable(model, x[1:nWarehouses, 1:nCustomers] >= 0, Int)
# Constraints : capacity of warehouses
@constraint(model, [i=1:nWarehouses], 10 * sum(x[i, j] for j in 1:nCustomers) <= capacity[i])
# Constraints : demands of customers
@constraint(model, [j=1:nCustomers], 10 * sum(x[i,j] for i in 1:nWarehouses) == demand[j])
# Objectives
@expression(model, total_cost, sum(cost[i,j] * x[i,j] for i in 1:nWarehouses, j in 1:nCustomers))
@expression(model, total_time, sum(time[i,j] * x[i,j] for i in 1:nWarehouses, j in 1:nCustomers))
@expression(model, total_trucks, sum(x[i,j] for i in 1:nWarehouses, j in 1:nCustomers))
@objective(model, Min, [total_cost, total_time, total_trucks] )
# --------- KirlikSayin ---------
set_attribute(model, MOA.Algorithm(), MOA.KirlikSayin())
optimize!(model)
# Results
println("\n----- KirlikSayin -----")
println("Statut: ", termination_status(model))
println("number of non-dominated points: ", result_count(model))
for s in 1:result_count(model)
println("\nVariables (number of trucks) :")
for i in 1:2, j in 1:3
println("x[$i,$j] = ", value(x[i,j]; result = s))
end
println("Objectives :")
println(" - Total cost = ", value(total_cost; result = s))
println(" - Total time = ", value(total_time; result = s))
println(" - Total truck = ", value(total_trucks; result = s))
end
# --------- DominguezRios ---------
set_attribute(model, MOA.Algorithm(), MOA.DominguezRios())
optimize!(model)
# Results
println("\n----- DominguezRios -----")
println("Statut: ", termination_status(model))
println("number of non-dominated points: ", result_count(model))
for s in 1:result_count(model)
println("\nVariables (number of trucks) :")
for i in 1:2, j in 1:3
println("x[$i,$j] = ", value(x[i,j]; result = s))
end
println("Objectives :")
println(" - Total cost = ", value(total_cost; result = s))
println(" - Total time = ", value(total_time; result = s))
println(" - Total truck = ", value(total_trucks; result = s))
end
# --------- TambyVanderpooten ---------
set_attribute(model, MOA.Algorithm(), MOA.TambyVanderpooten())
optimize!(model)
# Results
println("\n----- TambyVanderpooten -----")
println("Statut: ", termination_status(model))
println("number of non-dominated points: ", result_count(model))
for s in 1:result_count(model)
println("\nVariables (number of trucks) :")
for i in 1:2, j in 1:3
println("x[$i,$j] = ", value(x[i,j]; result = s))
end
println("Objectives :")
println(" - Total cost = ", value(total_cost; result = s))
println(" - Total time = ", value(total_time; result = s))
println(" - Total truck = ", value(total_trucks; result = s))
end
My config:
- HiGHS v1.17.0
- JuMP v1.25.0
- MultiObjectiveAlgorithms v1.4.2
Metadata
Metadata
Assignees
Labels
No labels