File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1753,6 +1753,30 @@ function cost(sys::AbstractSystem)
17531753 return consolidate (cs, subcosts)
17541754end
17551755
1756+ namespace_constraint (eq:: Equation , sys) = namespace_equation (eq, sys)
1757+
1758+ namespace_constraint (ineq:: Inequality , sys) = namespace_inequality (ineq, sys)
1759+
1760+ function namespace_inequality (ineq:: Inequality , sys, n = nameof (sys))
1761+ _lhs = namespace_expr (ineq. lhs, sys, n)
1762+ _rhs = namespace_expr (ineq. rhs, sys, n)
1763+ Inequality (_lhs,
1764+ _rhs,
1765+ ineq. relational_op)
1766+ end
1767+
1768+ function namespace_constraints (sys)
1769+ cstrs = constraints (sys)
1770+ isempty (cstrs) && return Vector {Union{Equation, Inequality}} (undef, 0 )
1771+ map (cstr -> namespace_constraint (cstr, sys), cstrs)
1772+ end
1773+
1774+ function constraints (sys)
1775+ cs = get_constraints (sys)
1776+ systems = get_systems (sys)
1777+ isempty (systems) ? cs : [cs; reduce (vcat, namespace_constraints .(systems))]
1778+ end
1779+
17561780"""
17571781$(TYPEDSIGNATURES)
17581782
You can’t perform that action at this time.
0 commit comments