pub struct FlowShopScheduling { /* private fields */ }Expand description
The Flow Shop Scheduling problem.
Given m processors and a set of n jobs, each job j consists of m tasks
t_1[j], t_2[j], ..., t_m[j] with specified lengths. Tasks must be processed
in processor order: job j cannot start on machine i+1 until its task on
machine i is completed. The question is whether there exists a schedule such
that all jobs complete by deadline D.
§Representation
Configurations use Lehmer code encoding with dims() = [n, n-1, ..., 1].
A config [c_0, c_1, ..., c_{n-1}] where c_i < n - i is decoded by
maintaining a list of available jobs and picking the c_i-th element:
For 3 jobs, config [2, 0, 0]: available=[0,1,2], pick index 2 → job 2;
available=[0,1], pick index 0 → job 0; available=[1], pick index 0 → job 1.
Result: job order [2, 0, 1].
Given a job order, start times are determined greedily (as early as possible).
§Example
use problemreductions::models::misc::FlowShopScheduling;
use problemreductions::{Problem, Solver, BruteForce};
// 2 machines, 3 jobs, deadline 10
let problem = FlowShopScheduling::new(2, vec![vec![2, 3], vec![3, 2], vec![1, 4]], 10);
let solver = BruteForce::new();
let solution = solver.find_satisfying(&problem);
assert!(solution.is_some());Implementations§
Source§impl FlowShopScheduling
impl FlowShopScheduling
Sourcepub fn new(
num_processors: usize,
task_lengths: Vec<Vec<u64>>,
deadline: u64,
) -> Self
pub fn new( num_processors: usize, task_lengths: Vec<Vec<u64>>, deadline: u64, ) -> Self
Create a new Flow Shop Scheduling instance.
§Arguments
num_processors- Number of machines mtask_lengths- task_lengths[j][i] = processing time of job j on machine i. Each inner Vec must have lengthnum_processors.deadline- Global deadline D
§Panics
Panics if any job does not have exactly num_processors tasks.
Sourcepub fn num_processors(&self) -> usize
pub fn num_processors(&self) -> usize
Get the number of processors.
Sourcepub fn task_lengths(&self) -> &[Vec<u64>]
pub fn task_lengths(&self) -> &[Vec<u64>]
Get the task lengths matrix.
Sourcepub fn compute_makespan(&self, job_order: &[usize]) -> u64
pub fn compute_makespan(&self, job_order: &[usize]) -> u64
Compute the makespan for a given job ordering.
The job_order slice must be a permutation of 0..num_jobs.
Returns the completion time of the last job on the last machine.
Trait Implementations§
Source§impl Clone for FlowShopScheduling
impl Clone for FlowShopScheduling
Source§fn clone(&self) -> FlowShopScheduling
fn clone(&self) -> FlowShopScheduling
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FlowShopScheduling
impl Debug for FlowShopScheduling
Source§impl<'de> Deserialize<'de> for FlowShopScheduling
impl<'de> Deserialize<'de> for FlowShopScheduling
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>,
Source§impl Problem for FlowShopScheduling
impl Problem for FlowShopScheduling
Source§const NAME: &'static str = "FlowShopScheduling"
const NAME: &'static str = "FlowShopScheduling"
Source§fn variant() -> Vec<(&'static str, &'static str)>
fn variant() -> Vec<(&'static str, &'static str)>
Source§fn dims(&self) -> Vec<usize>
fn dims(&self) -> Vec<usize>
Source§fn num_variables(&self) -> usize
fn num_variables(&self) -> usize
Source§fn problem_type() -> ProblemType
fn problem_type() -> ProblemType
Source§impl Serialize for FlowShopScheduling
impl Serialize for FlowShopScheduling
impl DeclaredVariant for FlowShopScheduling
impl SatisfactionProblem for FlowShopScheduling
Auto Trait Implementations§
impl Freeze for FlowShopScheduling
impl RefUnwindSafe for FlowShopScheduling
impl Send for FlowShopScheduling
impl Sync for FlowShopScheduling
impl Unpin for FlowShopScheduling
impl UnsafeUnpin for FlowShopScheduling
impl UnwindSafe for FlowShopScheduling
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynProblem for T
impl<T> DynProblem for T
Source§fn evaluate_dyn(&self, config: &[usize]) -> String
fn evaluate_dyn(&self, config: &[usize]) -> String
Source§fn evaluate_json(&self, config: &[usize]) -> Value
fn evaluate_json(&self, config: &[usize]) -> Value
Source§fn serialize_json(&self) -> Value
fn serialize_json(&self) -> Value
Source§fn problem_name(&self) -> &'static str
fn problem_name(&self) -> &'static str
Problem::NAME).Source§fn num_variables_dyn(&self) -> usize
fn num_variables_dyn(&self) -> usize
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.