File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -799,6 +799,29 @@ function test_evaluate_logic()
799
799
return
800
800
end
801
801
802
+ function test_evaluate_subexpressions ()
803
+ data = Nonlinear. NonlinearData ()
804
+ x = MOI. VariableIndex (1 )
805
+ p = Nonlinear. add_parameter (data, 1.23 )
806
+ ex = Nonlinear. add_expression (data, :(* ($ p, $ x, $ x)))
807
+ ex = Nonlinear. add_expression (data, :($ ex + sqrt ($ ex)))
808
+ ex_v = 1.23 * 1.1 * 1.1
809
+ @test Nonlinear. evaluate (Dict (x => 1.1 ), data, ex) ≈ ex_v + sqrt (ex_v)
810
+ data[p] = 3.21
811
+ ex_v = 3.21 * 1.2 * 1.2
812
+ @test Nonlinear. evaluate (Dict (x => 1.2 ), data, ex) ≈ ex_v + sqrt (ex_v)
813
+ return
814
+ end
815
+
816
+ function test_NLPBlockData ()
817
+ data = Nonlinear. NonlinearData ()
818
+ x = MOI. VariableIndex (1 )
819
+ block = MOI. test_NLPBlockData (data, [x])
820
+ @test block. has_objective == false
821
+ @test length (block. constraint_bounds) == 0
822
+ return
823
+ end
824
+
802
825
end
803
826
804
827
TestNonlinear. runtests ()
You can’t perform that action at this time.
0 commit comments