Repository navigation
wasm: re-optimize the leftovers of a bin from the web page - #889
Merged
Merged
Conversation
The view of a bin of the web page gets a "Re-optimize the leftovers"
button (rectangle, box, boxstacks and irregular). It packs the items of
the bin again as a single-bin BinPackingWithLeftovers instance
('reoptimize_bin_leftovers'), and keeps the new solution if it is not
worse and if its leftovers are better, as the leftover post-process does.
The solution shown is replaced as soon as a better one is found.
- 'reoptimize_bin_leftovers' passes the solutions found during the
re-optimization to 'parameters.new_solution_callback', as solutions of
the instance. The leftover post-process and
'reoptimize_non_last_bins_leftovers' / 'reoptimize_all_bins_leftovers'
don't report them.
- 'SolutionBuilder::read(std::istream&)' reads a certificate from a stream.
- WebAssembly module: 'Session.startReoptimizeBinLeftovers(problemType,
instance, certificate, binPos, parameters)'. Its updates are the
solutions with better leftovers than the given one and than the previous
ones.
- Worker: "reoptimize-bin-leftovers" message, answered with
"reoptimization-solution" updates and a "reoptimized" message.
- Viewer: 'binActions', buttons in the view of a bin.
- The instance is kept alive until the results of the updates are
computed: they may be computed after the end of the optimization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The view of a bin of the web page gets a "Re-optimize the leftovers" button (rectangle, box, boxstacks and irregular). It packs the items of the bin again as a single-bin
BinPackingWithLeftoversinstance (reoptimize_bin_leftovers), and keeps the new solution if it is not worse and if its leftovers are better, as the leftover post-process does. The solution shown is replaced as soon as a better one is found, and the status shows the change of the total leftover value (or of the total staircase leftover value, if the leftover value is the same). The Stop button stops it.The re-optimization uses the optimization mode and the time limit of the form, but "not-anytime" instead of "anytime": in anytime mode, it would run until the time limit.
Changes:
reoptimize_bin_leftoverspasses the solutions found during the re-optimization toparameters.new_solution_callback, as solutions of the instance. The leftover post-process ofoptimizeandreoptimize_non_last_bins_leftovers/reoptimize_all_bins_leftoversdon't report them.SolutionBuilder::read(std::istream&)(rectangle, box, boxstacks, irregular) reads a certificate from a stream.Session.startReoptimizeBinLeftovers(problemType, instance, certificate, binPos, parameters). Its updates are the solutions with better leftovers than the given one and than the previous ones; the result has the solution, its certificate and whether the leftovers are better.reoptimize-bin-leftoversmessage, answered withreoptimization-solutionupdates and areoptimizedmessage.binActionsoption, buttons in the view of a bin.The button is only shown when the instance of the solution is known: the projects exported and imported again don't keep it.
Tests:
wasm/tests/reoptimize.test.js(a solution with better leftovers and its updates, each problem type, invalid bin, unsupported problem type, worker). The wasm tests and the unit tests of the four problem types pass. Checked in headless Chromium: the solution and the status are updated during the re-optimization.