Hi, I want to solve the following problem (maximum flow with losses):
For a graph with source node s and target node t let \forall v \notin \{s,t\}: \sum_{u} f_{u, v} = \sum_u \alpha_{v,u} f_{v, u} where \alpha_{v,u} = \alpha_{u,v} > 1 represents the loss coefficient (such that there is always a clear path of least resistance).
Also 0 \leq f_{u,v} \leq c_{u,v} (capacity constraint) holds.
Define F := \max_{f_{u,v}} \sum_u f_{u,t} (maximum output flow) and find the unique (f_{u,v})_{u,v\in V} which attains \min_{f_{u,v}} \sum_v f(s, v) s.t. \sum_u f_{u,t} = F (minimum input flow aka least waste of energy by transportation).
For that, I use MOA.Hierarchical() from MultiObjectiveAlgorithms.jl with HiGHS.jl:
function create_solver(model, resistance_matrix, source, target)
solver = Model(() -> MOA.Optimizer(HiGHS.Optimizer))
set_silent(solver)
n = size(resistance_matrix, 1)
magic_number = 1000000
@variable(solver, f[i = 1:n, j = 1:n; near(model, i, j)] >= 0)
# Capacity constraints
@constraint(solver, upper[i = 1:n, j = 1:n; near(model, i, j)], f[i, j] <= magic_number)
# Flow conservation constraints with losses
@constraint(solver, [i = 1:n; i != source && i != target], sum(f[:, i]) == sum(resistance_matrix[j, i] * f[i, j] for j in 1:n if near(model, i, j)))
# Multi-objective optimization
@objective(solver, Max, [sum(f[:, 2]), -sum(f[1, :])])
set_attribute(solver, MOA.Algorithm(), MOA.Hierarchical())
set_attribute.(solver, MOA.ObjectivePriority.(1:2), [2, 1])
return solver
end
However, this is very slow (~20 times slower than the single objective LP). Any ideas on how to speed it up or rewrite it in a smarter way?