Skip to main content

Schedule

Struct Schedule 

Source
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

Source

pub fn new() -> Self

Creates an empty schedule.

Source

pub fn add_assignment(&mut self, assignment: Assignment)

Adds an assignment.

Source

pub fn add_violation(&mut self, violation: Violation)

Adds a violation.

Source

pub fn is_valid(&self) -> bool

Whether the schedule has no violations.

Source

pub fn makespan_ms(&self) -> i64

Makespan: latest end time across all assignments (ms).

Source

pub fn assignment_for_activity(&self, activity_id: &str) -> Option<&Assignment>

Finds the assignment for a given activity.

Source

pub fn assignments_for_task(&self, task_id: &str) -> Vec<&Assignment>

Returns all assignments for a given task.

Source

pub fn assignments_for_resource(&self, resource_id: &str) -> Vec<&Assignment>

Returns all assignments for a given resource.

Source

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.

Source

pub fn all_utilizations(&self) -> HashMap<String, f64>

Computes utilization for all resources that have assignments.

Uses makespan as the horizon.

Source

pub fn task_completion_time(&self, task_id: &str) -> Option<i64>

Completion time for a task (latest end of its assignments).

Source

pub fn assignment_count(&self) -> usize

Number of assignments.

Trait Implementations§

Source§

impl Clone for Schedule

Source§

fn clone(&self) -> Schedule

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schedule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Schedule

Source§

fn default() -> Schedule

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Schedule

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Schedule

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,