|
65 | 65 |
|
66 | 66 | function MOI.initialize(evaluator::Evaluator, features::Vector{Symbol}) |
67 | 67 | empty!(evaluator.ordered_constraints) |
68 | | - empty!(evaluator.julia_expressions) |
69 | 68 | evaluator.eval_objective_timer = 0.0 |
70 | 69 | evaluator.eval_objective_gradient_timer = 0.0 |
71 | 70 | evaluator.eval_constraint_timer = 0.0 |
72 | 71 | evaluator.eval_constraint_jacobian_timer = 0.0 |
73 | 72 | evaluator.eval_hessian_lagrangian_timer = 0.0 |
74 | 73 | append!(evaluator.ordered_constraints, keys(evaluator.model.constraints)) |
75 | | - if :ExprGraph in features |
76 | | - for i in 1:length(evaluator.model.expressions) |
77 | | - push!( |
78 | | - evaluator.julia_expressions, |
79 | | - convert_to_expr( |
80 | | - evaluator, |
81 | | - evaluator.model.expressions[i]; |
82 | | - moi_output_format = true, |
83 | | - ), |
84 | | - ) |
85 | | - end |
86 | | - filter!(f -> f != :ExprGraph, features) |
87 | | - end |
| 74 | + filter!(f -> f != :ExprGraph, features) |
88 | 75 | if evaluator.backend !== nothing |
89 | 76 | MOI.initialize(evaluator.backend, features) |
90 | 77 | end |
@@ -270,7 +257,11 @@ function _convert_to_moi_format(evaluator::Evaluator, p::ParameterIndex) |
270 | 257 | end |
271 | 258 |
|
272 | 259 | function _convert_to_moi_format(evaluator::Evaluator, x::ExpressionIndex) |
273 | | - return evaluator.julia_expressions[x.value] |
| 260 | + return convert_to_expr( |
| 261 | + evaluator, |
| 262 | + evaluator.model.expressions[x.value]; |
| 263 | + moi_output_format = true, |
| 264 | + ) |
274 | 265 | end |
275 | 266 |
|
276 | 267 | _convert_to_moi_format(::Evaluator, x) = x |
|
0 commit comments