Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

CPLEX CP: Seed stability when using SearchType="MultiPoint" across different machines

  • 1.  CPLEX CP: Seed stability when using SearchType="MultiPoint" across different machines

    Posted Mon March 22, 2021 11:09 AM
    Hi,

    I have a use-case where seed stability is very important: we run the whole flow with a known seed, and we want to be able to reproduce the flow given the same seed.

    I call CPLEX like this (using the Python docplex.cp interface):

    fail_limit = None
    verbosity = 0
    params = CpoParameters(
    FailLimit=fail_limit,
    RandomSeed=seed,
    SearchType="MultiPoint",
    LogVerbosity="Verbose" if verbosity else "Quiet",
    WarningLevel=verbosity,
    )
    solver = CpoSolver(model, params=params)
    solution = solver.solve()

    Recently we noticed that running the same flow with the same seed can result in different solutions.
    It seems that running on the same machine always gives the same result, but running on different machines gives different results.
    Specifically, when running on a machine with 28 threads we get one solution, and when running on a machine with less threads we get other solutions.

    Is this a know issue? Can we somehow work around it? It's very important to us to have seed stability, even across different machines.

    ------------------------------
    Tomer Vromen
    ------------------------------

    #DecisionOptimization


  • 2.  RE: CPLEX CP: Seed stability when using SearchType="MultiPoint" across different machines

    Posted Mon March 22, 2021 12:03 PM
    Edited by System Admin Fri January 20, 2023 04:22 PM
    Hi,

    Search is deterministic:
    Solving twice the same problem on the same machine (even when using multiple parallel workers) with the same seed for the internal random number generator will produce the same result

    But for this you need to use the same number of workers.
    So what you could do is to run in parallel many several solves with same number of workers. And then yo will ensure determinism.

    regards

    ------------------------------
    [Alex] [Fleischer]
    [EMEA CPLEX Optimization Technical Sales]
    [IBM]
    ------------------------------



  • 3.  RE: CPLEX CP: Seed stability when using SearchType="MultiPoint" across different machines

    Posted Mon March 22, 2021 01:10 PM
    Thank you Alex! Setting the number of workers did the trick

    fail_limit = None
    verbosity = 0
    workers = 8
    params = CpoParameters(
    FailLimit=fail_limit,
    RandomSeed=seed,
    SearchType="MultiPoint",
    Workers=workers,
    LogVerbosity="Verbose" if verbosity else "Quiet",
    WarningLevel=verbosity,
    )
    solver = CpoSolver(model, params=params)
    solution = solver.solve()


    ------------------------------
    Tomer Vromen
    ------------------------------