Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Multiple Generic Callbacks

    Posted 10/13/19 06:54 AM

    Originally posted by: VKV7_Anulark_Naber


    I am implementing generic callbacks for Benders cuts and would like to separate cuts under both different contexts: CANDIDATE and RELAXATION in two generic callbacks. Is it possible for cplex to have more than one generic callback? The reason is I am trying to avoid using too many if statements (also from other parameters) in callbacks, so I thought of a dedicated callback under each context. If possible, I would also expand it to local and global progress.

    If it is possible, how can I implement it? Are there any cautions I should be aware of?

    Specifically, if it's possible under multiple threads, do I need to use different threadups and threaddowns for each callback or can I activate the same thread for both candidate and relaxation callbacks? The latter is preferred, for both subproblems are the same under the candidate or relaxation context.

    Thanks in advance.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Multiple Generic Callbacks

    Posted 10/13/19 10:22 AM

    No, multiple generic callbacks are not possible. The documentation of the use() method in the Java API specifically states that at most one callback can be registered. That said, there is nothing stopping you from putting what would have been your multiple callbacks in separate functions, and then just having one registered callback that acts as a dispatcher. The registered callback would just have to look at the context in a switch statement (or a sequence of if statements, if you are using a language that does not have a switch statement) and pass its arguments to the correct function.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Multiple Generic Callbacks

    Posted 10/14/19 02:21 AM

    To expand on Paul's answer: By design, there can be only one generic callback and when using multiple contexts then you are indeed supposed to dispatch the different contexts yourself using either 'if' or 'switch' statements.

     

    I don't understand your question about THREAD_UP and THREAD_DOWN. These two are unrelated to the other contexts. THREAD_UP is invoked when CPLEX activates a new thread. It is invoked on the thread that is just about to be activated. So you can for example initialize thread-local data for this thread and then you can use this thread-local data in all the other contexts (until you get a THREAD_DOWN on this particular thread).


    #CPLEXOptimizers
    #DecisionOptimization