Make plants capacitated

v0.1
Alinson S. Xavier 6 years ago
parent ed70c9d1e2
commit 021a657ba9

@ -76,7 +76,7 @@
"L1": { "L1": {
"latitude": 0.0, "latitude": 0.0,
"longitude": 0.0, "longitude": 0.0,
"capacity": 500, "capacity": 5000,
"opening cost": 2000, "opening cost": 2000,
"fixed operating cost": 70.0, "fixed operating cost": 70.0,
"variable operating cost": 70.0, "variable operating cost": 70.0,
@ -95,7 +95,7 @@
"latitude": 0.5, "latitude": 0.5,
"longitude": 0.5, "longitude": 0.5,
"opening cost": 1000, "opening cost": 1000,
"capacity": 750, "capacity": 7500,
"opening cost": 1000, "opening cost": 1000,
"fixed operating cost": 50.0, "fixed operating cost": 50.0,
"variable operating cost": 50.0 "variable operating cost": 50.0

@ -21,6 +21,7 @@ mutable struct ProcessNode <: Node
incoming_arcs::Array incoming_arcs::Array
outgoing_arcs::Array outgoing_arcs::Array
fixed_cost::Float64 fixed_cost::Float64
capacity::Float64
end end
mutable struct ShippingNode <: Node mutable struct ShippingNode <: Node
@ -131,8 +132,8 @@ function create_process_node_constraints!(mip, nodes, vars)
for a in n.outgoing_arcs for a in n.outgoing_arcs
@constraint(mip, vars.flow[a] == a.values["weight"] * input_sum) @constraint(mip, vars.flow[a] == a.values["weight"] * input_sum)
end end
# If plant is closed, input must be zero # If plant is closed, input must be zero. If plant is opened, input must be below capacity.
@constraint(mip, input_sum <= 1e6 * vars.open_plant[n]) @constraint(mip, input_sum <= n.capacity * vars.open_plant[n])
end end
end end
@ -166,7 +167,18 @@ function create_nodes_and_arcs(instance)
for plant in product["input plants"] for plant in product["input plants"]
for (location_name, location) in plant["locations"] for (location_name, location) in plant["locations"]
cost = location["opening cost"] + location["fixed operating cost"] cost = location["opening cost"] + location["fixed operating cost"]
n = ProcessNode(product_name, plant["name"], location_name, [], [], cost) if "capacity" in keys(location)
capacity = location["capacity"]
else
capacity = 1e10
end
n = ProcessNode(product_name,
plant["name"],
location_name,
[], # incoming_arcs
[], # outgoing_arcs
cost,
capacity)
process_nodes[n.product_name, n.plant_name, n.location_name] = n process_nodes[n.product_name, n.plant_name, n.location_name] = n
end end
end end

@ -31,6 +31,7 @@
"variable operating cost": { "type": "number" }, "variable operating cost": { "type": "number" },
"fixed operating cost": { "type": "number" }, "fixed operating cost": { "type": "number" },
"opening cost": { "type": "number" }, "opening cost": { "type": "number" },
"capacity": { "type": "number" },
"disposal": { "disposal": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {

Loading…
Cancel
Save