You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plasmo seems to only support quadratic objectives when the two terms of the quadratic objectives are on the same node. If a quadratic term is added to the objective function which has variables on separate nodes, the line here returns an error. The example below returns the error:
using Plasmo, JuMP, Ipopt
graph = OptiGraph()
set_optimizer(graph, Ipopt.Optimizer)
@optinode(graph, nodes[1:4])
for (i, node) in enumerate(nodes)
@variable(node, x >= i)
@objective(node, Min, 2 * x^2)
end
optimize!(graph)
obj_func = objective_function(graph)
new_term = UnorderedPair(nodes[1][:x], nodes[2][:x])
obj_func.terms[new_term] = 3.0
optimize!(graph)
On the modeling side, this can be avoided by placing dummy variables on each node and then adding a linking constraint between the dummy variable and the variable it represents, but it could be nice to someday support quadratic objectives on different nodes.
The text was updated successfully, but these errors were encountered:
This should work now in v0.6. The following example demonstrates what you should be able to do:
using Plasmo, JuMP, Ipopt
graph =OptiGraph()
set_optimizer(graph, Ipopt.Optimizer)
@optinode(graph, nodes[1:4])
for (i, node) inenumerate(nodes)
@variable(node, x >= i)
@objective(node, Min, 2* x^2)
end
node_objectives =sum([objective_function(node) for node in nodes])
# set quadratic over multiple nodes@objective(graph, Min, node_objectives + nodes[1][:x]^2*nodes[2][:x]^2)
optimize!(graph)
Plasmo seems to only support quadratic objectives when the two terms of the quadratic objectives are on the same node. If a quadratic term is added to the objective function which has variables on separate nodes, the line here returns an error. The example below returns the error:
On the modeling side, this can be avoided by placing dummy variables on each node and then adding a linking constraint between the dummy variable and the variable it represents, but it could be nice to someday support quadratic objectives on different nodes.
The text was updated successfully, but these errors were encountered: