Plasmo.jl - Platform for Scalable Modeling and Optimization
Plasmo.jl is a modeling and optimization interface for constructing and solving optimization problems that exploits a graph-aware structure. The package provides modular model building for optimization problems and graph analysis capabilities that the enable the use of decomposition-based solvers.
Installation
Plasmo.jl is a Julia package developed for Julia 1.0. From Julia, Plasmo is installed by using the built-in package manager:
import Pkg
Pkg.clone("https://github.com/jalving/Plasmo.jl")or alternatively from the Julia 1.0 package manager, just do
] add https://github.com/jalving/Plasmo.jlPlasmo.jl uses JuMP as modeling interface which can be installed with
import Pkg
Pkg.add("JuMP")or using the Julia package manager
] add JuMPExample Script
Plasmo.jl uses JuMP to create component models in a ModelGraph, a graph wherein the nodes are component models. JuMP models are associated with nodes and can have their variables linked to other node variables using LinkConstraints. The below script demonstrates solving a nonlinear optimization problem containing two nodes with a simple link constraint and solving with Ipopt.
using JuMP
using Plasmo
using Ipopt
graph = ModelGraph()
setsolver(graph,IpoptSolver())
#Add nodes to a ModelGraph
n1 = add_node!(graph)
n2 = add_node!(graph)
#Create JuMP models
m1 = Model()
@variable(m1,0 <= x <= 2)
@variable(m1,0 <= y <= 3)
@constraint(m1,x+y <= 4)
@objective(m1,Min,x)
m2 = Model()
@variable(m2,x)
@NLconstraint(m2,exp(x) >= 2)
#Set JuMP models on nodes
setmodel(n1,m1) #set m1 to n1
setmodel(n2,m2)
#Link constraints take the same expressions as the JuMP @constraint macro
@linkconstraint(graph,n1[:x] == n2[:x])
#Get all of the link constraints in a model-graph
links = getlinkconstraints(graph)
solve(graph)
#Look at individual node solutions
println("n1[:x]= ",JuMP.getvalue(n1[:x]))
println("n2[:x]= ",JuMP.getvalue(n2[:x]))Contents
Index
Plasmo.PlasmoGraphBase.BasePlasmoGraphPlasmo.PlasmoModelGraph.ModelGraphPlasmo.PlasmoModelGraph.ModelNodeBase.getindexBase.getindexJuMP.getobjectivevalueJuMP.setsolverJuMP.setsolverLightGraphs.label_propagationMetis.partitionPlasmo.PlasmoGraphBase.add_node!Plasmo.PlasmoGraphBase.getnodePlasmo.PlasmoGraphBase.getnodePlasmo.PlasmoModelGraph.addlinkconstraintPlasmo.PlasmoModelGraph.get_all_linkconstraintsPlasmo.PlasmoModelGraph.gethyperlinkconstraintsPlasmo.PlasmoModelGraph.getinternaljumpmodelPlasmo.PlasmoModelGraph.getlinkconstraintsPlasmo.PlasmoModelGraph.getlinkconstraintsPlasmo.PlasmoModelGraph.getlinkconstraintsPlasmo.PlasmoModelGraph.getsimplelinkconstraintsPlasmo.PlasmoModelGraph.getsolverPlasmo.PlasmoModelGraph.is_nodevarPlasmo.PlasmoModelGraph.setmodel