Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Parallel threads in OPL

  • 1.  Parallel threads in OPL

    Posted Wed August 31, 2011 01:24 PM

    Originally posted by: Nicolas33


    Hello,

    I implemented a column generation script in OPL to solve the
    Dantzig Wolfe decomposition of my problem.

    My subproblem is separable, and so I have to compute independant subproblems.
    Presently, my implementation is not parallel, subproblems are computed serially.

    It is possible to compute several independant subproblems in the same time on different threads with OPL, under a main block?
    Thanks for your help,

    Nicolas
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Parallel threads in OPL

    Posted Fri September 02, 2011 06:44 AM
    Hi,

    this is possible and you can find an example in opl\examples\opl_interfaces\java\ConcurrentProcessing
    You cannot do that in a main block in OPL but you can thru OPL APIs

    Regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Parallel threads in OPL

    Posted Tue September 08, 2015 11:24 PM

    Originally posted by: Helia


    Hi

    I have the same question, but unfortunately I am new to object oriented programming and can't use the Java code referred by you. I want to know if the following is a feasible alternative:

    1- Copy the OPL project

    2-Open more than one OPL interface with different workspace names

    3- Run the copy of the same OPL model with different data files on each OPL

     

    I have tested once, it worked for a while then one of the OPL interfaces just stopped. Any idea?

     

    Thank you 

    Helia


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Parallel threads in OPL

    Posted Wed September 09, 2015 05:33 AM

    Hi,

    if you do not like object oriented programming, you could use calls from python as in

    https://www.ibm.com/developerworks/community/forums/html/topic?id=0b6cacbe-4dda-4da9-9282-f527c3464f47&ps=25

    You can also use windows shell for that.

    Let me give you an example.

    Suppose you want to run in parallel the examples in

    opl\examples\opl\warehouse

    You can create a file call.bat

    start oplrun scalableWarehouse.mod
    start oplrun warehouse.mod warehouse.dat
    start oplrun solpoolscript.mod

    and then if in command line you do call.bat, the 3 examples will run in parallel

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Parallel threads in OPL

    Posted Wed September 09, 2015 07:57 AM

    Originally posted by: Helia


    Hi

    Thanks for your reply. It s not that I do not like object oriented programming, I m just new to it :)

    following your suggestion, I have created a batch file but it is not working well. Probably because I do not know how to specify which configurations I want to run in parallel. The problems that I want to solve have only one model but multiple data file. So how can I indicate in the batch file that exactly which combination of model and data and setting file I want to run?

    Thanks a lot for your insights

    Best,

    Helia


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Parallel threads in OPL

    Posted Wed September 09, 2015 09:57 AM

    Hi,

    so on the .bat you should not use

    oplrun [options] model-file [data-file ...]

    as I did but
    oplrun [options] -p project-dir [run-configuration ...]

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Parallel threads in OPL

    Posted Thu September 10, 2015 03:26 AM

    Hi,

    so to go on with my .bat example in folder warehouse,

    you could have in the .bat

    start oplrun scalableWarehouse.mod
    start oplrun warehouse.mod warehouse.dat
    start oplrun solpoolscript.mod
    start oplrun -p ../warehouse "Scalable data"

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: Parallel threads in OPL

    Posted Mon March 06, 2017 03:04 AM

    Originally posted by: AMM1


    hi alex,

    actually i didnt get it .

    Where to write these commands in the execute? i am using cp to solve vrpmtw,

    should i write the configuration name or the my file .mod name?

    also should i keep all the 48 .dat files in the project folder?


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 9.  Re: Parallel threads in OPL

    Posted Mon March 06, 2017 03:09 AM


  • 10.  Re: Parallel threads in OPL

    Posted Mon March 06, 2017 04:23 AM

    Originally posted by: AMM1


    Thank you for your reply

    i tried to create batch

    i have only one .mod and 2 data files for example

    this didn't work , can you help me please

    (i created the .bat from the notepad)

    start oplrun vrp example.mod 
    start oplrun data for rm 101.dat

    start oplrun data for rm 102.dat
    Start oplrun -p ../vrp example"Configuration2"


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 11.  Re: Parallel threads in OPL

    Posted Mon March 06, 2017 11:53 AM

    Hi,

    do you use windows ?

    What happens if you do

    oplrun vrp example.mod 

    in the command line ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 12.  Re: Parallel threads in OPL

    Posted Mon March 06, 2017 04:34 PM

    Originally posted by: AMM1


    Hi,

    i got:

    File "vrp" is not found.

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 13.  Re: Parallel threads in OPL

    Posted Mon March 06, 2017 04:44 PM

    If the name of you .mod is mod.mod and the name of your .dat is dat.dat then

    oplrun mod.mod dat.dat

    will make oplrun use your mod.mod and dat.dat

    see https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.7.0/ilog.odms.ide.help/OPL_Studio/refoplrun/topics/oplrun_TOP.html

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 14.  Re: Parallel threads in OPL



  • 15.  Re: Parallel threads in OPL

    Posted Fri September 02, 2011 07:38 AM

    Originally posted by: Nicolas33


    Thank you very much, it is very useful for me.
    Best regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer