File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ struct _SubexpressionStorage
4242 end
4343end
4444
45+ function MOI. Nonlinear. expression (expr:: _SubexpressionStorage )
46+ return MOI. Nonlinear. Expression (
47+ expr. nodes,
48+ expr. const_values,
49+ )
50+ end
51+
52+ MOI. Nonlinear. adjacency_matrix (expr:: _SubexpressionStorage ) = expr. adj
53+
4554struct _FunctionStorage
4655 nodes:: Vector{Nonlinear.Node}
4756 adj:: SparseArrays.SparseMatrixCSC{Bool,Int}
@@ -136,6 +145,15 @@ struct _FunctionStorage
136145 end
137146end
138147
148+ function MOI. Nonlinear. expression (expr:: _FunctionStorage )
149+ return MOI. Nonlinear. Expression (
150+ expr. nodes,
151+ expr. const_values,
152+ )
153+ end
154+
155+ MOI. Nonlinear. adjacency_matrix (expr:: _FunctionStorage ) = expr. adj
156+
139157"""
140158 NLPEvaluator(
141159 model::Nonlinear.Model,
Original file line number Diff line number Diff line change 7676struct Expression
7777 nodes:: Vector{Node}
7878 values:: Vector{Float64}
79- Expression () = new (Node[], Float64[])
8079end
8180
81+ Expression () = Expression (Node[], Float64[])
82+
8283function Base.:(== )(x:: Expression , y:: Expression )
8384 return x. nodes == y. nodes && x. values == y. values
8485end
@@ -107,6 +108,8 @@ struct Constraint
107108 }
108109end
109110
111+ expression (c:: Constraint ) = c. expression
112+
110113"""
111114 ParameterIndex
112115
You can’t perform that action at this time.
0 commit comments