Interface preparation for passing object instances.

This commit is contained in:
surynek 2024-10-17 13:11:08 +02:00 committed by Lukas Matena
parent a651173be1
commit 7cd23ab3e7
3 changed files with 24 additions and 17 deletions

View File

@ -89,6 +89,7 @@ struct SolverConfiguration
struct ObjectToPrint struct ObjectToPrint
{ {
int id = 0; int id = 0;
bool lepox = false; /* object must be scheduled right after the previous object */
int previous_id = -1; /* object 'id' will be scheduled right after object 'previous_id' */ int previous_id = -1; /* object 'id' will be scheduled right after object 'previous_id' */
coord_t total_height = 0; coord_t total_height = 0;
std::vector<std::pair<coord_t, Slic3r::Polygon>> pgns_at_height; std::vector<std::pair<coord_t, Slic3r::Polygon>> pgns_at_height;

View File

@ -9730,7 +9730,6 @@ bool optimize_SubglobalSequentialPolygonNonoverlappingBinaryCentered(const Solve
{ {
bool optimized = false; bool optimized = false;
int remaining_polygon = 0;
for(int object_group_size = MIN((unsigned int)solver_configuration.object_group_size, polygons.size() - curr_polygon); object_group_size > 0; --object_group_size) for(int object_group_size = MIN((unsigned int)solver_configuration.object_group_size, polygons.size() - curr_polygon); object_group_size > 0; --object_group_size)
{ {
z3::set_param("timeout", solver_configuration.optimization_timeout.c_str()); z3::set_param("timeout", solver_configuration.optimization_timeout.c_str());
@ -9778,9 +9777,9 @@ bool optimize_SubglobalSequentialPolygonNonoverlappingBinaryCentered(const Solve
} }
*/ */
for (int i = object_group_size - 1; i >= 0; --i) for (int i = 0; i < object_group_size; ++i)
{ {
undecided.push_back(curr_polygon + i + remaining_polygon); undecided.push_back(curr_polygon + i);
} }
#ifdef DEBUG #ifdef DEBUG
@ -9899,10 +9898,10 @@ bool optimize_SubglobalSequentialPolygonNonoverlappingBinaryCentered(const Solve
{ {
#ifdef DEBUG #ifdef DEBUG
{ {
printf("Remaining polygon: %d\n", curr_polygon + remaining_polygon); printf("Remaining polygon: %d\n", curr_polygon + object_group_size - 1);
} }
#endif #endif
remaining_polygons.push_back(undecided_polygons[curr_polygon + remaining_polygon++]); remaining_polygons.push_back(undecided_polygons[curr_polygon + object_group_size - 1]);
} }
} }
if (!optimized) if (!optimized)
@ -9991,7 +9990,7 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
int total_objects, int total_objects,
std::function<void(int)> progress_callback) std::function<void(int)> progress_callback)
{ {
vector<int> undecided; std::vector<int> undecided;
decided_polygons.clear(); decided_polygons.clear();
remaining_polygons.clear(); remaining_polygons.clear();
@ -10041,15 +10040,12 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
} }
string_map dec_var_names_map; string_map dec_var_names_map;
int object_group_size = MIN((unsigned int)solver_configuration.object_group_size, polygons.size() - curr_polygon); int object_group_size = MIN((unsigned int)solver_configuration.object_group_size, polygons.size() - curr_polygon);
undecided.clear(); undecided.clear();
int remaining_polygon = 0; for (int i = 0; i < object_group_size; ++i)
for (int i = object_group_size - 1; i >= 0; --i)
{ {
undecided.push_back(curr_polygon + i + remaining_polygon); undecided.push_back(curr_polygon + i);
} }
#ifdef PROFILE #ifdef PROFILE
@ -10201,10 +10197,10 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
{ {
#ifdef DEBUG #ifdef DEBUG
{ {
printf("Remaining polygon: %d\n", curr_polygon + remaining_polygon); printf("Remaining polygon: %d\n", curr_polygon + object_group_size - 1);
} }
#endif #endif
remaining_polygons.push_back(undecided_polygons[curr_polygon + remaining_polygon++]); remaining_polygons.push_back(undecided_polygons[curr_polygon + object_group_size - 1]);
} }
missing.push_back(undecided.back()); missing.push_back(undecided.back());

View File

@ -58,6 +58,8 @@ const coord_t SEQ_SVG_SCALE_FACTOR = 50000;
#define SEQ_Z3_SOLVER_TIMEOUT "8000" #define SEQ_Z3_SOLVER_TIMEOUT "8000"
const int SEQ_GROUND_PRESENCE_TIME = 32; const int SEQ_GROUND_PRESENCE_TIME = 32;
const int SEQ_PROGRESS_RANGE = 100;
const int64_t SEQ_RATIONAL_PRECISION = 1000000; const int64_t SEQ_RATIONAL_PRECISION = 1000000;
const double SEQ_DECIMATION_TOLERANCE = 400000.0; const double SEQ_DECIMATION_TOLERANCE = 400000.0;
@ -1551,9 +1553,13 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
std::vector<Rational> &dec_values_T, std::vector<Rational> &dec_values_T,
const std::vector<Slic3r::Polygon> &polygons, const std::vector<Slic3r::Polygon> &polygons,
const std::vector<Slic3r::Polygon> &unreachable_polygons, const std::vector<Slic3r::Polygon> &unreachable_polygons,
const std::vector<int> &previous_polygons,
const std::vector<int> &undecided_polygons, const std::vector<int> &undecided_polygons,
std::vector<int> &decided_polygons, std::vector<int> &decided_polygons,
std::vector<int> &remaining_polygons); std::vector<int> &remaining_polygons,
int objects_done,
int total_objects,
std::function<void(int)> progress_callback = [](int progress){});
bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const SolverConfiguration &solver_configuration, bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const SolverConfiguration &solver_configuration,
std::vector<Rational> &dec_values_X, std::vector<Rational> &dec_values_X,
@ -1561,9 +1567,13 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
std::vector<Rational> &dec_values_T, std::vector<Rational> &dec_values_T,
const std::vector<Slic3r::Polygon> &polygons, const std::vector<Slic3r::Polygon> &polygons,
const std::vector<std::vector<Slic3r::Polygon> > &unreachable_polygons, const std::vector<std::vector<Slic3r::Polygon> > &unreachable_polygons,
const std::vector<int> &previous_polygons,
const std::vector<int> &undecided_polygons, const std::vector<int> &undecided_polygons,
std::vector<int> &decided_polygons, std::vector<int> &decided_polygons,
std::vector<int> &remaining_polygons); std::vector<int> &remaining_polygons,
int objects_done,
int total_objects,
std::function<void(int)> progress_callback = [](int progress){});
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/