conjure-cp / conjure-notebook

3 stars 2 forks source link

Handle solution counts differently #24

Closed ChrisJefferson closed 1 year ago

ChrisJefferson commented 1 year ago

Implements #23

I wasn't 100% happy with how I handle 0 solutions. I was going to return "None", but jupyter uses that to denote printing nothing at all, which is confusing. Therefore I'm currently printing [] (empty list). I could change this to "No solution found".

I also sort the solutions -- this is partly to make testing easier (as it means my tests don't keep changing), but I image users might also get annoyed if their notebooks keep changing. Of course, if you only ask for 1 solution to a problem with many solutions, you might keep getting a different solution each time with some solvers.

ozgurakgun commented 1 year ago

I often use minion's static ordering to get the same order in the output. We could stick to that in testing?

I don't mind the sorting either, just a thought.

ChrisJefferson commented 1 year ago

How do I change the solver (can I do it without interactively using the GUI?)

This would also get around the problem I think I'm having where the version of chuffed / savilerow we currently distribute seems to crash if the problem gets optimised away to nothing (which is why the test is currently failing)

ChrisJefferson commented 1 year ago

looking, might need to add another kind of magic which lets us control config from strings instead of GUI?

ozgurakgun commented 1 year ago

The %%conjure line can take arguments. --solver minion on that line should do it?

ozgurakgun commented 1 year ago

I am not a fan of the conjure_settings UI btw, it was a good idea to explore but I don't find myself reaching for that very often at all...

ChrisJefferson commented 1 year ago

I didn't try --solver minion, but I assumed it wouldn't work as it would clash with the --solver which comes from the UI, which is set to chuffed. Will try now.

ChrisJefferson commented 1 year ago

So, I added --solver minion which fixed the crash. It actually didn't solve the solution ordering problem, because my problem is so simple the generated minion instance is completely empty (I guess that is what was upsetting chuffed), and then savilerow doesn't generate solutions in lexicographical order when it creates them itself.

ozgurakgun commented 1 year ago

We could pass --savilerow-options -O0 as well so minion solves it?

ozgurakgun commented 1 year ago

happy to merge this now?

ChrisJefferson commented 1 year ago

Yes, all done I think!

The problem with solution ordering wasn't what I thought at all (I should always check my assumptions). The problem is that conjure-notebook was reading the solution files in a random order!