Adding consistency tests for automated testing, found bug in progress bar - trying to fix it (almost done).

This commit is contained in:
surynek 2024-11-28 17:31:01 +01:00 committed by Lukas Matena
parent c65315ce5a
commit 3c40a68f16
4 changed files with 138 additions and 57 deletions

View File

@ -380,7 +380,8 @@ void schedule_ObjectsForSequentialPrint(const SolverConfiguration &solver
#endif
int progress_objects_done = 0;
int progress_objects_total = objects_to_print.size();
int progress_object_phases_done = 0;
int progress_object_phases_total = objects_to_print.size() * SEQ_PROGRESS_PHASES_PER_OBJECT;
do
{
@ -396,7 +397,8 @@ void schedule_ObjectsForSequentialPrint(const SolverConfiguration &solver
#endif
bool optimized;
printf("Object phases A1: %d, %d\n", progress_object_phases_done, solvable_objects.size());
optimized = optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(solver_configuration,
poly_positions_X,
poly_positions_Y,
@ -404,9 +406,10 @@ void schedule_ObjectsForSequentialPrint(const SolverConfiguration &solver
solvable_objects,
decided_polygons,
remaining_polygons,
progress_objects_done,
progress_objects_total,
progress_object_phases_done,
progress_object_phases_total,
progress_callback);
printf("Object phases A2: %d,%d,%d\n", progress_object_phases_done, decided_polygons.size(), remaining_polygons.size());
#ifdef DEBUG
{
@ -454,7 +457,16 @@ void schedule_ObjectsForSequentialPrint(const SolverConfiguration &solver
scheduled_plate.scheduled_objects.push_back(ScheduledObject(original_index->second, X, Y));
}
progress_objects_done += decided_polygons.size();
printf("Object phases B: %d\n", progress_object_phases_done);
/*
if (!decided_polygons.empty())
{
progress_objects_done += decided_polygons.size();
progress_object_phases_done = (progress_object_phases_done % SEQ_PROGRESS_PHASES_PER_OBJECT)
+ progress_objects_done * SEQ_PROGRESS_PHASES_PER_OBJECT;
}
printf("Object phases B1: %d\n", progress_object_phases_done);
*/
}
else
{
@ -771,7 +783,8 @@ int schedule_ObjectsForSequentialPrint(const SolverConfiguration &solver_
#endif
int progress_objects_done = 0;
int progress_objects_total = objects_to_print.size();
int progress_object_phases_done = 0;
int progress_object_phases_total = objects_to_print.size() * SEQ_PROGRESS_PHASES_PER_OBJECT;
do
{
@ -795,8 +808,8 @@ int schedule_ObjectsForSequentialPrint(const SolverConfiguration &solver_
solvable_objects,
decided_polygons,
remaining_polygons,
progress_objects_done,
progress_objects_total,
progress_object_phases_done,
progress_object_phases_total,
progress_callback);
#ifdef DEBUG
@ -845,7 +858,11 @@ int schedule_ObjectsForSequentialPrint(const SolverConfiguration &solver_
scheduled_plate.scheduled_objects.push_back(ScheduledObject(original_index->second, X, Y));
}
progress_objects_done += decided_polygons.size();
if (!decided_polygons.empty())
{
progress_objects_done += decided_polygons.size();
progress_object_phases_done = progress_objects_done * SEQ_PROGRESS_PHASES_PER_OBJECT;
}
}
else
{

View File

@ -8860,7 +8860,8 @@ bool optimize_ConsequentialWeakPolygonNonoverlappingBinaryCentered(z3::solver
const ProgressRange &progress_range,
std::function<void(int)> progress_callback)
{
z3::set_param("timeout", solver_configuration.optimization_timeout.c_str());
z3::set_param("timeout", solver_configuration.optimization_timeout.c_str());
printf("Progress range: %d -- %d\n", progress_range.progress_min, progress_range.progress_max);
coord_t last_solvable_bounding_box_size = -1;
@ -8874,7 +8875,7 @@ bool optimize_ConsequentialWeakPolygonNonoverlappingBinaryCentered(z3::solver
coord_t half_y_min = 0;
coord_t half_y_max = box_half_y_max;
int progress_total_estimation = MAX(1,std::log2(half_x_max - half_x_min));
int progress_total_estimation = MAX(1, std::log2(half_x_max - half_x_min));
int progress = 0;
while ((half_x_max - half_x_min) > 1 && (half_y_max - half_y_min) > 1)
@ -9106,7 +9107,7 @@ bool optimize_ConsequentialWeakPolygonNonoverlappingBinaryCentered(z3::solver
printf("Printing solver status:\n");
cout << Solver << "\n";
*/
progress_callback(progress_range.progress_min + (progress_range.progress_max - progress_range.progress_min) * progress / progress_total_estimation);
progress_callback(progress_range.progress_min + (progress_range.progress_max - progress_range.progress_min) * progress / progress_total_estimation);
if (refined_sat)
{
@ -9212,7 +9213,7 @@ bool optimize_ConsequentialWeakPolygonNonoverlappingBinaryCentered(z3::solver
}
#endif
++progress;
progress = MIN(progress + 1, progress_total_estimation);
progress_callback(progress_range.progress_min + (progress_range.progress_max - progress_range.progress_min) * progress / progress_total_estimation);
}
progress_callback(progress_range.progress_max);
@ -10262,8 +10263,8 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
const std::vector<int> &undecided_polygons,
std::vector<int> &decided_polygons,
std::vector<int> &remaining_polygons,
int progress_objects_done,
int progress_total_objects,
int &progress_object_phases_done,
int progress_total_object_phases,
std::function<void(int)> progress_callback)
{
std::vector<int> undecided;
@ -10419,7 +10420,7 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
}
#endif
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects);
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_object_phases_done)) / progress_total_object_phases);
optimized = optimize_ConsequentialWeakPolygonNonoverlappingBinaryCentered(z_solver,
z_context,
@ -10438,8 +10439,8 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
polygons,
unreachable_polygons,
presence_assumptions,
ProgressRange((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects,
(SEQ_PROGRESS_RANGE * (decided_polygons.size() + (progress_objects_done + 1))) / progress_total_objects),
ProgressRange((SEQ_PROGRESS_RANGE * (decided_polygons.size() * SEQ_PROGRESS_PHASES_PER_OBJECT + progress_object_phases_done)) / progress_total_object_phases,
(SEQ_PROGRESS_RANGE * (decided_polygons.size() * SEQ_PROGRESS_PHASES_PER_OBJECT + (progress_object_phases_done + 1))) / progress_total_object_phases),
progress_callback);
if (optimized)
@ -10467,11 +10468,10 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
}
else
{
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects);
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() * SEQ_PROGRESS_PHASES_PER_OBJECT + progress_object_phases_done)) / progress_total_object_phases);
return true;
}
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects);
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() * SEQ_PROGRESS_PHASES_PER_OBJECT + progress_object_phases_done)) / progress_total_object_phases);
break;
}
else
@ -10481,13 +10481,14 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
printf("Remaining polygon: %d\n", curr_polygon + object_group_size - 1);
}
#endif
++progress_object_phases_done;
remaining_local.push_back(undecided_polygons[curr_polygon + object_group_size - 1]);
}
missing.push_back(undecided.back());
undecided.pop_back();
--object_group_size;
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects);
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() * SEQ_PROGRESS_PHASES_PER_OBJECT + progress_object_phases_done)) / progress_total_object_phases);
}
std::reverse(remaining_local.begin(), remaining_local.end());
@ -10534,8 +10535,8 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
const std::vector<SolvableObject> &solvable_objects,
std::vector<int> &decided_polygons,
std::vector<int> &remaining_polygons,
int progress_objects_done,
int progress_total_objects,
int &progress_object_phases_done,
int progress_total_object_phases,
std::function<void(int)> progress_callback)
{
std::vector<int> undecided;
@ -10703,8 +10704,9 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
}
#endif
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects);
printf("Top call 1\n");
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
optimized = optimize_ConsequentialWeakPolygonNonoverlappingBinaryCentered(z_solver,
z_context,
solver_configuration,
@ -10722,12 +10724,14 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
polygons,
unreachable_polygons,
presence_assumptions,
ProgressRange((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects,
(SEQ_PROGRESS_RANGE * (decided_polygons.size() + (progress_objects_done + 1))) / progress_total_objects),
ProgressRange((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases,
(SEQ_PROGRESS_RANGE * (progress_object_phases_done + SEQ_PROGRESS_PHASES_PER_OBJECT / 2)) / progress_total_object_phases),
progress_callback);
printf("Optimo: %d\n", optimized);
if (optimized)
{
printf("alpha 1\n");
/*
printf("Printing solver status:\n");
cout << z_solver << "\n";
@ -10742,6 +10746,9 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
dec_values_Y[undecided[i]] = local_values_Y[undecided[i]];
dec_values_T[undecided[i]] = local_values_T[undecided[i]];
decided_polygons.push_back(undecided[i]);
int progress_phase_starter = progress_object_phases_done % SEQ_PROGRESS_PHASES_PER_OBJECT;
progress_object_phases_done += progress_phase_starter > 0 ? SEQ_PROGRESS_PHASES_PER_OBJECT - progress_phase_starter : SEQ_PROGRESS_PHASES_PER_OBJECT;
}
augment_TemporalSpread(solver_configuration, dec_values_T, decided_polygons);
@ -10751,27 +10758,32 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
}
else
{
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects);
printf("Top call 2\n");
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
return true;
}
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects);
printf("Top call 3\n");
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
break;
}
else
{
printf("alpha 2\n");
#ifdef DEBUG
{
printf("Remaining polygon: %d\n", curr_polygon + object_group_size - 1);
}
#endif
printf("Phase increasing\n");
remaining_local.push_back(undecided.back());
}
missing.push_back(undecided.back());
undecided.pop_back();
--object_group_size;
progress_callback((SEQ_PROGRESS_RANGE * (decided_polygons.size() + progress_objects_done)) / progress_total_objects);
printf("Top call 4\n");
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
}
std::reverse(remaining_local.begin(), remaining_local.end());
@ -10800,12 +10812,15 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
remaining_polygons.push_back(curr_polygon);
}
}
progress_object_phases_done += SEQ_PROGRESS_PHASES_PER_OBJECT / 2;
printf("Complete exit\n");
return true;
}
}
assert(remaining_polygons.empty());
}
assert(remaining_polygons.empty());
printf("Complete exit 2\n");
return true;
}

View File

@ -55,9 +55,10 @@ namespace Sequential
#define SEQ_Z3_SOLVER_TIMEOUT "8000"
const coord_t SEQ_SVG_SCALE_FACTOR = 50000;
const int SEQ_GROUND_PRESENCE_TIME = 32;
const int SEQ_PROGRESS_RANGE = 100;
const coord_t SEQ_SVG_SCALE_FACTOR = 50000;
const int SEQ_GROUND_PRESENCE_TIME = 32;
const int SEQ_PROGRESS_RANGE = 100;
const int SEQ_PROGRESS_PHASES_PER_OBJECT = 2;
const int64_t SEQ_RATIONAL_PRECISION = 1000000;
const double SEQ_DECIMATION_TOLERANCE = 400000.0;
@ -1598,8 +1599,8 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
const std::vector<int> &undecided_polygons,
std::vector<int> &decided_polygons,
std::vector<int> &remaining_polygons,
int progress_objects_done,
int progress_total_objects,
int &progress_object_phases_done,
int progress_total_object_phases,
std::function<void(int)> progress_callback = [](int progress){});
bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const SolverConfiguration &solver_configuration,
@ -1609,8 +1610,8 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
const std::vector<SolvableObject> &solvable_objects,
std::vector<int> &decided_polygons,
std::vector<int> &remaining_polygons,
int progress_objects_done,
int progress_total_objects,
int &progress_object_phases_done,
int progress_total_object_phases,
std::function<void(int)> progress_callback = [](int progress){});
/*----------------------------------------------------------------*/

View File

@ -114,7 +114,7 @@ void save_import_data(const std::string &filename,
/*----------------------------------------------------------------*/
/*
TEST_CASE("Interface test 1", "[Sequential Arrangement Interface]")
{
clock_t start, finish;
@ -128,33 +128,43 @@ TEST_CASE("Interface test 1", "[Sequential Arrangement Interface]")
printf("Loading objects ...\n");
std::vector<ObjectToPrint> objects_to_print = load_exported_data("arrange_data_export.txt");
REQUIRE(objects_to_print.size() > 0);
printf("Loading objects ... finished\n");
std::vector<ScheduledPlate> scheduled_plates;
printf("Scheduling objects for sequential print ...\n");
printf("Scheduling objects for sequential print ...\n");
int result = schedule_ObjectsForSequentialPrint(solver_configuration,
objects_to_print,
scheduled_plates);
REQUIRE(result == 0);
if (result == 0)
{
printf("Object scheduling for sequential print SUCCESSFUL !\n");
printf("Number of plates: %ld\n", scheduled_plates.size());
REQUIRE(scheduled_plates.size() > 0);
for (unsigned int plate = 0; plate < scheduled_plates.size(); ++plate)
{
printf(" Number of objects on plate: %ld\n", scheduled_plates[plate].scheduled_objects.size());
REQUIRE(scheduled_plates[plate].scheduled_objects.size() > 0);
for (const auto& scheduled_object: scheduled_plates[plate].scheduled_objects)
{
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
REQUIRE(scheduled_object.x >= 0);
REQUIRE(scheduled_object.x <= solver_configuration.x_plate_bounding_box_size * SEQ_SLICER_SCALE_FACTOR);
REQUIRE(scheduled_object.y >= 0);
REQUIRE(scheduled_object.y <= solver_configuration.y_plate_bounding_box_size * SEQ_SLICER_SCALE_FACTOR);
}
}
}
else
{
printf("Something went WRONG during sequential scheduling (code: %d)\n", result);
}
}
finish = clock();
@ -192,19 +202,26 @@ TEST_CASE("Interface test 2", "[Sequential Arrangement Interface]")
box_unreachable_zones,
scheduled_plates);
REQUIRE(result == 0);
if (result == 0)
{
printf("Object scheduling for sequential print SUCCESSFUL !\n");
printf("Number of plates: %ld\n", scheduled_plates.size());
REQUIRE(scheduled_plates.size() > 0);
for (unsigned int plate = 0; plate < scheduled_plates.size(); ++plate)
{
printf(" Number of objects on plate: %ld\n", scheduled_plates[plate].scheduled_objects.size());
REQUIRE(scheduled_plates[plate].scheduled_objects.size() > 0);
for (const auto& scheduled_object: scheduled_plates[plate].scheduled_objects)
{
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
REQUIRE(scheduled_object.x >= 0);
REQUIRE(scheduled_object.x <= solver_configuration.x_plate_bounding_box_size * SEQ_SLICER_SCALE_FACTOR);
REQUIRE(scheduled_object.y >= 0);
REQUIRE(scheduled_object.y <= solver_configuration.y_plate_bounding_box_size * SEQ_SLICER_SCALE_FACTOR);
}
}
}
@ -229,7 +246,10 @@ TEST_CASE("Interface test 3", "[Sequential Arrangement Interface]")
start = clock();
PrinterGeometry printer_geometry;
if (load_printer_geometry("printer_geometry.mk4.txt", printer_geometry) != 0)
int result = load_printer_geometry("printer_geometry.mk4.txt", printer_geometry);
REQUIRE(result == 0);
if (result != 0)
{
printf("Printer geometry load error.\n");
return;
@ -237,6 +257,8 @@ TEST_CASE("Interface test 3", "[Sequential Arrangement Interface]")
printf("x_size: %d\n", printer_geometry.x_size);
printf("y_size: %d\n", printer_geometry.y_size);
REQUIRE(printer_geometry.x_size > 0);
REQUIRE(printer_geometry.y_size > 0);
for (const auto& convex_height: printer_geometry.convex_heights)
{
@ -247,8 +269,8 @@ TEST_CASE("Interface test 3", "[Sequential Arrangement Interface]")
{
cout << "box_height:" << box_height << endl;
}
printf("extruder slices:\n");
REQUIRE(printer_geometry.extruder_slices.size() > 0);
for (std::map<coord_t, std::vector<Polygon> >::const_iterator extruder_slice = printer_geometry.extruder_slices.begin(); extruder_slice != printer_geometry.extruder_slices.end(); ++extruder_slice)
{
@ -290,7 +312,8 @@ TEST_CASE("Interface test 4", "[Sequential Arrangement Interface]")
printf("Loading printer geometry ...\n");
int result = load_printer_geometry("../printers/printer_geometry.mk4.compatibility.txt", printer_geometry);
REQUIRE(result == 0);
if (result != 0)
{
printf("Cannot load printer geometry (code: %d).\n", result);
@ -304,19 +327,25 @@ TEST_CASE("Interface test 4", "[Sequential Arrangement Interface]")
scheduled_plates = schedule_ObjectsForSequentialPrint(solver_configuration,
printer_geometry,
objects_to_print);
objects_to_print);
printf("Object scheduling for sequential print SUCCESSFUL !\n");
printf("Number of plates: %ld\n", scheduled_plates.size());
REQUIRE(scheduled_plates.size() > 0);
for (unsigned int plate = 0; plate < scheduled_plates.size(); ++plate)
{
printf(" Number of objects on plate: %ld\n", scheduled_plates[plate].scheduled_objects.size());
REQUIRE(scheduled_plates[plate].scheduled_objects.size() > 0);
for (const auto& scheduled_object: scheduled_plates[plate].scheduled_objects)
{
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
REQUIRE(scheduled_object.x >= 0);
REQUIRE(scheduled_object.x <= printer_geometry.x_size);
REQUIRE(scheduled_object.y >= 0);
REQUIRE(scheduled_object.y <= printer_geometry.y_size);
}
}
@ -348,6 +377,7 @@ TEST_CASE("Interface test 5", "[Sequential Arrangement Interface]")
printf("Loading printer geometry ...\n");
int result = load_printer_geometry("../printers/printer_geometry.mk4.compatibility.txt", printer_geometry);
REQUIRE(result == 0);
if (result != 0)
{
printf("Cannot load printer geometry (code: %d).\n", result);
@ -362,19 +392,27 @@ TEST_CASE("Interface test 5", "[Sequential Arrangement Interface]")
scheduled_plates = schedule_ObjectsForSequentialPrint(solver_configuration,
printer_geometry,
objects_to_print,
[](int progress) { printf("Progress: %d\n", progress); });
[](int progress) { printf("Progress: %d\n", progress);
REQUIRE(progress >= 0);
REQUIRE(progress <= 100); });
printf("Object scheduling for sequential print SUCCESSFUL !\n");
printf("Number of plates: %ld\n", scheduled_plates.size());
REQUIRE(scheduled_plates.size() > 0);
for (unsigned int plate = 0; plate < scheduled_plates.size(); ++plate)
{
printf(" Number of objects on plate: %ld\n", scheduled_plates[plate].scheduled_objects.size());
REQUIRE(scheduled_plates[plate].scheduled_objects.size() > 0);
for (const auto& scheduled_object: scheduled_plates[plate].scheduled_objects)
{
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
REQUIRE(scheduled_object.x >= 0);
REQUIRE(scheduled_object.x <= printer_geometry.x_size);
REQUIRE(scheduled_object.y >= 0);
REQUIRE(scheduled_object.y <= printer_geometry.y_size);
}
}
@ -388,9 +426,9 @@ TEST_CASE("Interface test 5", "[Sequential Arrangement Interface]")
bool printable = check_ScheduledObjectsForSequentialPrintability(solver_configuration,
printer_geometry,
objects_to_print,
scheduled_plates);
scheduled_plates);
printf(" Scheduled/arranged objects are sequentially printable: %s\n", (printable ? "YES" : "NO"));
REQUIRE(printable);
printf("Checking sequential printability ... finished\n");
@ -399,7 +437,7 @@ TEST_CASE("Interface test 5", "[Sequential Arrangement Interface]")
printf("Testing interface 5 ... finished\n");
}
*/
TEST_CASE("Interface test 6", "[Sequential Arrangement Interface]")
{
@ -415,6 +453,7 @@ TEST_CASE("Interface test 6", "[Sequential Arrangement Interface]")
printf("Loading objects ...\n");
std::vector<ObjectToPrint> objects_to_print = load_exported_data("arrange_data_export.txt");
REQUIRE(objects_to_print.size() > 0);
printf("Loading objects ... finished\n");
for (auto& object_to_print: objects_to_print)
@ -426,7 +465,7 @@ TEST_CASE("Interface test 6", "[Sequential Arrangement Interface]")
printf("Loading printer geometry ...\n");
int result = load_printer_geometry("../printers/printer_geometry.mk4.compatibility.txt", printer_geometry);
REQUIRE(result == 0);
if (result != 0)
{
printf("Cannot load printer geometry (code: %d).\n", result);
@ -441,19 +480,27 @@ TEST_CASE("Interface test 6", "[Sequential Arrangement Interface]")
scheduled_plates = schedule_ObjectsForSequentialPrint(solver_configuration,
printer_geometry,
objects_to_print,
[](int progress) { printf("Progress: %d\n", progress); });
[](int progress) { printf("Progress: %d\n", progress);
REQUIRE(progress >= 0);
REQUIRE(progress <= 100); });
printf("Object scheduling for sequential print SUCCESSFUL !\n");
printf("Number of plates: %ld\n", scheduled_plates.size());
REQUIRE(scheduled_plates.size() > 0);
for (unsigned int plate = 0; plate < scheduled_plates.size(); ++plate)
{
printf(" Number of objects on plate: %ld\n", scheduled_plates[plate].scheduled_objects.size());
REQUIRE(scheduled_plates[plate].scheduled_objects.size() > 0);
for (const auto& scheduled_object: scheduled_plates[plate].scheduled_objects)
{
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
cout << " ID: " << scheduled_object.id << " X: " << scheduled_object.x << " Y: " << scheduled_object.y << endl;
REQUIRE(scheduled_object.x >= 0);
REQUIRE(scheduled_object.x <= printer_geometry.x_size);
REQUIRE(scheduled_object.y >= 0);
REQUIRE(scheduled_object.y <= printer_geometry.y_size);
}
}
@ -470,6 +517,7 @@ TEST_CASE("Interface test 6", "[Sequential Arrangement Interface]")
scheduled_plates);
printf(" Scheduled/arranged objects are sequentially printable: %s\n", (printable ? "YES" : "NO"));
REQUIRE(printable);
printf("Checking sequential printability ... finished\n");