mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 09:19:04 +08:00
Bug fix of sequential scheduling for many object instances (without the new wipe tower code) (SPE-2722)
This commit is contained in:
parent
5aca536459
commit
774137a602
@ -522,7 +522,7 @@ void introduce_ConsequentialTemporalLepoxAgainstFixed(z3::solver
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//Solver.add(dec_vars_T[undecided[i]] + temporal_spread < dec_vars_T[next_i] && dec_vars_T[undecided[i]] + temporal_spread + temporal_spread / 2 > dec_vars_T[next_i]);
|
//Solver.add(dec_vars_T[undecided[i]] + temporal_spread < dec_vars_T[next_i] && dec_vars_T[undecided[i]] + temporal_spread + temporal_spread / 2 > dec_vars_T[next_i]);
|
||||||
Solver.add((dec_vars_T[undecided[i]] < 0 || dec_vars_T[next_i] < 0) || dec_vars_T[undecided[i]] + temporal_spread < dec_vars_T[next_i] && dec_vars_T[undecided[i]] + temporal_spread + temporal_spread / 2 > dec_vars_T[next_i]);
|
Solver.add((dec_vars_T[undecided[i]] < 0 || dec_vars_T[next_i] < 0) || (dec_vars_T[undecided[i]] + temporal_spread < dec_vars_T[next_i] && dec_vars_T[undecided[i]] + temporal_spread + temporal_spread / 2 > dec_vars_T[next_i]));
|
||||||
}
|
}
|
||||||
/* Undecided --> missing */
|
/* Undecided --> missing */
|
||||||
else
|
else
|
||||||
@ -11371,9 +11371,9 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
|
|||||||
int progress_total_object_phases,
|
int progress_total_object_phases,
|
||||||
std::function<void(int)> progress_callback)
|
std::function<void(int)> progress_callback)
|
||||||
{
|
{
|
||||||
std::vector<int> undecided;
|
std::vector<int> undecided;
|
||||||
|
|
||||||
decided_polygons.clear();
|
decided_polygons.clear();
|
||||||
|
|
||||||
remaining_polygons.clear();
|
remaining_polygons.clear();
|
||||||
|
|
||||||
dec_values_X.resize(solvable_objects.size());
|
dec_values_X.resize(solvable_objects.size());
|
||||||
@ -11419,9 +11419,10 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
|
|||||||
unreachable_polygons.push_back(solvable_object.unreachable_polygons);
|
unreachable_polygons.push_back(solvable_object.unreachable_polygons);
|
||||||
lepox_to_next.push_back(solvable_object.lepox_to_next);
|
lepox_to_next.push_back(solvable_object.lepox_to_next);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int curr_polygon = 0; curr_polygon < solvable_objects.size(); /* nothing */)
|
unsigned int curr_polygon;
|
||||||
{
|
for (curr_polygon = 0; curr_polygon < solvable_objects.size(); /* nothing */)
|
||||||
|
{
|
||||||
bool optimized = false;
|
bool optimized = false;
|
||||||
z3::set_param("timeout", solver_configuration.optimization_timeout.c_str());
|
z3::set_param("timeout", solver_configuration.optimization_timeout.c_str());
|
||||||
|
|
||||||
@ -11500,13 +11501,13 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
|
|||||||
polygons,
|
polygons,
|
||||||
lepox_to_next,
|
lepox_to_next,
|
||||||
trans_bed_lepox);
|
trans_bed_lepox);
|
||||||
std::vector<int> missing;
|
|
||||||
std::vector<int> remaining_local;
|
std::vector<int> remaining_local;
|
||||||
|
|
||||||
while(object_group_size > 0)
|
while(object_group_size > 0)
|
||||||
{
|
{
|
||||||
z3::expr_vector presence_assumptions(z_context);
|
z3::expr_vector presence_assumptions(z_context);
|
||||||
assume_ConsequentialObjectPresence(z_context, local_dec_vars_T, undecided, missing, presence_assumptions);
|
assume_ConsequentialObjectPresence(z_context, local_dec_vars_T, undecided, remaining_local, presence_assumptions);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
@ -11630,7 +11631,7 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
|
|||||||
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
|
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
curr_polygon += solver_configuration.object_group_size;
|
curr_polygon += object_group_size;
|
||||||
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
|
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -11646,18 +11647,30 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
|
|||||||
++progress_object_phases_done;
|
++progress_object_phases_done;
|
||||||
}
|
}
|
||||||
remaining_local.push_back(undecided.back());
|
remaining_local.push_back(undecided.back());
|
||||||
}
|
undecided.pop_back();
|
||||||
missing.push_back(undecided.back());
|
|
||||||
undecided.pop_back();
|
|
||||||
|
|
||||||
--object_group_size;
|
--object_group_size;
|
||||||
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
|
progress_callback((SEQ_PROGRESS_RANGE * progress_object_phases_done) / progress_total_object_phases);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::reverse(remaining_local.begin(), remaining_local.end());
|
std::reverse(remaining_local.begin(), remaining_local.end());
|
||||||
remaining_polygons.insert(remaining_polygons.end(), remaining_local.begin(), remaining_local.end());
|
remaining_polygons.insert(remaining_polygons.end(), remaining_local.begin(), remaining_local.end());
|
||||||
|
|
||||||
if (!optimized)
|
if (optimized)
|
||||||
|
{
|
||||||
|
if (object_group_size < solver_configuration.object_group_size)
|
||||||
|
{
|
||||||
|
int group_size_diff = solver_configuration.object_group_size - object_group_size;
|
||||||
|
if (curr_polygon + group_size_diff < solvable_objects.size())
|
||||||
|
{
|
||||||
|
curr_polygon += group_size_diff;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (curr_polygon <= 0)
|
if (curr_polygon <= 0)
|
||||||
{
|
{
|
||||||
@ -11668,17 +11681,24 @@ bool optimize_SubglobalConsequentialPolygonNonoverlappingBinaryCentered(const So
|
|||||||
if (curr_polygon + solver_configuration.object_group_size < solvable_objects.size())
|
if (curr_polygon + solver_configuration.object_group_size < solvable_objects.size())
|
||||||
{
|
{
|
||||||
curr_polygon += solver_configuration.object_group_size;
|
curr_polygon += solver_configuration.object_group_size;
|
||||||
|
break;
|
||||||
for (; curr_polygon < solvable_objects.size(); ++curr_polygon)
|
|
||||||
{
|
|
||||||
remaining_polygons.push_back(curr_polygon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(remaining_polygons.empty());
|
for (; curr_polygon < solvable_objects.size(); ++curr_polygon)
|
||||||
|
{
|
||||||
|
remaining_polygons.push_back(curr_polygon);
|
||||||
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < remaining_polygons.size(); ++i)
|
||||||
|
{
|
||||||
|
printf("Remaining: %d\n", remaining_polygons[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user