mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Enable marginal costs
This commit is contained in:
@@ -28,23 +28,34 @@ end
|
|||||||
function solve(
|
function solve(
|
||||||
instance::Instance;
|
instance::Instance;
|
||||||
optimizer = nothing,
|
optimizer = nothing,
|
||||||
|
lp_optimizer = nothing,
|
||||||
output = nothing,
|
output = nothing,
|
||||||
marginal_costs = true,
|
marginal_costs = true,
|
||||||
return_model = false,
|
return_model = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
milp_optimizer = lp_optimizer = optimizer
|
if lp_optimizer == nothing
|
||||||
if optimizer == nothing
|
if optimizer == nothing
|
||||||
milp_optimizer = _get_default_milp_optimizer()
|
# If neither is provided, use default LP optimizer.
|
||||||
lp_optimizer = _get_default_lp_optimizer()
|
lp_optimizer = _get_default_lp_optimizer()
|
||||||
|
else
|
||||||
|
# If only MIP optimizer is provided, use it as
|
||||||
|
# LP solver too.
|
||||||
|
lp_optimizer = optimizer
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if optimizer == nothing
|
||||||
|
optimizer = _get_default_milp_optimizer()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
@info "Building graph..."
|
@info "Building graph..."
|
||||||
graph = RELOG.build_graph(instance)
|
graph = RELOG.build_graph(instance)
|
||||||
_print_graph_stats(instance, graph)
|
_print_graph_stats(instance, graph)
|
||||||
|
|
||||||
@info "Building optimization model..."
|
@info "Building optimization model..."
|
||||||
model = RELOG.build_model(instance, graph, milp_optimizer)
|
model = RELOG.build_model(instance, graph, optimizer)
|
||||||
|
|
||||||
@info "Optimizing MILP..."
|
@info "Optimizing MILP..."
|
||||||
JuMP.optimize!(model)
|
JuMP.optimize!(model)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ println("Initializing...")
|
|||||||
|
|
||||||
using Logging
|
using Logging
|
||||||
using Cbc
|
using Cbc
|
||||||
|
using Clp
|
||||||
using JSON
|
using JSON
|
||||||
using JuMP
|
using JuMP
|
||||||
using RELOG
|
using RELOG
|
||||||
@@ -15,8 +16,9 @@ function solve(root, filename)
|
|||||||
ref_solution, ref_model = RELOG.solve(
|
ref_solution, ref_model = RELOG.solve(
|
||||||
ref_file,
|
ref_file,
|
||||||
optimizer=optimizer,
|
optimizer=optimizer,
|
||||||
|
lp_optimizer=Clp.Optimizer,
|
||||||
return_model=true,
|
return_model=true,
|
||||||
marginal_costs=false,
|
marginal_costs=true,
|
||||||
)
|
)
|
||||||
Libc.flush_cstdio()
|
Libc.flush_cstdio()
|
||||||
flush(stdout)
|
flush(stdout)
|
||||||
@@ -59,6 +61,7 @@ function solve(root, filename)
|
|||||||
ref_model,
|
ref_model,
|
||||||
scenario,
|
scenario,
|
||||||
optimizer=optimizer,
|
optimizer=optimizer,
|
||||||
|
lp_optimizer=Clp.Optimizer,
|
||||||
)
|
)
|
||||||
if length(sc_solution) == 0
|
if length(sc_solution) == 0
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user