diff --git a/src/libseqarrange/include/libseqarrange/seq_interface.hpp b/src/libseqarrange/include/libseqarrange/seq_interface.hpp index e945cdfec8..f91f7f2cf8 100644 --- a/src/libseqarrange/include/libseqarrange/seq_interface.hpp +++ b/src/libseqarrange/include/libseqarrange/seq_interface.hpp @@ -89,6 +89,7 @@ struct SolverConfiguration struct ObjectToPrint { 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' */ coord_t total_height = 0; std::vector> pgns_at_height; diff --git a/src/libseqarrange/src/seq_sequential.cpp b/src/libseqarrange/src/seq_sequential.cpp index 13ed266f0a..08b0d93ba1 100644 --- a/src/libseqarrange/src/seq_sequential.cpp +++ b/src/libseqarrange/src/seq_sequential.cpp @@ -9730,7 +9730,6 @@ bool optimize_SubglobalSequentialPolygonNonoverlappingBinaryCentered(const Solve { 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) { 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 @@ -9899,10 +9898,10 @@ bool optimize_SubglobalSequentialPolygonNonoverlappingBinaryCentered(const Solve { #ifdef DEBUG { - printf("Remaining polygon: %d\n", curr_polygon + remaining_polygon); + printf("Remaining polygon: %d\n", curr_polygon + object_group_size - 1); } #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) @@ -9991,7 +9990,7 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So int total_objects, std::function progress_callback) { - vector undecided; + std::vector undecided; decided_polygons.clear(); remaining_polygons.clear(); @@ -10040,16 +10039,13 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So local_values_T[decided_polygons[i]] = dec_values_T[decided_polygons[i]]; } - 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); - undecided.clear(); - int remaining_polygon = 0; - - for (int i = object_group_size - 1; i >= 0; --i) + undecided.clear(); + for (int i = 0; i < object_group_size; ++i) { - undecided.push_back(curr_polygon + i + remaining_polygon); + undecided.push_back(curr_polygon + i); } #ifdef PROFILE @@ -10201,10 +10197,10 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So { #ifdef DEBUG { - printf("Remaining polygon: %d\n", curr_polygon + remaining_polygon); + printf("Remaining polygon: %d\n", curr_polygon + object_group_size - 1); } #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()); diff --git a/src/libseqarrange/src/seq_sequential.hpp b/src/libseqarrange/src/seq_sequential.hpp index 2bbbeed567..ed6572b812 100644 --- a/src/libseqarrange/src/seq_sequential.hpp +++ b/src/libseqarrange/src/seq_sequential.hpp @@ -58,6 +58,8 @@ const coord_t SEQ_SVG_SCALE_FACTOR = 50000; #define SEQ_Z3_SOLVER_TIMEOUT "8000" const int SEQ_GROUND_PRESENCE_TIME = 32; +const int SEQ_PROGRESS_RANGE = 100; + const int64_t SEQ_RATIONAL_PRECISION = 1000000; const double SEQ_DECIMATION_TOLERANCE = 400000.0; @@ -1551,9 +1553,13 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So std::vector &dec_values_T, const std::vector &polygons, const std::vector &unreachable_polygons, + const std::vector &previous_polygons, const std::vector &undecided_polygons, std::vector &decided_polygons, - std::vector &remaining_polygons); + std::vector &remaining_polygons, + int objects_done, + int total_objects, + std::function progress_callback = [](int progress){}); bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const SolverConfiguration &solver_configuration, std::vector &dec_values_X, @@ -1561,9 +1567,13 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So std::vector &dec_values_T, const std::vector &polygons, const std::vector > &unreachable_polygons, + const std::vector &previous_polygons, const std::vector &undecided_polygons, std::vector &decided_polygons, - std::vector &remaining_polygons); + std::vector &remaining_polygons, + int objects_done, + int total_objects, + std::function progress_callback = [](int progress){}); /*----------------------------------------------------------------*/