Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Control display and threads in c++ without ilocplex

    Posted 9 days ago

    Hi


    I use OsiCpxSolverInterfrace to define my lp/Mip and i try to control the display and the number of threads.

    I get back a pointer on  the env and   with the CPXsetintparam i try to control the behavior:

    CPXENVptr  cpxEnvPtr = dynamic_cast<OsiCpxSolverInterface*>(solver)->getEnvironmentPtr();
    CPXsetintparam(cpxEnvPtr,CPX_PARAM_THREADS,1); // one thread
    CPXsetintparam(cpxEnvPtr,CPX_PARAM_SCRIND,0); // suppress display

    But the output is still on the screen and the number of threads  is perhaps not set.
    Has someone a way to do this (and tell me why the preceding lines have no effect).
    Regards




    ------------------------------
    xavier warin
    ------------------------------


  • 2.  RE: Control display and threads in c++ without ilocplex

    Posted 6 days ago
    • Please try to force the environment to be created before grabbing it.

      auto* cpxSolver = dynamic_cast<OsiCpxSolverInterface*>(solver);

      // Force environment creation (read LP, or set up an empty model)
      cpxSolver->getNumCols(); // This forces CPLEX to init

    • Now get the pointer
      CPXENVptr env = cpxSolver->getEnvironmentPtr();
    • Set parameters AFTER initialization
      CPXsetintparam(env, CPX_PARAM_THREADS, 1);
      CPXsetintparam(env, CPX_PARAM_SCRIND, CPX_OFF);


    ------------------------------
    Ashlin Chatholil
    ------------------------------



  • 3.  RE: Control display and threads in c++ without ilocplex

    Posted 6 days ago
    • Please try to force environment creation (read LP, or set up an empty model)
      cpxSolver->getNumCols(); // This forces CPLEX to init

    • Now get the pointer
      CPXENVptr env = cpxSolver->getEnvironmentPtr();

    • Set parameters AFTER initialization
      CPXsetintparam(env, CPX_PARAM_THREADS, 1);
      CPXsetintparam(env, CPX_PARAM_SCRIND, CPX_OFF);


    ------------------------------
    Ashlin Chatholil
    ------------------------------