• All Implemented Interfaces:
`ConstructiveHeuristic<Permutation>`

```public final class WeightedCriticalRatioSetupAdjusted
extends WeightedShortestProcessingPlusSetupTime```

This is an implementation of a variation of the weighted critical ratio heuristic, adjusted to account for setup times for problems with sequence-dependent setups. The usual definition of this heuristic is: h(j) = (w[j]/p[j])(1/(1+S(j)/p[j])), where w[j] is the weight of job j, p[j] is its processing time, and S(j) is a calculation of the slack of job j where slack S(j) is d[j] - T - p[j] - s[i][j]. The d[j] is the job's due date, T is the current time, and s[i][j] is setup time of the job if it follows job i (for problems with setup times).

Historically, this heuristic has been criticized for allowing negative evaluations (i.e., slack S(j) is negative for jobs completing late). Additionally, this library's use of constructive heuristics is for stochastic sampling, for which we require positive heuristic values. Therefore, we have altered the definition as follows: h(j) = (w[j]/p[j])(1/(1+max(0,S(j))/p[j])).

Finally, to adjust for setup times, we replace p[j] wherever it appears with p[j]+s[i][j]. This leads to: h(j) = (w[j]/(p[j]+s[i][j]))(1/(1+max(0,S(j))/(p[j]+s[i][j]))).

Furthermore, the constant `MIN_H` defines the minimum value the heuristic will return, preventing h(j)=0 in support of stochastic sampling algorithms for which h(j)=0 is problematic. This implementation returns max( `MIN_H`, h(j)), where `MIN_H` is a small non-zero value.

• Field Summary

Fields
Modifier and Type Field Description
`static double` `MIN_H`
The minimum heuristic value.
• Constructor Summary

Constructors
Constructor Description
`WeightedCriticalRatioSetupAdjusted​(SingleMachineSchedulingProblem problem)`
• Method Summary

All Methods
Modifier and Type Method Description
`int` `completeLength()`
Gets the required length of complete solutions to the problem instance for which this constructive heuristic is configured.
`IncrementalEvaluation<Permutation>` `createIncrementalEvaluation()`
Creates an IncrementalEvaluation object corresponding to an initially empty Partial for use in incrementally constructing a solution to the problem for which this heuristic is designed.
`Partial<Permutation>` `createPartial​(int n)`
Creates an empty Partial solution, which will be incrementally transformed into a complete solution of a specified length.
`Problem<Permutation>` `getProblem()`
Gets a reference to the instance of the optimization problem that is the subject of this heuristic.
`double` ```h​(Partial<Permutation> p, int element, IncrementalEvaluation<Permutation> incEval)```
Heuristically evaluates the possible addition of an element to the end of a Partial.
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Field Detail

• MIN_H

`public static final double MIN_H`
The minimum heuristic value. If the heuristic value as calculated is lower than MIN_H, then MIN_H is used as the heuristic value. The reason is related to the primary purpose of the constructive heuristics in the library: heuristic guidance for stochastic sampling algorithms, which assume positive heuristic values (e.g., an h of 0 would be problematic).
Constant Field Values
• Constructor Detail

`public WeightedCriticalRatioSetupAdjusted​(SingleMachineSchedulingProblem problem)`
Parameters:
`problem` - The instance of a scheduling problem that is the target of the heuristic.
Throws:
`IllegalArgumentException` - if problem.hasDueDates() returns false.
• Method Detail

• h

```public double h​(Partial<Permutation> p,
int element,
IncrementalEvaluation<Permutation> incEval)```
Description copied from interface: `ConstructiveHeuristic`
Heuristically evaluates the possible addition of an element to the end of a Partial. Higher evaluations imply that the element is a better choice for the next element to add. For example, if you evaluate two elements, x and y, with h, and h returns a higher value for y than for x, then this means that y is believed to be the better choice according to the heuristic. Implementations of this interface must ensure that h always returns a positive result. This is because stochastic sampling algorithms such as HBSS and VBSS assume that the constructive heuristic returns only positive values.
Specified by:
`h` in interface `ConstructiveHeuristic<Permutation>`
Overrides:
`h` in class `WeightedShortestProcessingPlusSetupTime`
Parameters:
`p` - The current state of the Partial
`element` - The element under consideration for adding to the Partial
`incEval` - An IncrementalEvaluation of p. This method assumes that incEval is of the same runtime type as the object returned by `ConstructiveHeuristic.createIncrementalEvaluation()`.
Returns:
The heuristic evaluation of the hypothetical addition of element to the end of p. The higher the evaluation, the more important the heuristic believes that element should be added next. The intention is to compare the value returned with the heuristic evaluations of other elements. Individual results in isolation are not necessarily meaningful.
• getProblem

`public final Problem<Permutation> getProblem()`
Description copied from interface: `ConstructiveHeuristic`
Gets a reference to the instance of the optimization problem that is the subject of this heuristic.
Specified by:
`getProblem` in interface `ConstructiveHeuristic<Permutation>`
Returns:
the instance of the optimization problem that is the subject of this heuristic.
• createPartial

`public final Partial<Permutation> createPartial​(int n)`
Description copied from interface: `ConstructiveHeuristic`
Creates an empty Partial solution, which will be incrementally transformed into a complete solution of a specified length.
Specified by:
`createPartial` in interface `ConstructiveHeuristic<Permutation>`
Parameters:
`n` - the desired length of the final complete solution.
Returns:
an empty Partial solution
• completeLength

`public final int completeLength()`
Description copied from interface: `ConstructiveHeuristic`
Gets the required length of complete solutions to the problem instance for which this constructive heuristic is configured.
Specified by:
`completeLength` in interface `ConstructiveHeuristic<Permutation>`
Returns:
length of solutions to the problem instance for which this heuristic is configured