Commit b29f05e
committed
Expose some HiGHS callbacks as .NET events.
Several HiGHS callbacks are each exposed as its own event in the C# HighsLpSolver
class. The event names are as follows:
kCallbackLogging => LogMessageReceived
kCallbackMipLogging => MipStatusReported
kCallbackMipImprovingSolution => MipImprovingSolutionFound
kCallbackMipInterrupt => MipInterruptCheck
kCallbackSimplexInterrupt => SimplexInterruptCheck
kCallbackIpmInterrupt => IpmInterruptCheck
Clients subscribe to and unsubscribe from these events as they would for any other event,
using syntax such as `lp.LogMessageReceived += MyLoggingFunc`. Subscribers don't need
to call Highs_startCallback or Highs_stopCallback. The events are written so that they
automatically call startCallback when the first client subscribes to the event, and
automatically call stopCallback when the last client unsubscribes from the event.
The interrupt check events include a `user_interrupt` flag in their event args. If an event
handler sets this flag, it is passed back to HiGHS via the cbDataIn callback function argument,
which causes the event's algorithm to stop.1 parent 72eceb6 commit b29f05e
1 file changed
+362
-0
lines changed
0 commit comments