meelgroup / cmsgen

CMSGen, a fast weighted uniform-like sampler
Other
9 stars 3 forks source link

random seed? #5

Closed algebravic closed 11 months ago

algebravic commented 11 months ago

Is there an inteface to set the random seed used by cmsgen and pycmsgen? I can't seem to find it. I noticed that when I asked pycmsgen to sample from a particular SAT file, that it always gives the same samples, which would indicate that it's using a fixed seed.

msoos commented 11 months ago

Ah, good point. The pycmsgen is missing the seed option. I'm adding that now.

For the binary, see --help:

./cmsgen --help
A sampler that tries to output uniform samples
Input can be either plain or gzipped DIMACS with XOR extension

USAGE: ./cmsgen --samples [NUM]  -s [SEED] --samplefile [OUTFILE] [CNFFILE]

Main options:
  -h [ --help ]                    Print simple help
  -v [ --version ]                 Print version info
  --verb arg (=0)                  [0-10] Verbosity
  -s [ --seed ] arg (=0)           [0..] Random seed
  --samples arg (=100)             Number of samples needed
  --fixedconfl arg (=100)          In case fixed restart strategy is used, how 
                                   many conflicts should elapse between 
                                   restarts
  --samplefile arg (=samples.out)  Write sample(s) to this file
msoos commented 11 months ago

Hi,

First of all, thanks for reporting! I have just pushed a new version, 6.0.6, that will get built in pypi in about 15 minutes. That version has seed as a parameter to Solver in the pip package. That should solve your issue. I am now closing this issue. Please let me know if it worked. If it didn't please feel free to comment and then I'll reopen and we'll fix this together.

Thanks again for reporting,

Mate