conjure-cp / conjure

Conjure: The Automated Constraint Modelling Tool
Other
96 stars 24 forks source link

Conjure produce bad answers if same param file is reused #533

Open ChrisJefferson opened 2 years ago

ChrisJefferson commented 2 years ago

I was getting some incorrect answers from conjure, and I think I've figured out why -- I have 3 files in a directory (attached), a.essence, b.essence and c.param. These files aren't interesting a.essence and b.essence are just files which have quite a lot of answers.

If I do:

conjure solve a.essence c.param --solver=lingeling --number-of-solutions=all
(in another window)
conjure solve b.essence c.param --solver=lingeling --number-of-solutions=all

Then the second conjure solve exits with no solutions, and the first stops, printing the solutions it found so far.

pwn1 commented 2 years ago

That could be a savile row issue, i.e. the second SR to start is overwriting the files of the first one -- what are the filenames of the param files produced by conjure? i.e. are they the same for both commands

ozgurakgun commented 2 years ago

Just to make a note here as well Chris. The default model will be called conjure-output/model000001.eprime, hence if the same param name is used Conjure might explicitly set the filenames used by SR to clash. Even if Conjure didn't set these I think the defaults of SR would cause them to clash as well.

I would use a separate output directory per Essence file.

We can change Conjure's default output directory to something like conjure-output/essenceBaseFilename but then if you have 2 essence files with the same name but at different locations, you would still have a collision. Maybe that is a rarer case, but would be even more annoying when it happens...

ozgurakgun commented 1 year ago

Any suggestions for this one @ChrisJefferson? I can implement what I suggest in the previous comment without too much hassle (output dir named after the essence file) but this can also be achieved by setting an output directory manually (using -o).

ChrisJefferson commented 1 year ago

This is looking at an old commit -- I wonder if we should just put things in a subdirectory of conjure-output based on hash of the contents of the file? This would make it harder for people to go digging for outputs, but should make it easier to run lots of conjures.