Skip to content

Commit 234ceec

Browse files
committed
Save current state
1 parent f0b82c6 commit 234ceec

18 files changed

+5385
-0
lines changed

include/packingsolver/algorithms/common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ enum class ProblemType
9898
RectangleGuillotine,
9999
Rectangle,
100100
OneDimensional,
101+
Box,
101102
BoxStacks,
102103
Irregular,
103104
};
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#pragma once
2+
3+
#include "packingsolver/box/solution.hpp"
4+
5+
#include <mutex>
6+
7+
namespace packingsolver
8+
{
9+
namespace box
10+
{
11+
12+
class AlgorithmFormatter
13+
{
14+
15+
public:
16+
17+
/** Constructor. */
18+
AlgorithmFormatter(
19+
const Instance& instance,
20+
const packingsolver::Parameters<Instance, Solution>& parameters,
21+
packingsolver::Output<Instance, Solution>& output):
22+
instance_(instance),
23+
parameters_(parameters),
24+
output_(output),
25+
os_(parameters.create_os()) { }
26+
27+
/** Print the header. */
28+
void start();
29+
30+
/** Print the header. */
31+
void print_header();
32+
33+
/** Print current state. */
34+
void print(
35+
const std::string& s);
36+
37+
/** Update the solution. */
38+
void update_solution(
39+
const Solution& solution,
40+
const std::string& s);
41+
42+
/** Update the bin packing bound. */
43+
void update_bin_packing_bound(
44+
BinPos number_of_bins);
45+
46+
/** Method to call at the end of the algorithm. */
47+
void end();
48+
49+
/** Get end boolean. */
50+
bool& end_boolean() { return end_; };
51+
52+
private:
53+
54+
/** Instance. */
55+
const Instance& instance_;
56+
57+
/** Parameters. */
58+
const packingsolver::Parameters<Instance, Solution>& parameters_;
59+
60+
/** Output. */
61+
packingsolver::Output<Instance, Solution>& output_;
62+
63+
/** Output stream. */
64+
std::unique_ptr<optimizationtools::ComposeStream> os_;
65+
66+
/** End boolean. */
67+
bool end_ = false;
68+
69+
/** Mutex. */
70+
std::mutex mutex_;
71+
72+
};
73+
74+
}
75+
}

0 commit comments

Comments
 (0)