Skip to content

Commit e882d8f

Browse files
authored
linting and compat updates (#148)
1 parent 9a5c8be commit e882d8f

31 files changed

+715
-455
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Plasmo"
22
uuid = "d3f7391f-f14a-50cc-bbe4-76a32d1bad3c"
3-
version = "0.7.0"
3+
version = "0.7.1"
44
authors = ["Jordan Jalving <[email protected]>"]
55
repo = "https://github.com/plasmo-dev/Plasmo.jl.git"
66

@@ -24,12 +24,12 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
2424
DataStructures = "0.18, 0.19"
2525
DistributedArrays = "0.6"
2626
GraphOptInterface = "0.1"
27-
Graphs = "1"
27+
Graphs = "1.8"
2828
JuMP = "1.2"
2929
MathOptInterface = "1.6"
3030
Reexport = "1"
3131
Requires = "1"
32-
julia = "1"
32+
julia = "1.6"
3333

3434
[extras]
3535
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ makedocs(;
2727
"API Documentation" => "documentation/api_docs.md",
2828
"Distributed Memory" => [
2929
"Introduction" => "documentation/distributed.md",
30-
"Quickstart" => "documentation/distributed_quickstart.md"
30+
"Quickstart" => "documentation/distributed_quickstart.md",
3131
],
3232
"Tutorials" => [
3333
"Supply Chain Optimization" => "tutorials/supply_chain.md",
3434
"Multi-Horizon Model Predictive Control" => "tutorials/MHMPC.md",
3535
"Optimal Control of a Quadcopter" => "tutorials/quadcopter.md",
3636
"Hierarchical HVAC Optimization" => "tutorials/HVAC.md",
37-
"Optimal Control of a Natural Gas Network" => "tutorials/gas_pipeline.md"
37+
"Optimal Control of a Natural Gas Network" => "tutorials/gas_pipeline.md",
3838
],
3939
],
4040
)

examples/01_create_optigraph.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Plasmo
22
using Ipopt
33

4-
graph = OptiGraph(;name=:graph)
4+
graph = OptiGraph(; name=:graph)
55

66
# add nodes to a OptiGraph
77
n1 = add_node(graph)
@@ -55,4 +55,4 @@ for constraint_type in list_of_constraint_types(graph)
5555
for con in cons
5656
println("($con) = $(dual(con))")
5757
end
58-
end
58+
end

examples/02_create_nested_optigraph.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Plasmo
22
using Ipopt
33

44
function add_model(graph::OptiGraph)
5-
node = add_node(graph)
5+
node = add_node(graph)
66
@variable(node, x >= 0)
77
@variable(node, y >= 1)
88
@constraint(node, x + y <= 5)
@@ -11,16 +11,16 @@ function add_model(graph::OptiGraph)
1111
end
1212

1313
# the top-level graph
14-
graph = OptiGraph(;name=:my_graph)
14+
graph = OptiGraph(; name=:my_graph)
1515

1616
# subgraph 1
17-
subgraph1 = OptiGraph(;name=:sg1)
17+
subgraph1 = OptiGraph(; name=:sg1)
1818
n1 = add_model(subgraph1)
1919
n2 = add_model(subgraph1)
2020
@linkconstraint(subgraph1, n1[:x] == n2[:x])
2121

2222
# subgraph 2
23-
subgraph2 = OptiGraph(;name=:sg2)
23+
subgraph2 = OptiGraph(; name=:sg2)
2424
n3 = add_model(subgraph2)
2525
n4 = add_model(subgraph2)
2626
@linkconstraint(subgraph2, n3[:x] == n4[:x])
@@ -44,4 +44,4 @@ println("n2[:x]= ", value(graph, n2[:x]))
4444
println("n3[:x]= ", value(graph, n3[:x]))
4545
println("n4[:x]= ", value(graph, n4[:x]))
4646

47-
println("objective = ", objective_value(graph))
47+
println("objective = ", objective_value(graph))

examples/03_aggregate_optigraph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ optimize!(agg_graph)
3737
# use the reference map to look up values on the aggregate node
3838
println("n1[:x] = ", value(reference_map[n1[:x]]))
3939
println("n2[:x] = ", value(reference_map[n2[:x]]))
40-
println("n1[:z] = ", value(reference_map[n1[:z]]))
40+
println("n1[:z] = ", value(reference_map[n1[:z]]))

examples/04_graph_functions.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using Graphs
33
using HiGHS
44

55
function create_optigraph(name)
6-
graph = OptiGraph(;name=name)
6+
graph = OptiGraph(; name=name)
77
@optinode(graph, nodes[1:3])
88

99
# node 1
@@ -35,7 +35,7 @@ end
3535

3636
### create optigraph
3737

38-
graph = OptiGraph(;name=:graph)
38+
graph = OptiGraph(; name=:graph)
3939

4040
graph1 = create_optigraph(:sg1)
4141
graph2 = create_optigraph(:sg2)
@@ -69,7 +69,7 @@ all_neighbors(projection, n1)
6969

7070
# query the neighbors to `n1` in `graph1`
7171
subproj1 = hyper_projection(graph1)
72-
all_neighbors(subproj1, n1)
72+
all_neighbors(subproj1, n1)
7373

7474
# create an induced subgraph from a given set of nodes
7575
induced_graph = induced_subgraph(projection, [n1, n2, n3])
@@ -85,4 +85,4 @@ optimize!(expanded_graph)
8585

8686
# nodes store solution for each graph
8787
println("value(induced_graph, n1[:x]): ", value(induced_graph, n1[:x]))
88-
println("value(expanded_graph, n1[:x]) ", value(expanded_graph, n1[:x]))
88+
println("value(expanded_graph, n1[:x]) ", value(expanded_graph, n1[:x]))

examples/05_partitioning_optigraphs.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,3 @@ new_graph = assemble_optigraph(partition)
118118
@objective(new_graph, Min, sum(node[:x] for node in nodes))
119119
set_optimizer(new_graph, Ipopt.Optimizer)
120120
optimize!(new_graph)
121-

examples/06_plotting_optigraphs.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Plasmo
2-
using Plots; pyplot()
2+
using Plots;
3+
pyplot()
34
using PlasmoPlots
45

56
graph = OptiGraph()

examples/07_remote_optigraphs.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end
1414
end
1515

1616
# Instantiate optigraph
17-
rg = Plasmo.RemoteOptiGraph(worker=2)
17+
rg = Plasmo.RemoteOptiGraph(; worker=2)
1818

1919
@optinode(rg, n1)
2020
@optinode(rg, n2)
@@ -47,7 +47,7 @@ optimize!(rg)
4747
remote_obj = JuMP.objective_function(rg)
4848

4949
# Define another graph and add nodes
50-
rg2 = Plasmo.RemoteOptiGraph(worker = 2)
50+
rg2 = Plasmo.RemoteOptiGraph(; worker=2)
5151

5252
@optinode(rg2, n3)
5353
@optinode(rg2, n4)
@@ -58,9 +58,9 @@ rg2 = Plasmo.RemoteOptiGraph(worker = 2)
5858

5959
# Add subgraphs to `rg` using two different methods
6060
Plasmo.add_subgraph(rg, rg2)
61-
rg3 = Plasmo.add_subgraph(rg, worker = 2)
61+
rg3 = Plasmo.add_subgraph(rg; worker=2)
6262

6363
@optinode(rg3, n5)
6464
@variable(n5, x5)
6565

66-
@linkconstraint(rg, x + x3 + rg3[:n5][:x5] == 0);
66+
@linkconstraint(rg, x + x3 + rg3[:n5][:x5] == 0);

examples/08_distribute_optigraph.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ add_subgraph(g, g3)
5959
@linkconstraint(g, lc2, g1[:n1][:y] + g3[:n2][:x] >= -2)
6060
@linkconstraint(g, lc3, g2[:n2][:y] - g3[:n1][:x] == 0)
6161

62-
workers = [2,2,2]
62+
workers = [2, 2, 2]
6363

6464
rg = Plasmo.distribute_graph(g, workers)
65-

0 commit comments

Comments
 (0)