Skip to content

Commit

Permalink
No more infeasible cases! Fixes kersulis#1
Browse files Browse the repository at this point in the history
  • Loading branch information
kersulis committed Aug 10, 2018
1 parent ea215c1 commit 9fedcfd
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/core/objective.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ function objective_min_polynomial_fuel_cost(pm::GenericPowerModel{T}) where T <:
dc_p_sqr = Dict()
for (n, nw_ref) in nws(pm)
for c in conductor_ids(pm, n)
pg_sqr = var(pm, n, c)[:pg_sqr] = @variable(pm.model,
pg_sqr = var(pm, n, c)[:pg_sqr] = @variable(pm.model,
[i in ids(pm, n, :gen)], basename="$(n)_$(c)_pg_sqr",
lowerbound = ref(pm, n, :gen, i, "pmin", c)^2,
upperbound = ref(pm, n, :gen, i, "pmax", c)^2
)
lowerbound = 0.0,
upperbound = max(ref(pm, n, :gen, i, "pmax", c)^2, ref(pm, n, :gen, i, "pmin", c)^2)
)
for (i, gen) in nw_ref[:gen]
@constraint(pm.model, norm([2*var(pm, n, c, :pg, i), pg_sqr[i]-1]) <= pg_sqr[i]+1)
end

dc_p_sqr = var(pm, n, c)[:p_dc_sqr] = @variable(pm.model,
dc_p_sqr = var(pm, n, c)[:p_dc_sqr] = @variable(pm.model,
[i in ids(pm, n, :dcline)], basename="$(n)_$(c)_dc_p_sqr",
lowerbound = ref(pm, n, :dcline, i, "pminf", c)^2,
upperbound = ref(pm, n, :dcline, i, "pmaxf", c)^2
Expand Down Expand Up @@ -202,7 +202,7 @@ end
function objective_min_pwl_fuel_cost(pm::GenericPowerModel)

for (n, nw_ref) in nws(pm)
pg_cost = var(pm, n)[:pg_cost] = @variable(pm.model,
pg_cost = var(pm, n)[:pg_cost] = @variable(pm.model,
[i in ids(pm, n, :gen)], basename="$(n)_pg_cost"
)

Expand All @@ -214,7 +214,7 @@ function objective_min_pwl_fuel_cost(pm::GenericPowerModel)
end
end

dc_p_cost = var(pm, n)[:p_dc_cost] = @variable(pm.model,
dc_p_cost = var(pm, n)[:p_dc_cost] = @variable(pm.model,
[i in ids(pm, n, :dcline)], basename="$(n)_dc_p_cost",
)

Expand All @@ -240,12 +240,11 @@ end

"Cost of building branches"
function objective_tnep_cost(pm::GenericPowerModel)
return @objective(pm.model, Min,
return @objective(pm.model, Min,
sum(
sum(
sum( branch["construction_cost"]*var(pm, n, c, :branch_ne, i) for (i,branch) in nw_ref[:ne_branch] )
for c in conductor_ids(pm, n))
for (n, nw_ref) in nws(pm))
)
end

0 comments on commit 9fedcfd

Please sign in to comment.