Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  [JAVA] Stoping a computation safely?

    Posted 11/15/11 01:15 PM

    Originally posted by: arthuro


    Hello,
    is there a command that can stop CPLEX during a computation?
    I have a GUI which uses a SwingWorker to start my CPLEX model (to do it in the background, so that the GUI stays responsive). When I cancel the worker, CPLEX keeps working in the background. If I would use something like cplexModel.end(), I'd get a fatal error.

    Any ideas?
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: [JAVA] Stoping a computation safely?

    Posted 11/15/11 02:23 PM

    Originally posted by: SystemAdmin


    Stopping the optimization process gracefully (such that the solutions obtained till that point are preserved) will require you to implement callbacks or use the IloCplex.Aborter class. I would recommend you to go through the MIPex4.java example which comes with the distribution that shows one such implementation. The sample simply makes the 'myAborter.abort();' call, but in your case you will need to pass the Aborter object to the GUI thread which can call the abort() function based on certain inputs from the user.

    I hope this helps and provides you a way forward.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: [JAVA] Stoping a computation safely?

    Posted 11/15/11 06:36 PM

    Originally posted by: EdKlotz


    > arthuro wrote:
    > Hello,
    > is there a command that can stop CPLEX during a computation?
    > I have a GUI which uses a SwingWorker to start my CPLEX model (to do it in the background, so that the GUI stays responsive). When I cancel the worker, CPLEX keeps working in the background. If I would use something like cplexModel.end(), I'd get a fatal error.
    >
    > Any ideas?

    The fundamental mechanism CPLEX provides to stop the optimization involves the CPXterminate
    function in the C API and IloCplex.Aborter class in Java (and similar for C++). You can use
    this either from within a CPLEX callback, or, if using multiple threads, in threads that are
    separate from the CPLEX solving process.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: [JAVA] Stoping a computation safely?

    Posted 11/16/11 08:20 AM

    Originally posted by: arthuro


    Thank you very much, Abort() is working like a charm.
    #CPLEXOptimizers
    #DecisionOptimization