Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  setting threads in python api falied

    Posted 10/27/19 10:32 PM

    Originally posted by: Xiaopihai


    Hi folks,

     

    I'm trying to let cplex only use one thread using python API.

    Here's the code 

                    cplex_model = cplex.Cplex("file.lp")
                    cplex_model.parameters.threads = 1
                    cplex_model.solve()
    
    

    But it seems that cplex is still using all the 24 threads that I have on my server when I check the process using htop.

    Does anyone know if i'm doing it correctly?

    Thanks!


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: setting threads in python api falied

    Posted 10/28/19 04:19 PM

    To set the threads parameter you must use the following syntax:

     

    cplex_model.parameters.threads.set(1)
    

     

    To verify that it is working correctly, the engine log should contain lines like the following:

    CPXPARAM_Threads                                 1
    ...
    Parallel mode: none, using 1 thread.
    ...
    

     

     


    #CPLEXOptimizers
    #DecisionOptimization