Skip to content

Commit 48736cb

Browse files
committed
Fixes for ReverseAD tests
1 parent 4ee13a8 commit 48736cb

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

src/graph_tools.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ function _get_nonlinear_child_interactions(
258258
)::Vector{Tuple{Int,Int}}
259259
if node.type == NODE_CALL_UNIVARIATE
260260
@assert num_children == 1
261-
op = get(DEFAULT_UNIVARIATE_OPERATORS, node.index, nothing)
261+
op = get(Nonlinear.DEFAULT_UNIVARIATE_OPERATORS, node.index, nothing)
262262
# Univariate operators :+ and :- don't create interactions
263263
if op in (:+, :-)
264264
return Tuple{Int,Int}[]
@@ -333,7 +333,7 @@ function _compute_hessian_sparsity(
333333
# Map from child_group_index to variable indices
334334
child_group_variables = Dict{Int,Set{Int}}()
335335
for (k, node) in enumerate(nodes)
336-
@assert node.type != Nonlinear.NODE_MOI_VARIABLE
336+
@assert node.type != NODE_MOI_VARIABLE
337337
if input_linearity[k] == CONSTANT
338338
continue # No hessian contribution from constant nodes
339339
end
@@ -353,23 +353,23 @@ function _compute_hessian_sparsity(
353353
while length(stack) > 0
354354
r, child_group_idx = pop!(stack)
355355
# Don't traverse into logical conditions or comparisons
356-
if nodes[r].type == Nonlinear.NODE_LOGIC ||
357-
nodes[r].type == Nonlinear.NODE_COMPARISON
356+
if nodes[r].type == NODE_LOGIC ||
357+
nodes[r].type == NODE_COMPARISON
358358
continue
359359
end
360360
r_children_idx = SparseArrays.nzrange(adj, r)
361361
for cidx in r_children_idx
362362
push!(stack, (children_arr[cidx], child_group_idx))
363363
end
364-
if nodes[r].type == Nonlinear.NODE_VARIABLE
364+
if nodes[r].type == NODE_VARIABLE
365365
if !haskey(child_group_variables, child_group_idx)
366366
child_group_variables[child_group_idx] = Set{Int}()
367367
end
368368
push!(
369369
child_group_variables[child_group_idx],
370370
nodes[r].index,
371371
)
372-
elseif nodes[r].type == Nonlinear.NODE_SUBEXPRESSION
372+
elseif nodes[r].type == NODE_SUBEXPRESSION
373373
sub_vars = subexpression_variables[nodes[r].index]
374374
if !haskey(child_group_variables, child_group_idx)
375375
child_group_variables[child_group_idx] = Set{Int}()
@@ -378,7 +378,7 @@ function _compute_hessian_sparsity(
378378
end
379379
end
380380
_add_hessian_edges!(edge_list, interactions, child_group_variables)
381-
elseif node.type == Nonlinear.NODE_SUBEXPRESSION
381+
elseif node.type == NODE_SUBEXPRESSION
382382
for ij in subexpression_edgelist[node.index]
383383
push!(edge_list, ij)
384384
end

src/parse.jl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,6 @@ function parse_expression(
119119
return
120120
end
121121

122-
function parse_expression(
123-
::Model,
124-
expr::Expression,
125-
x::MOI.VariableIndex,
126-
parent_index::Int,
127-
broadcasted::Bool = false,
128-
)
129-
push!(
130-
expr.nodes,
131-
Node(NODE_MOI_VARIABLE, x.value, parent_index, broadcasted),
132-
)
133-
return
134-
end
135-
136122
function _parse_univariate_expression(
137123
stack::Vector{Tuple{Int,Any}},
138124
data::Model,

0 commit comments

Comments
 (0)