Advice for a solver rewrite.. #1058
Closed
mikepictor
started this conversation in
General
Replies: 1 comment 4 replies
-
Questions like this are impossible to answer without understanding the domain. And if we can see the domain, we often don't have the time to do an in-depth analysis of the issue. That's what paid consulting is for. That said, there are some things I can say in general:
As you can see, there are many things that could be wrong. To an extent, designing a good model is a combination of science and art. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to understand some solver behaviour following a fairly big rewrite of my code. I had a solution that worked...mostly. Solutions were good, but often with a lot of caveats and occasional weird results. I have know for a while though that I had some very inefficient scenarios that I couldn't resolve without a rewrite. It would take 3 or 4 minutes to produce a solve that I usually could describe as "decent", but not often much better than that.
Without breaking it into massive detail, I had a
Task
with a start time planning variable and a value range provide with time intervals throughout the day, and it contained 1 or moreTaskAssignment
with an employee planning variable, and a value range provider with a pool of employees. Assignments would get assigned to employees, I'd evaluate things like minimum employee count, conflicts, etc...It worked, but the complexity was massive. I changed my solver, and the main change was to scrap
TaskAssignment
entirely. Instead my Task now just as anassignedEmployees
interger, and a value range provider of 1 up to my max limit. This allowed me to scrap 4 of my 10 constraints entirely, and speed up 3 of the others. The benchmark tool shows a problem complexity that is less than half what it used to be, and an entity count a third of what it was. AwesomeHowever, my solver now finishes nearly instantly (I have an
unimproved-spent-limit
of 20 seconds, and the solve finishes in 20.5 seconds). The resulting solution is very bad, conflicts all over the place. This is all reflected in the score, mysolutionManager.analyze
call shows every problem as a constraint match, so the score is clearly explained...but I don't know why it can't find a better solution. Why did it take half a second to get a bad solution, and then spend 20 seconds failing to improve it, so it stops there?I could quote some actual entity structures here if it helps, but I mainly just want some inspiration as to what may cause it to just give up after getting a bad solution. It barely manages to resolve my hard constraints (sometimes...I've had hard penalties too, but they usually resolve), but I am getting a lot of medium constraints and a LOOOOOOOOT of soft constraints. It's like it's not really making an effort anymore.
Beta Was this translation helpful? Give feedback.
All reactions