Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::sat::ModelRandomGenerator Class Reference

Detailed Description

The model "singleton" random engine used in the solver.

In test, we usually set use_absl_random() so that the sequence is changed at each invocation. This way, clients do not really on the wrong assumption that a particular optimal solution will be returned if they are many equivalent ones.

Definition at line 318 of file util.h.

#include <util.h>

Inheritance diagram for operations_research::sat::ModelRandomGenerator:

Public Member Functions

 ModelRandomGenerator (const SatParameters &params)
 ModelRandomGenerator (const absl::BitGenRef &bit_gen_ref)
 ModelRandomGenerator (Model *model)
void LogSalt () const

Constructor & Destructor Documentation

◆ ModelRandomGenerator() [1/3]

operations_research::sat::ModelRandomGenerator::ModelRandomGenerator ( const SatParameters & params)
inlineexplicit

We seed the strategy at creation only. This should be enough for our use case since the SatParameters is set first before the solver is created. We also never really need to change the seed afterwards, it is just used to diversify solves with identical parameters on different Model objects.

Definition at line 324 of file util.h.

◆ ModelRandomGenerator() [2/3]

operations_research::sat::ModelRandomGenerator::ModelRandomGenerator ( const absl::BitGenRef & bit_gen_ref)
inlineexplicit

Definition at line 333 of file util.h.

◆ ModelRandomGenerator() [3/3]

operations_research::sat::ModelRandomGenerator::ModelRandomGenerator ( Model * model)
inlineexplicit

Definition at line 338 of file util.h.

Member Function Documentation

◆ LogSalt()

void operations_research::sat::ModelRandomGenerator::LogSalt ( ) const
inline

This is just used to display ABSL_RANDOM_SALT_OVERRIDE in the log so that it is possible to reproduce a failure more easily while looking at a solver log.

Todo
(user): I didn't find a cleaner way to log this.

Definition at line 346 of file util.h.


The documentation for this class was generated from the following file: