File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed
include/packingsolver/irregular Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ class AlgorithmFormatter
6060 void update_bin_packing_bound (
6161 BinPos number_of_bins);
6262
63+ /* * Update the variable-sized bin packing bound. */
64+ void update_variable_sized_bin_packing_bound (
65+ Profit cost);
66+
6367 /* * Method to call at the end of the algorithm. */
6468 void end ();
6569
Original file line number Diff line number Diff line change @@ -285,6 +285,24 @@ void AlgorithmFormatter::update_bin_packing_bound(
285285 mutex_.unlock ();
286286}
287287
288+ void AlgorithmFormatter::update_variable_sized_bin_packing_bound (
289+ Profit cost)
290+ {
291+ mutex_.lock ();
292+ if (cost > output_.variable_sized_bin_packing_bound ) {
293+ output_.variable_sized_bin_packing_bound = cost;
294+ output_.json [" IntermediaryOutputs" ].push_back (output_.to_json ());
295+ parameters_.new_solution_callback (output_);
296+
297+ // Check optimality.
298+ if (output_.solution_pool .best ().full ()
299+ && output_.variable_sized_bin_packing_bound == output_.solution_pool .best ().number_of_bins ()) {
300+ end_ = true ;
301+ }
302+ }
303+ mutex_.unlock ();
304+ }
305+
288306void AlgorithmFormatter::end ()
289307{
290308 output_.time = parameters_.timer .elapsed_time ();
Original file line number Diff line number Diff line change @@ -65,10 +65,10 @@ void optimize_onedimensional_bound(
6565 algorithm_formatter.update_knapsack_bound (
6666 onedim_output.knapsack_bound );
6767 break ;
68- // } case Objective::VariableSizedBinPacking: {
69- // algorithm_formatter.update_variable_sized_bin_packing_bound(
70- // onedim_output.variable_sized_bin_packing_bound);
71- // break;
68+ } case Objective::VariableSizedBinPacking: {
69+ algorithm_formatter.update_variable_sized_bin_packing_bound (
70+ onedim_output.variable_sized_bin_packing_bound );
71+ break ;
7272 } default : {
7373 std::stringstream ss;
7474 ss << FUNC_SIGNATURE << " : "
You can’t perform that action at this time.
0 commit comments