Benezivas / algobattle

Let teams compete by making them create hard instances and fast solvers for problems of your choice. Then pitch these instances and solvers against one another. All language-agnostic.
https://algobattle.org
MIT License
8 stars 3 forks source link

Minor bug when dealing with Self-Edges #143

Closed Magie99b closed 11 months ago

Magie99b commented 11 months ago

When algobattle encounters self-edges in problem.py (in the 5-shortest-paths problem), it states that the number of nodes is too small ("type":"ValueError","message":"Cannot run battle at size 6 since it is smaller than the smallest size the problem allows (7).") despite the fact that in certain instances, there are technically at least 7 nodes present. Here is an exmaple for an output where the error is thrown: {'num_vertices': 9, 'edges': [[7, 4], [7, 2], [7, 0], [7, 5], [7, 8], [7, 7], [4, 5], [2, 5], [0, 5], [5, 5], [8, 5], [1, 3], [1, 1], [1, 6], [1, 5], [3, 1], [3, 5], [6, 3], [6, 6], [6, 5]], 'edge_weights': [79, 55, 85, 94, 96, 653, 88, 71, 89, 52, 74, 6, 9, 5, 395, 7, 1756, 4, 2, 1020], 'start': 7, 'end': 5} {'paths': [[7, 4, 5], [7, 2, 5], [7, 0, 5], [7, 5, 5], [7, 8, 5]]}

ImogenBits commented 11 months ago

The error you're getting is not about a particular instance, but about the fight you're attempting to run. It's not saying that this instance contains too few vertices but rather that the parameters of the match are trying to run a fight at a size not compatible with the problem.

5 shortest paths says it can only do fights at size 7 and up. This makes sense since any valid instance needs to contain a source, a target, and five vertices in between to create five different paths.

I'm not entirely sure what you mean with the error being thrown for that output. The error will be thrown before any generator is executed. And even if it were, your instance has size 9 and thus wouldn't be valid for a fight allowing a maximum size of 6. How you running algobattle to produce this error? In particular, what cli command are you invoking it with and what does the algobattle.toml in your project folder look like?

ImogenBits commented 11 months ago

For posterity: This isn't related to self edges or this particular problem. It's an issue that occurs when the first fight in an iterated battle fails while using a problem with a minimum size >= 2. The battle then wants to continue iterating at a size smaller than the minimum size, which gets caught too late and causes this error. Fixed in #146.