Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ impl ListShadowRows {
cascade.open_changes += 1;
}

/// Refreshes one owner's list structure for a cascading move and inserts
/// the owner's row; element rows stay retracted until the move's last
/// owner is refreshed, when the cascading values are propagated and every
/// pending element is inserted once.
/// Retracts the owner's arrivals from no list, refreshes its list
/// structure for a cascading move and inserts the owner's row; element
/// rows stay retracted until the move's last owner is refreshed, when the
/// cascading values are propagated and every pending element is inserted
/// once.
pub(super) fn refresh_cascading_owner<S, C>(
&mut self,
solution: &mut S,
Expand All @@ -193,8 +194,8 @@ impl ListShadowRows {
C: RowDeltas<S, S::Score>,
{
let mut delta = S::Score::zero();
solution.update_list_structure_shadows(owner_descriptor, owner_index);
delta = delta + constraints.insert_row(solution, owner_index, owner_descriptor);
// The list already holds its arrivals; their structure shadows are
// rewritten only below, so their rows are retracted first.
if let Some((source, elements)) =
solution.list_shadow_elements(owner_descriptor, owner_index)
{
Expand Down Expand Up @@ -222,6 +223,8 @@ impl ListShadowRows {
}
}
}
solution.update_list_structure_shadows(owner_descriptor, owner_index);
delta = delta + constraints.insert_row(solution, owner_index, owner_descriptor);
let cascade = self
.cascade
.as_mut()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ type StartCost = IncrementalUniConstraint<
>;

// Each task costs its start, with its position and machine folded in so a
// stale previous pointer would also show; an unset start costs 1000.
// stale previous pointer would also show. An unset start costs 1000 in no
// list and 5000 on a machine (a dependency cycle), so a row retracted after
// its machine was written would also show.
fn start_cost() -> StartCost {
fn tasks(shop: &Shop) -> &[Task] {
&shop.tasks
Expand All @@ -174,6 +176,7 @@ fn start_cost() -> StartCost {
+ task.machine.map_or(0, |machine| machine as i64 + 1)
+ task.previous.map_or(0, |previous| previous as i64 * 100),
),
None if task.machine.is_some() => SoftScore::of(5000),
None => SoftScore::of(1000),
}
}
Expand Down
Loading