axelahmer / lzcup-scheduler

This repository contains an Answer Set Programming (ASP) implementation using Clingo for scheduling the LZV Cup, an amateur indoor football league in Belgium.
0 stars 0 forks source link

Scheduler in Clingcon #3

Open ssardina opened 2 months ago

ssardina commented 2 months ago
          @ssardina The paper mentions that they get optimal solns from the COIN solver too, which is open source.

I had a play with clingcon on some dummy examples - https://github.com/potassco/clingcon/tree/master/examples

Seems interesting. Quite a bit of thought would have to go into how variables are defined however - such that their domains can be set nicely. Failing to see how this could be bootstrapped onto the current base system, would need to redesign from the top I believe?

Any simple ideas of how to model like this? Would we be trying to just implement the IP constraints from the paper? If so, it seems like using an actual MIPs solver makes more sense? What is your intuition here?

Random aside news: Interesting I discovered that clingcon cannot enumerate optimal models when asked - instead you need to control it using the python API and print all solns with a certain bound. My example program that showed this:

&dom {0..1} = x.
&dom {0..1} = y.
&distinct { x ; y }.
&minimize { x ; y }.
image

It should obviously give two minimums: x=1,y=0 and x=0,y=1.

The issue is discussed in https://github.com/potassco/clingcon/issues/78 if you are interested. Took me a little while to find it.

Originally posted by @axelahmer in https://github.com/axelahmer/lzcup-scheduler/issues/2#issuecomment-2158073908

ssardina commented 2 months ago

mm yeah, I was looking at the examples and they look a bit cryptic, but in the end I was able to make some sense.

I wouldn't care enumerating the optimal models; just one would be fine :wink:

Would be nice if we can just do the "closed games" optimization via clingcon; can we do that or do we need to refactor the whole encoding?

BTW, we never tested what happens if we totally remove the "close games"optimization. Do we do well without it?

ssardina commented 2 months ago

The minimal doc for clingcon is here: https://potassco.org/clingcon/

axelahmer commented 2 months ago

The minimal doc for clingcon is here: https://potassco.org/clingcon/

Minimal docs are actually quite useful.

I'll think on the close game encoding with clingcon...

ssardina commented 2 months ago

The other option is multi-shot. I thought it was not appropriate, but maybe I was wrong. We can do multi-shot by slot number. So we first solve with 1 slot available, then 2, then 3... etc...?

although it seems to be the programs are not "compositional", because of t he closed games and m

axelahmer commented 2 months ago

@ssardina multishot seems more applicable if replicating - as it fits more with their heuristic method: starting with a partial assignment and then improving.

integer domain constraints are interesting... There is maybe a way to restrict the time domain of schedules via rmax and m (I assume this is a benefit over learning nogoods from guessing - am i right here?). I don't think it makes sense to do the close game (soft constraints) with domain restriction though - i don't think this is even possible.


With regard to "BTW, we never tested what happens if we totally remove the "close games"optimization. Do we do well without it?"

Have not tested in a proper capacity. It would just be a matter of commenting out the soft constraints and the optimize. I assume it would be very slightly better - intuitively because there is just less to solve per model. Let me know if you really care and I can write up a results table.

ssardina commented 2 months ago

I have forked the discussion on multi-shot to another issue.

Regarding IC, indeed, there would be a benefit of operating with domains rather than learning no-goods, particularly in the context of variables that take integers and have inequalities constraints, like this case. The no-goods would have to learn one by one, pretty bad. Though Clingo may already be doing some numeric reasoning/pruning when having inequalities, like $C > T$...

That's precisely why I suggested modeling the closed games requirements (rmax and m); we should be doing more mathematical reasoning with those requirements rather than no-goods learning. :ok_hand: