Skip to content

Commit

Permalink
Update to JuMP v0.21 (#254)
Browse files Browse the repository at this point in the history
* add jump v0.21 to allowed versions

* FIX: failing tests with JuMP v0.21

 In the APO formulation version of `constraint_mc_power_balance_load`,
instead of looping over the conductors explicitly, we attempted to use
`.==`, which doesn’t seem work in the new version of JuMP for some
reason if even some of the `sum` calls are empty.

* UPD: changelog and version bump

Co-authored-by: David M Fobes <[email protected]>
  • Loading branch information
ccoffrin and pseudocubic authored Mar 12, 2020
1 parent ea55a3d commit c1d34bb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## staged

- none

## v0.8.1

- Update to support JuMP v0.21
- Makes bounds optional, turned on by default (#250)
- Updated transformer data model in the mathematical model (#250)
- Add automatic parsing of lon,lat from buscoords file into PMD data structure (#245, #249)
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "PowerModelsDistribution"
uuid = "d7431456-977f-11e9-2de3-97ff7677985e"
authors = ["David M Fobes <[email protected]>", "Carleton Coffrin"]
repo = "https://github.com/lanl-ansi/PowerModelsDistribution.jl.git"
version = "0.8.0"
version = "0.8.1"

[deps]
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
Expand All @@ -19,7 +19,7 @@ Cbc = ">= 0.4"
InfrastructureModels = "~0.4"
Ipopt = ">= 0.4"
JSON = "~0.18, ~0.19, ~0.20, ~0.21"
JuMP = "~0.19.2, ~0.20"
JuMP = "~0.19.2, ~0.20, ~0.21"
Juniper = ">= 0.4"
MathOptInterface = "~0.8, ~0.9"
Memento = "~0.10, ~0.11, ~0.12"
Expand Down
25 changes: 15 additions & 10 deletions src/form/apo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,21 @@ function constraint_mc_power_balance_load(pm::_PMs.AbstractActivePowerModel, nw:
pt = get(_PMs.var(pm, nw), :pt, Dict()); _PMs._check_var_keys(pt, bus_arcs_trans, "active power", "transformer")
pd = get(_PMs.var(pm, nw), :pd_bus, Dict()); _PMs._check_var_keys(pg, bus_gens, "active power", "generator")

cstr_p = JuMP.@constraint(pm.model,
sum(p[a] for a in bus_arcs)
+ sum(psw[a_sw] for a_sw in bus_arcs_sw)
+ sum(pt[a_trans] for a_trans in bus_arcs_trans)
.==
sum(pg[g] for g in bus_gens)
- sum(ps[s] for s in bus_storage)
- sum(pd[d] for d in bus_loads)
- sum(diag(gs) for gs in values(bus_gs))*1.0^2
)
cstr_p = []

for c in _PMs.conductor_ids(pm; nw=nw)
cp = JuMP.@constraint(pm.model,
sum(p[a][c] for a in bus_arcs)
+ sum(psw[a_sw][c] for a_sw in bus_arcs_sw)
+ sum(pt[a_trans][c] for a_trans in bus_arcs_trans)
==
sum(pg[g][c] for g in bus_gens)
- sum(ps[s][c] for s in bus_storage)
- sum(pd[d][c] for d in bus_loads)
- sum(diag(gs)[c] for gs in values(bus_gs))*1.0^2
)
push!(cstr_p, cp)
end
# omit reactive constraint
cnds = _PMs.conductor_ids(pm, nw)
ncnds = length(cnds)
Expand Down

2 comments on commit c1d34bb

@pseudocubic
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/10894

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.1 -m "<description of version>" c1d34bb940e76d1ba14de4a6244f5bac70f28131
git push origin v0.8.1

Please sign in to comment.