Class MSCTProblem
The MSCT problem consists in scheduling a set of jobs on a single machine
to minimize the total completion time (or sum of finishing times).
Each job j has:
- a release date
release[j]— the earliest time the job can start, - a processing time
processing[j]— the duration required to complete the job.
minimize ∑ C_j
subject to start_j ≥ release_j
start_j + processing_j = C_j
machine processes only one job at a time
This class implements the Problem interface to be used by generic optimization
solvers (A*, ACS, DDO, etc.) from the decision diagram framework.
Multiple constructors are provided to:
- Load a problem instance from a text file,
- Manually provide release and processing times,
- Randomly generate a synthetic instance for testing.
Expected file format:
- The first line contains the number of jobs, optionally followed by the known optimal value.
- Each of the next
nlines contains two integers: the release time and processing time of each job. - Example:
5 215.0 0 3 1 2 2 1 0 4 3 2
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMSCTProblem(int n) Constructs a randomly generated MSCT problem instance for testing purposes.MSCTProblem(int[] release, int[] processing) Constructs an MSCT problem from explicit arrays of release and processing times, without specifying an optimal value.MSCTProblem(int[] release, int[] processing, Optional<Double> optimal) Constructs an MSCT problem from explicit arrays of release and processing times, with an optional known optimal value.MSCTProblem(String fname) Constructs an MSCT problem by reading data from a text file. -
Method Summary
Modifier and TypeMethodDescriptionReturns the domain of possible decisions at the current state.doubleevaluate(int[] solution) Given a solution such thatsolution[i]is the value of the variablex_i, returns the value of this solution and checks if the solution respects the problem's constraints.Returns the initial state of the problem, where all jobs are unscheduled.doubleReturns the initial cost value of the problem (always 0 at the start).intnbVars()Returns the number of jobs in this instance.Returns the known optimal value of this instance, if available.toString()Returns a string representation of this MSCT instance for debugging purposes.transition(MSCTState state, Decision decision) Computes the next state resulting from scheduling a given job.doubletransitionCost(MSCTState state, Decision decision) Returns the cost of scheduling a given job from the current state.
-
Constructor Details
-
MSCTProblem
Constructs an MSCT problem from explicit arrays of release and processing times, with an optional known optimal value.- Parameters:
release- an array of release times for each job.processing- an array of processing times for each job.optimal- anOptionalcontaining the known optimal solution value.
-
MSCTProblem
public MSCTProblem(int[] release, int[] processing) Constructs an MSCT problem from explicit arrays of release and processing times, without specifying an optimal value.- Parameters:
release- an array of release times for each job.processing- an array of processing times for each job.
-
MSCTProblem
Constructs an MSCT problem by reading data from a text file.The file must contain the number of jobs, optionally followed by the optimal value, and then one line per job with its release and processing times.
- Parameters:
fname- the path to the file containing the problem instance.- Throws:
IOException- if an error occurs while reading the file.
-
MSCTProblem
public MSCTProblem(int n) Constructs a randomly generated MSCT problem instance for testing purposes.- Parameters:
n- the number of jobs to generate.
-
-
Method Details
-
nbVars
public int nbVars()Returns the number of jobs in this instance. -
initialState
Returns the initial state of the problem, where all jobs are unscheduled.- Specified by:
initialStatein interfaceProblem<MSCTState>- Returns:
- an
MSCTStaterepresenting all jobs remaining and current time = 0.
-
initialValue
public double initialValue()Returns the initial cost value of the problem (always 0 at the start).- Specified by:
initialValuein interfaceProblem<MSCTState>- Returns:
- 0.0
-
domain
Returns the domain of possible decisions at the current state.The domain corresponds to the indices of remaining jobs that can still be scheduled.
-
transition
Computes the next state resulting from scheduling a given job.- Specified by:
transitionin interfaceProblem<MSCTState>- Parameters:
state- the current scheduling state.decision- the decision representing the next job to schedule.- Returns:
- a new
MSCTStatereflecting the updated remaining jobs and current time.
-
transitionCost
Returns the cost of scheduling a given job from the current state.The cost corresponds to the completion time of the scheduled job.
- Specified by:
transitionCostin interfaceProblem<MSCTState>- Parameters:
state- the current scheduling state.decision- the decision representing the next job to schedule.- Returns:
- the completion time of the selected job.
-
optimalValue
Returns the known optimal value of this instance, if available.- Specified by:
optimalValuein interfaceProblem<MSCTState>- Returns:
- the negated optimal value wrapped in an
Optional, or empty if unknown.
-
evaluate
Description copied from interface:ProblemGiven a solution such thatsolution[i]is the value of the variablex_i, returns the value of this solution and checks if the solution respects the problem's constraints.Note: For maximization problems, the returned value is minus the computed value.
- Specified by:
evaluatein interfaceProblem<MSCTState>- Parameters:
solution- A solution of the problem.- Returns:
- The value of the input solution
- Throws:
InvalidSolutionException- If the solution does not respect problem's constraints.
-
toString
Returns a string representation of this MSCT instance for debugging purposes.
-