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

Not recognizing optimal calendar #1

Closed ssardina closed 5 months ago

ssardina commented 5 months ago

Hi @axelahmer

One way to check soundness is to give the scheduler an already optimal calendar, which we have from the organisers (done via Gurobi).

Let's take instance 1, this is what is reported in paper:

image

That means 2 games not scheduled (2000) + 87 in terms of too close games.

When I ran my solver I get right away what I expect:

image

so priority top is 2 (two games not scheduled) and 87 second priority cost, matches 2087.

I ran your system on the same calendar (with appropiate API transformation for your interface), but it is still running:

image

I attach instance and calendar in already ASP format (as you just build it in inside Python) and the instance_api.lp that provides your interface instance1.zip

axelahmer commented 5 months ago

Hey @ssardina , yes i wanted to confirm this yesterday so i build in the capacity (just adding the schedule(Home,Away,Time) facts through a cli param - v simple:

e.g. python .\lzcup.py 1 4 60 --calendar_path data/calendars/gurobi/calendar_1.txt

Interestingly in most cases my solution works and gives the correct unified score (the score from the paper):

image image

But in some unique instances (instance 1) I get the wrong number scheduled games!!?? This should be an interesting nut to crack... Hopefully Ill have time later today to fix 👍

image image

axelahmer commented 5 months ago

It appears clingo is adding a schedule predicate to try an optimize even when given all the gurobi schedule predicates:

image

It appears it can get away with this because of a logic error on my behalf when there exists a schedule at the same time but with home and away teams flipped:

image

I'll fix later today. Thanks 👍

axelahmer commented 5 months ago

Fixed! Thank you @ssardina

axelahmer commented 5 months ago

It gives quit good visuals of the close games too:

Instance 33:

image image

ssardina commented 5 months ago

That's very nice indeed, will check the new code now.

BTW, I am also building a Prolog verifier that is extremely elegant (compared with the python-based variants) :-)

https://github.com/ssardina-research/lzvcup-scheduler/issues/4

ssardina commented 5 months ago

OK I can confirm it works on my side:

image

I had to issue a small fix on a wrong newline in the Python code.