Skip to content

Commit 952b966

Browse files
authored
JuMP v0.19 / MathOptInterface Update (#137)
* UPD: MOI 0.8.1 and JuMP 0.19-beta2 compatibility Change `using JuMP` to `import JuMP` * `norm(x) <= t` --> `[t, x...] in SecondOrderCone()` * `lowerbound`, `upperbound`, and `basename` in `@variable` to `lower_bound`, `upper_bound`, and `base_name`, respectively. * `setupperbound` --> `set_upper_bound` * `setlowerbound` --> `set_lower_bound` Update one test, probably due to numerical instability from optimizer change. * REF: Remove support for Julia < v1.0 changes to use `import` instead of `using` removes all reverse compatibility code for julia versions lower than v1.0 adds unit testing on julia 1.1 and nightly (allowed failure) removes compat (no longer required) * UPD: add Juniper to manifest * UPD: manifest.toml * UPD: ACR to moi * FIX: relax atol for numerical stability on linux tests * UPD: Pkg3 syntax updates to package 3 syntax * UPD: Pkg3 syntax * UPD: Version bump * UPD: Changelog, manifest, travis * UPD: InfrastructureModels version bound / Manifest * FIX: missed conflict during rebase * FIX: docs build * FIX: jump syntax update on transformers * FIX: PowerModels in manifest * UPD: project.toml updates and NFAForm addition * UPD: manifest.toml for powermodels v0.10 * FIX: `JuMP.getvalue` depeciated -> `JuMP.value` * FIX: failing storage multinetwork test
1 parent 451a86e commit 952b966

17 files changed

+131
-135
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ ThreePhasePowerModels.jl Change Log
44
### staged
55
- nothing
66

7+
### v0.3.0
8+
- Update to JuMP v0.19/MathOptInterface
9+
710
### v0.2.1
811
- Add transformer support to active power only models
912
- Fix bug in source_ids of new components created for transformer support

Manifest.toml

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ uuid = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
1010
version = "0.8.10"
1111

1212
[[BinaryProvider]]
13-
deps = ["Libdl", "Pkg", "SHA", "Test"]
14-
git-tree-sha1 = "055eb2690182ebc31087859c3dd8598371d3ef9e"
13+
deps = ["Libdl", "SHA"]
14+
git-tree-sha1 = "c7361ce8a2129f20b0e05a89f7070820cfed6648"
1515
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
16-
version = "0.5.3"
16+
version = "0.5.4"
1717

1818
[[Calculus]]
1919
deps = ["Compat"]
@@ -76,10 +76,10 @@ uuid = "f6369f11-7733-5829-9624-2563aa707210"
7676
version = "0.10.3"
7777

7878
[[InfrastructureModels]]
79-
deps = ["Compat", "JuMP", "LinearAlgebra", "Memento", "Random", "Test"]
80-
git-tree-sha1 = "7e123cb8dd591c6e5aa90885fbce41d34cc8ed0c"
79+
deps = ["JuMP", "Memento"]
80+
git-tree-sha1 = "ec3f1ba27dbfd29a93f3c520ee189ce32deec049"
8181
uuid = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
82-
version = "0.0.14"
82+
version = "0.2.0"
8383

8484
[[InteractiveUtils]]
8585
deps = ["Markdown"]
@@ -92,10 +92,10 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
9292
version = "0.20.0"
9393

9494
[[JuMP]]
95-
deps = ["Calculus", "Compat", "ForwardDiff", "Libdl", "MathProgBase", "Pkg", "ReverseDiffSparse", "Serialization"]
96-
git-tree-sha1 = "3bd8e52f7aeb2736a8e1b0d8ae8d01c2c85fea24"
95+
deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "NaNMath", "Random", "SparseArrays", "Statistics"]
96+
git-tree-sha1 = "5df42febdee8ac7db9de66c712e439a6ff06459d"
9797
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
98-
version = "0.18.5"
98+
version = "0.19.1"
9999

100100
[[LibGit2]]
101101
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
@@ -114,11 +114,11 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
114114
deps = ["Base64"]
115115
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
116116

117-
[[MathProgBase]]
118-
deps = ["Compat"]
119-
git-tree-sha1 = "3bf2e534e635df810e5f4b4f1a8b6de9004a0d53"
120-
uuid = "fdba3010-5040-5b88-9595-932c9decdf73"
121-
version = "0.7.7"
117+
[[MathOptInterface]]
118+
deps = ["Compat", "Unicode"]
119+
git-tree-sha1 = "5d3de69c9220610d0336ab45d3eb8b6ac7a7c807"
120+
uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
121+
version = "0.8.4"
122122

123123
[[Memento]]
124124
deps = ["Dates", "Distributed", "JSON", "Serialization", "Sockets", "Syslogs", "Test", "TimeZones", "UUIDs"]
@@ -158,10 +158,10 @@ deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUID
158158
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
159159

160160
[[PowerModels]]
161-
deps = ["InfrastructureModels", "JSON", "JuMP", "LinearAlgebra", "Memento", "SparseArrays"]
162-
git-tree-sha1 = "5b463afe0411913338991157bfb3c953346c77bd"
161+
deps = ["InfrastructureModels", "JSON", "JuMP", "LinearAlgebra", "MathOptInterface", "Memento", "SparseArrays"]
162+
git-tree-sha1 = "07ab528b4c9316a17cdd8d207f260c11efa6688d"
163163
uuid = "c36e90e8-916a-50a6-bd94-075b64ef4655"
164-
version = "0.9.6"
164+
version = "0.10.0"
165165

166166
[[Printf]]
167167
deps = ["Unicode"]
@@ -175,12 +175,6 @@ uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
175175
deps = ["Serialization"]
176176
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
177177

178-
[[ReverseDiffSparse]]
179-
deps = ["Calculus", "Compat", "DataStructures", "ForwardDiff", "MathProgBase", "NaNMath"]
180-
git-tree-sha1 = "cbbc2c710abea5cfe71459ce4711d80a212aac5a"
181-
uuid = "89212889-6d3f-5f97-b412-7825138f6c9c"
182-
version = "0.8.6"
183-
184178
[[SHA]]
185179
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
186180

Project.toml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,33 @@ name = "ThreePhasePowerModels"
22
uuid = "8503087a-994b-5095-bd6e-f54267f2dd19"
33
authors = ["David M Fobes <dfobes@lanl.gov>", "Carleton Coffrin"]
44
repo = "https://github.com/lanl-ansi/ThreePhasePowerModels.jl.git"
5-
version = "0.2.1"
5+
version = "0.3.0"
66

77
[deps]
88
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
99
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
1010
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
11+
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
1112
Memento = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9"
1213
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
1314

1415
[compat]
15-
# Cbc = ">= 0.4"
16-
InfrastructureModels = "< 0.2"
17-
# Ipopt = ">= 0.4"
18-
JuMP = "< 0.19"
19-
# Juniper = "< 0.4"
16+
Cbc = ">= 0.4"
17+
InfrastructureModels = "^0.2"
18+
Ipopt = ">= 0.4"
19+
JuMP = "^0.19.1"
20+
Juniper = ">= 0.4"
2021
Memento = ">= 0.8, < 0.13"
21-
# Pavito = ">= 0.1.1"
22-
PowerModels = "^0.9"
23-
# SCS = ">= 0.4.1"
22+
PowerModels = "^0.10"
23+
SCS = ">= 0.4"
2424
julia = "^1"
2525

2626
[extras]
2727
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
2828
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
2929
Juniper = "2ddba703-00a4-53a7-87a5-e8b9971dde84"
30-
Pavito = "cd433a01-47d1-575d-afb7-6db927ee8d8f"
3130
SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13"
3231
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3332

3433
[targets]
35-
test = ["Cbc", "Ipopt", "Juniper", "Pavito", "SCS", "Test"]
34+
test = ["Cbc", "Ipopt", "Juniper", "SCS", "Test"]

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
4+
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"

docs/make.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ using Documenter, ThreePhasePowerModels
22

33
makedocs(
44
modules = [ThreePhasePowerModels],
5-
format = :html,
5+
format = Documenter.HTML(analytics = ""),
66
sitename = "ThreePhasePowerModels",
77
authors = "Carleton Coffrin, David Fobes, Frederik Geth and contributors.",
8-
analytics = "",
98
pages = [
109
"Home" => "index.md",
1110
"Manual" => [

src/core/relaxation_scheme.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function relaxation_psd_to_soc_real_conic(m, mx)
6868
n_elements = size(mx,1)
6969
for i in 1:n_elements-1
7070
for j in i+1:n_elements
71-
JuMP.@constraint(m, norm([2*mx[i,j], mx[i,i]-mx[j,j]]) <= mx[i,i]+mx[j,j])
71+
JuMP.@constraint(m, [mx[i,i]+mx[j,j], 2*mx[i,j], mx[i,i]-mx[j,j]] in JuMP.SecondOrderCone())
7272
end
7373
end
7474
end
@@ -93,7 +93,7 @@ function relaxation_psd_to_soc_complex_conic(m, mxreal, mximag)
9393
n_elements = size(mxreal,1)
9494
for i in 1:n_elements-1
9595
for j in i+1:n_elements
96-
JuMP.@constraint(m, norm([2*mxreal[i,j], 2*mximag[i,j], mxreal[i,i]-mxreal[j,j]]) <= mxreal[i,i]+mxreal[j,j])
96+
JuMP.@constraint(m, [mxreal[i,i]+mxreal[j,j], 2*mxreal[i,j], 2*mximag[i,j], mxreal[i,i]-mxreal[j,j]] in JuMP.SecondOrderCone())
9797
end
9898
end
9999
end
@@ -171,6 +171,6 @@ function relaxation_psd_to_psd_real(m, mxreal, mximag; ndim=3)
171171
j = i+(ndim-1)
172172
mr = mxreal[i:j, i:j]
173173
mi = mximag[i:j, i:j]
174-
JuMP.@SDconstraint(m, [mr -mi; mi mr] >=0)
174+
JuMP.@constraint(m, [mr -mi; mi mr] in JuMP.PSDCone())
175175
end
176176
end

src/core/variable.jl

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ function variable_tp_voltage_magnitude_sqr(pm::PMs.GenericPowerModel; nw::Int=pm
3030

3131
if bounded
3232
W = PMs.var(pm, nw)[:w] = JuMP.@variable(pm.model,
33-
[i in bus_cnd], basename="$(nw)_w",
34-
lowerbound = PMs.ref(pm, nw, :bus, i[1], "vmin", i[2])^2,
35-
upperbound = PMs.ref(pm, nw, :bus, i[1], "vmax", i[2])^2,
33+
[i in bus_cnd], base_name="$(nw)_w",
34+
lower_bound = PMs.ref(pm, nw, :bus, i[1], "vmin", i[2])^2,
35+
upper_bound = PMs.ref(pm, nw, :bus, i[1], "vmax", i[2])^2,
3636
start = PMs.getval(PMs.ref(pm, nw, :bus, i[1]), "w_start", i[2], 1.001)
3737
)
3838
else
3939
W = PMs.var(pm, nw)[:w] = JuMP.@variable(pm.model,
40-
[i in bus_cnd], basename="$(nw)_w",
41-
lowerbound = 0,
40+
[i in bus_cnd], base_name="$(nw)_w",
41+
lower_bound = 0,
4242
start = PMs.getval(PMs.ref(pm, nw, :bus, i[1]), "w_start", i[2], 1.001)
4343
)
4444
end
@@ -57,36 +57,36 @@ function variable_tp_voltage_product(pm::PMs.GenericPowerModel; nw::Int=pm.cnw,
5757
append!(bus_cnd, bp_cndf_cndt)
5858

5959
WR = PMs.var(pm, nw)[:wr] = JuMP.@variable(pm.model,
60-
[b in bus_cnd], basename="$(nw)_wr",
60+
[b in bus_cnd], base_name="$(nw)_wr",
6161
start = PMs.getval(b[1] != b[2] ? PMs.ref(pm, nw, :buspairs, b[1:2]) : PMs.ref(pm, nw, :bus, b[1]), "wr_start", b[3], 1.0)
6262
)
6363

6464
WI = PMs.var(pm, nw)[:wi] = JuMP.@variable(pm.model,
65-
[b in bus_cnd], basename="$(nw)_wi",
65+
[b in bus_cnd], base_name="$(nw)_wi",
6666
start = PMs.getval(b[1] != b[2] ? PMs.ref(pm, nw, :buspairs, b[1:2]) : PMs.ref(pm, nw, :bus, b[1]), "wi_start", b[3])
6767
)
6868

6969
if bounded
7070
# Diagonal bounds
7171
wr_min, wr_max, wi_min, wi_max = PMs.calc_voltage_product_bounds(PMs.ref(pm, nw, :buspairs), cnd)
7272
for (i, j) in PMs.ids(pm, nw, :buspairs)
73-
PMs.JuMP.setupperbound(WR[(i, j, cnd, cnd)], wr_max[(i,j)])
74-
PMs.JuMP.setupperbound(WI[(i, j, cnd, cnd)], wi_max[(i,j)])
73+
JuMP.set_upper_bound(WR[(i, j, cnd, cnd)], wr_max[(i,j)])
74+
JuMP.set_upper_bound(WI[(i, j, cnd, cnd)], wi_max[(i,j)])
7575

76-
JuMP.setlowerbound(WR[(i, j, cnd, cnd)], wr_min[(i,j)])
77-
JuMP.setlowerbound(WI[(i, j, cnd, cnd)], wi_min[(i,j)])
76+
JuMP.set_lower_bound(WR[(i, j, cnd, cnd)], wr_min[(i,j)])
77+
JuMP.set_lower_bound(WI[(i, j, cnd, cnd)], wi_min[(i,j)])
7878
end
7979

8080
# Off-diagonal bounds
8181
for c in PMs.conductor_ids(pm)
8282
if c != cnd
8383
wr_min, wr_max, wi_min, wi_max = calc_tp_voltage_product_bounds(pm, bus_cnd)
8484
for k in bus_cnd
85-
PMs.JuMP.setupperbound(WR[k], wr_max[k])
86-
PMs.JuMP.setupperbound(WI[k], wi_max[k])
85+
JuMP.set_upper_bound(WR[k], wr_max[k])
86+
JuMP.set_upper_bound(WI[k], wi_max[k])
8787

88-
JuMP.setlowerbound(WR[k], wr_min[k])
89-
JuMP.setlowerbound(WI[k], wi_min[k])
88+
JuMP.set_lower_bound(WR[k], wr_min[k])
89+
JuMP.set_lower_bound(WI[k], wi_min[k])
9090
end
9191
end
9292
end
@@ -123,7 +123,7 @@ end
123123
""
124124
function variable_active_bus_power_slack(pm::PMs.GenericPowerModel; nw::Int=pm.cnw, cnd::Int=pm.ccnd)
125125
PMs.var(pm, nw, cnd)[:p_slack] = JuMP.@variable(pm.model,
126-
[i in PMs.ids(pm, nw, :bus)], basename="$(nw)_$(cnd)_p_slack",
126+
[i in PMs.ids(pm, nw, :bus)], base_name="$(nw)_$(cnd)_p_slack",
127127
start = PMs.getval(PMs.ref(pm, nw, :bus, i), "p_slack_start", cnd)
128128
)
129129
end
@@ -132,7 +132,7 @@ end
132132
""
133133
function variable_reactive_bus_power_slack(pm::PMs.GenericPowerModel; nw::Int=pm.cnw, cnd::Int=pm.ccnd)
134134
PMs.var(pm, nw, cnd)[:q_slack] = JuMP.@variable(pm.model,
135-
[i in PMs.ids(pm, nw, :bus)], basename="$(nw)_$(cnd)_q_slack",
135+
[i in PMs.ids(pm, nw, :bus)], base_name="$(nw)_$(cnd)_q_slack",
136136
start = PMs.getval(PMs.ref(pm, nw, :bus, i), "q_slack_start", cnd)
137137
)
138138
end
@@ -149,16 +149,16 @@ function variable_tp_trans_active_flow(pm::PMs.GenericPowerModel; nw::Int=pm.cnw
149149
for cnd in PMs.conductor_ids(pm)
150150
PMs.var(pm, nw, cnd)[:pt] = JuMP.@variable(pm.model,
151151
[(l,i,j) in PMs.ref(pm, nw, :arcs_trans)],
152-
basename="$(nw)_$(cnd)_p_trans",
152+
base_name="$(nw)_$(cnd)_p_trans",
153153
start=0
154154
)
155155
if bounded
156156
for arc in PMs.ref(pm, nw, :arcs_trans)
157157
tr_id = arc[1]
158158
flow_lb = -PMs.ref(pm, nw, :trans, tr_id, "rate_a")[cnd]
159159
flow_ub = PMs.ref(pm, nw, :trans, tr_id, "rate_a")[cnd]
160-
JuMP.setlowerbound(PMs.var(pm, nw, cnd, :pt, arc), flow_lb)
161-
JuMP.setupperbound(PMs.var(pm, nw, cnd, :pt, arc), flow_ub)
160+
JuMP.set_lower_bound(PMs.var(pm, nw, cnd, :pt, arc), flow_lb)
161+
JuMP.set_upper_bound(PMs.var(pm, nw, cnd, :pt, arc), flow_ub)
162162
end
163163
end
164164
end
@@ -170,16 +170,16 @@ function variable_tp_trans_reactive_flow(pm::PMs.GenericPowerModel; nw::Int=pm.c
170170
for cnd in PMs.conductor_ids(pm)
171171
PMs.var(pm, nw, cnd)[:qt] = JuMP.@variable(pm.model,
172172
[(l,i,j) in PMs.ref(pm, nw, :arcs_trans)],
173-
basename="$(nw)_$(cnd)_q_trans",
173+
base_name="$(nw)_$(cnd)_q_trans",
174174
start=0
175175
)
176176
if bounded
177177
for arc in PMs.ref(pm, nw, :arcs_trans)
178178
tr_id = arc[1]
179179
flow_lb = -PMs.ref(pm, nw, :trans, tr_id, "rate_a")[cnd]
180180
flow_ub = PMs.ref(pm, nw, :trans, tr_id, "rate_a")[cnd]
181-
JuMP.setlowerbound(PMs.var(pm, nw, cnd, :qt, arc), flow_lb)
182-
JuMP.setupperbound(PMs.var(pm, nw, cnd, :qt, arc), flow_ub)
181+
JuMP.set_lower_bound(PMs.var(pm, nw, cnd, :qt, arc), flow_lb)
182+
JuMP.set_upper_bound(PMs.var(pm, nw, cnd, :qt, arc), flow_ub)
183183
end
184184
end
185185
end
@@ -193,13 +193,13 @@ function variable_tp_oltc_tap(pm::PMs.GenericPowerModel; nw::Int=pm.cnw, bounded
193193
for c in 1:nphases
194194
PMs.var(pm, nw, c)[:tap] = JuMP.@variable(pm.model,
195195
[i in oltc_ids],
196-
basename="$(nw)_tm",
196+
base_name="$(nw)_tm",
197197
start=PMs.ref(pm, nw, :trans, i, "tm")[c]
198198
)
199199
if bounded
200200
for tr_id in oltc_ids
201-
JuMP.setlowerbound(PMs.var(pm, nw, c)[:tap][tr_id], PMs.ref(pm, nw, :trans, tr_id, "tm_min")[c])
202-
JuMP.setupperbound(PMs.var(pm, nw, c)[:tap][tr_id], PMs.ref(pm, nw, :trans, tr_id, "tm_max")[c])
201+
JuMP.set_lower_bound(PMs.var(pm, nw, c)[:tap][tr_id], PMs.ref(pm, nw, :trans, tr_id, "tm_min")[c])
202+
JuMP.set_upper_bound(PMs.var(pm, nw, c)[:tap][tr_id], PMs.ref(pm, nw, :trans, tr_id, "tm_max")[c])
203203
end
204204
end
205205
end

src/form/acr.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function variable_tp_voltage(pm::PMs.GenericPowerModel{T}; kwargs...) where T <:
1919
vr = vm*cos(theta[c])
2020
vi = vm*sin(theta[c])
2121
for id in PMs.ids(pm, :bus)
22-
JuMP.setvalue(PMs.var(pm, pm.cnw, c, :vr, id), vr)
23-
JuMP.setvalue(PMs.var(pm, pm.cnw, c, :vi, id), vi)
22+
JuMP.set_start_value(PMs.var(pm, pm.cnw, c, :vr, id), vr)
23+
JuMP.set_start_value(PMs.var(pm, pm.cnw, c, :vi, id), vi)
2424
end
2525
end
2626
end

0 commit comments

Comments
 (0)