@@ -928,6 +928,34 @@ function test_callback_interrupt()
928
928
return
929
929
end
930
930
931
+ function test_callback_non_interrupt ()
932
+ model = HiGHS. Optimizer ()
933
+ MOI. set (model, MOI. RawOptimizerAttribute (" presolve" ), " off" )
934
+ x = MOI. add_variables (model, 3 )
935
+ MOI. add_constraint .(model, x, MOI. Integer ())
936
+ c = MOI. add_constraint .(model, 1.0 .* x, MOI. EqualTo .(1.0 : 3.0 ))
937
+ MOI. set (model, MOI. ObjectiveSense (), MOI. MAX_SENSE)
938
+ f = 1.0 * x[1 ] + x[2 ] + x[3 ]
939
+ MOI. set (model, MOI. ObjectiveFunction {typeof(f)} (), f)
940
+ callback_types = Cint[]
941
+ function user_callback (
942
+ callback_type:: Cint ,
943
+ :: Ptr{Cchar} ,
944
+ :: HiGHS.HighsCallbackDataOut ,
945
+ ):: Cint
946
+ push! (callback_types, callback_type)
947
+ return 1
948
+ end
949
+ cb = HiGHS. CallbackFunction ([HiGHS. kHighsCallbackMipSolution])
950
+ MOI. set (model, cb, user_callback)
951
+ MOI. optimize! (model)
952
+ @test ! isempty (callback_types)
953
+ @test all (callback_types .== HiGHS. kHighsCallbackMipSolution)
954
+ # The termination is not respected in a non-interrupt callback
955
+ @test MOI. get (model, MOI. TerminationStatus ()) == MOI. OPTIMAL
956
+ return
957
+ end
958
+
931
959
function test_active_bound ()
932
960
for ((l, x, u, d), result) in [
933
961
# Primal exists. Pick closest bound lower
0 commit comments