Closed giovinazzo-kevin closed 2 years ago
Hi Kevin, thanks for trying out Decider.
I should hopefully be able to work out what variable node
is set to a null
reference. I'd need the sourcecode so I can recreate the bug. Is there a branch you could share me to?
Cheers, Iain
Hi Iain,
Thank you for the incredibly fast reply.
I've isolated the problem down to these two lines:
using Decider.Csp.BaseTypes;
using Decider.Csp.Integer;
var state = new StateInteger(new[] {
new VariableInteger("X", 0, 10),
new VariableInteger("Y", 0, 10)
},
Enumerable.Empty<IConstraint>()
);
state.SearchAllSolutions();
This is a fresh console application project targeting .NET 6.
I think I see, so there's no actual constraint, it's enumerating every pair from [(0, 0), (0, 1), ... (10, 10)]
.
I should have some time to look into this tomorrow. I'll be in touch if I cannot reproduce the error.
No worries! For the time being and as far as I'm concerned catching the exception seems to be working.
This is just a fresh hobby project so I'm not bothered by leaving that in for a while, assuming nothing else breaks (I'll let you know, in case).
Anyway, thank you for creating this project.
Found the issue. Searching all solutions where every combination is a valid possibility eventually leads to searching for a solution which has an empty variable. This causes the search routine to fail when trying to instantiate the empty variable. I've put a check for empty variables in the search function before starting.
I'll create a PR sometime this week and publish a new nuget package.
This bug has been fixed by https://github.com/lifebeyondfife/Decider/pull/60. Thanks once more, @G3Kappa. Hope Decider is useful for your hobby project.
I'm trying to enumerate all solutions for a custom point structure
P(X, Y)
where the variables X and Y are defined as having the domain[0, 10]
. I'm expecting11*11 = 121
solutions in the unconstrained case. The solver returns all solutions correctly, but fails at the very end with a NRE.