Make Optaplanner ignore redundant result - optaplanner

I'm having an issue where in my use case I want to just receive the best answer and return with that single best answer. I want the result as quickly as possible and want the nonimprovement timer to trigger as soon as possible.
A lot of times optaplanner will trigger a new solution is found and when reviewing the score, it is a score that was already found. Is there a way to have optaplanner not signal that it found a new solution that is better when it is the same exact score?
Apologies if this is simple to do, I'm new to optaplanner and couldn't find what I was looking for after searching around.
Could not find a way for optaplanner to not trigger when the same best score found.
EDIT:
I just remembered that because of the random seed (which we want to keep), I spawned 8 threads to solve the same problem. So each thread is individually coming up with the same best answer and notifying the main thread. So this is definitely not an optaplanner problem. Your answer just made me think of that. Thank you so much for answering in impressive timing.
The only thing I can think of is to track to see if the same results come up myself in the main application and keep a nonimprovement timer in the main application to kill the solver threads myself... I'll mark the solution as resolved since I was slow in realizing this is an issue in my application.

OptaPlanner should fire the new best solution event only if the score has improved. If you see the event firing without any scope improvements, there might be two possible explanations:
a new best solution has been produced after submitting a ProblemChange, which is expected as this new best solution reflects an external change
there is a score corruption and, as a result, the score is incorrect; try turning on the FULL_ASSERT mode to confirm that

Related

SCIP: Find a feasible but not optimal solution to a large LP

I asked this on the soplex mailing list, but no answer yet:
http://listserv.zib.de/pipermail/soplex/2022-August/000001.html
I tried scip, and it took 30sec. Maybe because it performs pre-solve.
Is there an easy way to achieve my objective:
Specify an initial solution (something that I have, which is better than a random init), and use the solver for a limited time to find a better feasible solution
https://math.stackexchange.com/questions/4510587/find-a-feasible-but-not-optimal-solution-to-a-large-lp
Reply from the mailing list:
http://listserv.zib.de/pipermail/soplex/2022-August/000002.html
To find only a feasible solution, you can just remove the objective function. This will terminate as soon as feasibility is attained. Then, you could plug in this solution as a starting basis - I don't think this is going to help much, though.

Implementing a custom move in optaplanner

I'm using Optaplanner to make a schedule for a school. Every works good, except that it sometimes have gaps between the lessons, which I do not want. I have rules for punishing this but I think the search space is so big that it will take quite a while before it "fixes" this.
Is it possible to tell Optaplanner to try out some "selected/calculated" moves first and then continue with the moves it is supposed to do?
I'm using the time grain patterns with this.
It is possible to do, but not recommended. There is good literature on the subject here: https://www.optaplanner.org/docs/optaplanner/latest/move-and-neighborhood-selection/move-and-neighborhood-selection.html
I would start first by experimenting with configuring the generic moves that are provided out-of-the-box in optaplanner, which you can do by editing the XML file included with the distribution.
If a custom move is really what you need, you can refer to the docs above, but it is much harder to avoid bugs this way and you will want to enable full assert to double-check that score corruption is not occurring after implementation.

OptaPlanner: how to get current intermediate result during planning

I noticed in the optaplanner examples, specifically the nurse rostering example, the GUI updates with the current best solution found.
I'd like to mimic something like this in my app but I'm unsure how I can get the current best solution after calling, for example solver.solve(roster);
Furthermore how would I be able to even update something on, let's say, a GUI if I'm "stuck" in the solver() method while solving.
I'm looking for some basic direction on where to start because I cannot find anything in the user guide, but I might just be blind.
Take a look at listing to new best solution events in the manual.

OptaPlanner immediately produces better solution after terminating and restarting the solver

I created a solution based on the task assigning example of OptaPlanner and observe one specific behavior in both the original example and my own solution:
Solving the 100tasks-5employees problem does hardly produce new better scores after half a minute or so, but terminating the solver and restarting it again does immediately bring up better solutions.
Why does this happen? In my understanding the repeated construction heuristic does not change any planning entity as all of them are already initialized. Then local search is started again. Why does it immediately find new better solutions, while just continuing the first execution without interruption does not or at least much slower?
By terminating and restarting the solver, you're effectively causing Late Acceptance to do a reheating. OptaPlanner will do automatic reheating once this jira is prioritized and implemented.
This occurs on a minority of the use cases. But if it occurs on a use case, it tends to occur on all datasets.
I've some cases workaround it by configuring multiple <localSearch> phases with <unimprovedSecondsSpentLimit> terminations, but I don't like that. Fixing that jira is the only real solution.

Methods of Lag Handling in iOS (SpriteKit)

Hey I've been working my way through making my first app, and I've hit the first problem that I don't even know how to begin fixing.
I am making a SpriteKit game, and as I've been coding, performance has been slowly dropping. Clearly I am not handling lag well at all. (~20-30 fps on device)
The thing is though, I'm not sure how to tackle this issue. I am going through and trying to loosen the load on each frame, but..
Are there any methods of lag handling that most people use?
I tried setting up a timer system, so that I know how much each segment of code takes to run, but the data wasn't too helpful.
It doesn't even look like a specific segment of code is taking that long at all.
This is kind of a broad question I guess, but how should you go about lag handling in SpriteKit?