diff --git a/src/LibSCIP.jl b/src/LibSCIP.jl index 4ae423ae..37fe1a6f 100644 --- a/src/LibSCIP.jl +++ b/src/LibSCIP.jl @@ -1,3 +1,8 @@ +# Copyright (c) 2018 Felipe Serrano, Miles Lubin, Robert Schwarz, and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + module LibSCIP using ..SCIP: libscip diff --git a/src/event_handler.jl b/src/event_handler.jl index 7bbbaaff..29c32d0a 100644 --- a/src/event_handler.jl +++ b/src/event_handler.jl @@ -1,17 +1,22 @@ +# Copyright (c) 2018 Felipe Serrano, Miles Lubin, Robert Schwarz, and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + # Wrapper for implementing event handlers in SCIP. # Before using please familiaze yourself with https://scipopt.org/doc/html/EVENT.php -# +# # The basic idea here is the same as with the separator wrappers. First, you need # to define a structure that implements the abstract type `AbstractEventhdlr`. # Second you should implement the function `eventexec` where the argument is an # instance of your event handler structure. Third, you should at runtime instantiate # the structure and call `include_event_handler` to register the event handler with SCIP. -# +# # See eventhdlr.jl in the test folder for an example. -# +# abstract type AbstractEventhdlr end -""" +""" This is a virtual function that must be implemented by the user. Its Only argument is the event handler object. """ @@ -82,8 +87,8 @@ end """ include_event_handler(scipd::SCIP.SCIPData, event_handler::EVENTHDLR; name="", desc="") -Include the event handler in SCIP. WARNING! In contrast to the separator wrapper you only need to -pass the SCIPData rather than the SCIP pointer and dictionary. +Include the event handler in SCIP. WARNING! In contrast to the separator wrapper you only need to +pass the SCIPData rather than the SCIP pointer and dictionary. # Arguments - scipd::SCIP.SCIPData: The SCIPData object @@ -147,7 +152,7 @@ function catch_event( @SCIP_CALL SCIPcatchEvent(scipd, eventtype, eventhdlrptr, C_NULL, C_NULL) end -""" +""" drop_event(scipd::SCIP.SCIPData, eventtype::SCIP_EVENTTYPE, eventhdlr::EVENTHDLR) Drop an event in SCIP. This function is a wrapper around the SCIPdropEvent function. diff --git a/test/eventhdlr.jl b/test/eventhdlr.jl index 517fbc52..79178eb0 100644 --- a/test/eventhdlr.jl +++ b/test/eventhdlr.jl @@ -1,3 +1,8 @@ +# Copyright (c) 2018 Felipe Serrano, Miles Lubin, Robert Schwarz, and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + # A simple testcase to test the event handler functionality. # It is assumed that test/sepa_support.jl is already included using SCIP @@ -67,7 +72,7 @@ end ) MOI.set(optimizer, MOI.ObjectiveSense(), MOI.MIN_SENSE) - # add eventhandler + # add eventhandler eventhdlr = FirstLPEventTest.FirstLPEvent(inner, 10) SCIP.include_event_handler( inner, @@ -81,7 +86,7 @@ end # solve the problem SCIP.@SCIP_CALL SCIP.SCIPsolve(inner.scip[]) - # test if the event handler worked + # test if the event handler worked @test eventhdlr.firstlpobj != 10.0 # free the problem @@ -121,7 +126,7 @@ end ) MOI.set(optimizer, MOI.ObjectiveSense(), MOI.MIN_SENSE) - # add eventhandler + # add eventhandler eventhdlr = FirstLPEventTest.FirstLPEvent(inner, 10) SCIP.include_event_handler( inner, @@ -135,7 +140,7 @@ end # solve the problem SCIP.@SCIP_CALL SCIP.SCIPsolve(inner.scip[]) - # test if the event handler worked + # test if the event handler worked @test eventhdlr.firstlpobj != 10.0 # free the problem