pub struct Schedule {
pub assignments: Vec<Assignment>,
pub violations: Vec<Violation>,
}Expand description
A complete schedule (solution to a scheduling problem).
Contains activity-resource-time assignments and any constraint violations.
Fields§
§assignments: Vec<Assignment>Activity assignments (activity → resource × time).
violations: Vec<Violation>Constraint violations detected in this schedule.
Implementations§
Source§impl Schedule
impl Schedule
Sourcepub fn add_assignment(&mut self, assignment: Assignment)
pub fn add_assignment(&mut self, assignment: Assignment)
Adds an assignment.
Sourcepub fn add_violation(&mut self, violation: Violation)
pub fn add_violation(&mut self, violation: Violation)
Adds a violation.
Sourcepub fn makespan_ms(&self) -> i64
pub fn makespan_ms(&self) -> i64
Makespan: latest end time across all assignments (ms).
Sourcepub fn assignment_for_activity(&self, activity_id: &str) -> Option<&Assignment>
pub fn assignment_for_activity(&self, activity_id: &str) -> Option<&Assignment>
Finds the assignment for a given activity.
Sourcepub fn assignments_for_task(&self, task_id: &str) -> Vec<&Assignment>
pub fn assignments_for_task(&self, task_id: &str) -> Vec<&Assignment>
Returns all assignments for a given task.
Sourcepub fn assignments_for_resource(&self, resource_id: &str) -> Vec<&Assignment>
pub fn assignments_for_resource(&self, resource_id: &str) -> Vec<&Assignment>
Returns all assignments for a given resource.
Sourcepub fn resource_utilization(
&self,
resource_id: &str,
horizon_ms: i64,
) -> Option<f64>
pub fn resource_utilization( &self, resource_id: &str, horizon_ms: i64, ) -> Option<f64>
Computes resource utilization: busy_time / horizon.
Returns None if horizon_ms is zero.
Sourcepub fn all_utilizations(&self) -> HashMap<String, f64>
pub fn all_utilizations(&self) -> HashMap<String, f64>
Computes utilization for all resources that have assignments.
Uses makespan as the horizon.
Sourcepub fn task_completion_time(&self, task_id: &str) -> Option<i64>
pub fn task_completion_time(&self, task_id: &str) -> Option<i64>
Completion time for a task (latest end of its assignments).
Sourcepub fn assignment_count(&self) -> usize
pub fn assignment_count(&self) -> usize
Number of assignments.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schedule
impl<'de> Deserialize<'de> for Schedule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Schedule
impl RefUnwindSafe for Schedule
impl Send for Schedule
impl Sync for Schedule
impl Unpin for Schedule
impl UnsafeUnpin for Schedule
impl UnwindSafe for Schedule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more