3
3
#include " packingsolver/boxstacks/solution.hpp"
4
4
5
5
#include " packingsolver/boxstacks/sequential_onedimensional_rectangle.hpp"
6
- #include " packingsolver/algorithms/sequential_value_correction.hpp"
7
6
8
7
#include " columngenerationsolver/linear_programming_solver.hpp"
9
8
@@ -12,62 +11,6 @@ namespace packingsolver
12
11
namespace boxstacks
13
12
{
14
13
15
- struct OptimizeParameters : packingsolver::Parameters<Instance, Solution>
16
- {
17
- /* * Optimization mode. */
18
- OptimizationMode optimization_mode = OptimizationMode::Anytime;
19
-
20
-
21
- /* * Parameters of the sequential_onedimensional_rectangle algorithm. */
22
- SequentialOneDimensionalRectangleParameters sequential_onedimensional_rectangle_parameters;
23
-
24
- /* * Size of the queue in the tree search algorithm. */
25
- NodeId tree_search_queue_size = -1 ;
26
-
27
- /* * Guides used in the tree search algorithm. */
28
- std::vector<GuideId> tree_search_guides;
29
-
30
-
31
- /* *
32
- * Time limit for the VbppToBpp bin packing sub-problem of the column
33
- * generation algorithm.
34
- */
35
- double column_generation_vbpp_to_bpp_time_limit = -1 ;
36
-
37
- /* *
38
- * Size of the queue for the VbppToBpp bin packing sub-problem of the
39
- * column generation algorithm.
40
- */
41
- NodeId column_generation_vbpp_to_bpp_queue_size = 256 ;
42
-
43
- /* *
44
- * Size of the queue for the pricing knapsack sub-problem of the column
45
- * generation algorithm.
46
- */
47
- NodeId column_generation_pricing_queue_size = 256 ;
48
-
49
- /* * Linear programming solver. */
50
- columngenerationsolver::LinearProgrammingSolver linear_programming_solver
51
- = columngenerationsolver::LinearProgrammingSolver::CLP;
52
-
53
-
54
- /* *
55
- * Size of the queue for the bin packing sub-problem of the dichotomic
56
- * search algorithm.
57
- */
58
- NodeId dichotomic_search_queue_size = 32 ;
59
-
60
-
61
- /* * Parameters for the Sequential Value Correction algorithm. */
62
- SequentialValueCorrectionParameters<Instance, Solution> sequential_value_correction_parameters;
63
-
64
- /* *
65
- * Size of the queue for the knapsack sub-problem of the sequential value
66
- * correction algorithm.
67
- */
68
- NodeId sequential_value_correction_queue_size = 1024 ;
69
- };
70
-
71
14
struct Output : packingsolver::Output<Instance, Solution>
72
15
{
73
16
Output (const Instance& instance):
@@ -101,6 +44,8 @@ struct Output: packingsolver::Output<Instance, Solution>
101
44
*/
102
45
double sequential_onedimensional_rectangle_rectangle_time = 0.0 ;
103
46
47
+ bool sequential_onedimensional_rectangle_failed = false ;
48
+
104
49
/* * Time spent in the 'boxstacks' branching scheme. */
105
50
double tree_search_time = 0.0 ;
106
51
@@ -135,6 +80,61 @@ struct Output: packingsolver::Output<Instance, Solution>
135
80
Counter number_of_tree_search_better = 0 ;
136
81
};
137
82
83
+ using NewSolutionCallback = std::function<void (const Output&)>;
84
+
85
+ struct OptimizeParameters : packingsolver::Parameters<Instance, Solution>
86
+ {
87
+ /* * Optimization mode. */
88
+ OptimizationMode optimization_mode = OptimizationMode::Anytime;
89
+
90
+ /* * New solution callback. */
91
+ NewSolutionCallback new_solution_callback = [](const Output&) { };
92
+
93
+ /* * Linear programming solver. */
94
+ columngenerationsolver::LinearProgrammingSolver linear_programming_solver
95
+ = columngenerationsolver::LinearProgrammingSolver::CLP;
96
+
97
+ /* * Use tree search algorithm. */
98
+ bool use_tree_search = false ;
99
+
100
+ /* * Use sequential single knapsack algorithm. */
101
+ bool use_sequential_single_knapsack = false ;
102
+
103
+ /* * Parameters of the sequential_onedimensional_rectangle algorithm. */
104
+ SequentialOneDimensionalRectangleParameters sequential_onedimensional_rectangle_parameters;
105
+
106
+ /* * Guides used in the tree search algorithm. */
107
+ std::vector<GuideId> tree_search_guides;
108
+
109
+ /* *
110
+ * Size of the queue for the pricing knapsack subproblem of the sequential
111
+ * value correction algorithm.
112
+ */
113
+ NodeId sequential_value_correction_subproblem_queue_size = 512 ;
114
+
115
+ /* *
116
+ * Size of the queue for the pricing knapsack subproblem of the column
117
+ * generation algorithm.
118
+ */
119
+ NodeId column_generation_subproblem_queue_size = 512 ;
120
+
121
+ /*
122
+ * Parameters for non-anytime mode
123
+ */
124
+
125
+ /* * Size of the queue in the tree search algorithm. */
126
+ NodeId not_anytime_tree_search_queue_size = 512 ;
127
+
128
+ /* *
129
+ * Size of the queue in the single knapsack subproblem of the sequential
130
+ * single knapsack algorithm.
131
+ */
132
+ NodeId not_anytime_sequential_single_knapsack_subproblem_queue_size = 512 ;
133
+
134
+ /* * Number of iterations of the sequential value correction algorithm. */
135
+ Counter not_anytime_sequential_value_correction_number_of_iterations = 32 ;
136
+ };
137
+
138
138
const Output optimize (
139
139
const Instance& instance,
140
140
const OptimizeParameters& parameters = {});
0 commit comments