# Class ExponentialEarlyTardyHeuristic

java.lang.Object
org.cicirello.search.problems.scheduling.ExponentialEarlyTardyHeuristic
All Implemented Interfaces:
`ConstructiveHeuristic<Permutation>`

public final class ExponentialEarlyTardyHeuristic extends Object

This class implements a constructive heuristic, known as EXPET, for scheduling problems involving minimizing the sum of weighted earliness plus weighted tardiness. EXPET is an acronym for Exponential Early Tardy.

To define the EXPET heuristic, first let he[j] be the weighted longest processing time heuristic of job j, defined as he[j] = -we[j] / p[j], where we[j] is the earliness weight for job j, and p[j] is the processing time of job j. Next, let ht[j] be the weighted shortest processing time heuristic of job j, defined as ht[j] = wt[j] / p[j], where wt[j] is the tardiness weight of job j. Define the slack s[j] of job j as: s[j] = d[j] - T - p[j], where d[j] is the job's due date and T is the current time. Let k ≥ 1 be a lookahead parameter that can be tuned based on problem instance characteristics, and p̄ is the average processing time of remaining unscheduled jobs.

Now we can define the EXPET heuristic, h[j] for job j, as follows. Case 1: If s[j] ≤ 0, h[j] = ht[j]. Case 2: if s[j] ≥ k*p̄, h[j] = he[j]. Case 3: If 0 < s[j] ≤ k*p̄*ht[j]/(ht[j]-he[j]), then h[j] = ht[j] * exp((s[j](ht[j]-he[j]))/(he[j]*k*p̄)). Case 4: If k*p̄*ht[j]/(ht[j]-he[j]) < s[j] < k*p̄, then h[j] = he[j]-2 * (ht[j] - s[j](ht[j]-he[j])/(k*p̄))3. For jobs with negative slack, the EXPET heuristic is equivalent to weighted shortest processing time. For jobs with slack greater than some multiple k of the average processing time, EXPET is equivalent to weighted longest processing time.

We make one additional adjustment to the heuristic as it was originally described. Since this library's implementations of stochastic sampling algorithms assumes that constructive heuristics always produce positive values, we must adjust the values produced by the EXPET heuristic. Specifically, we actually compute h'[j] = h[j] + shift, where shift = `MIN_H` - min(we[j] / p[j]). The `MIN_H` is a small non-zero value. In this way, we shift all of the h[j] values by a constant amount such that all h[j] values are positive.

• ## Field Summary

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

Constructors
Constructor
Description
`ExponentialEarlyTardyHeuristic(SingleMachineSchedulingProblem problem)`
Constructs a ExponentialEarlyTardyHeuristic heuristic.
```ExponentialEarlyTardyHeuristic(SingleMachineSchedulingProblem problem, double k)```
Constructs a ExponentialEarlyTardyHeuristic heuristic.
• ## Method Summary

Modifier and Type
Method
Description
`final 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.
`final Partial<Permutation>`
`createPartial(int n)`
Creates an empty Partial solution, which will be incrementally transformed into a complete solution of a specified length.
`final 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 Details

• ### 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).
• ## Constructor Details

• ### ExponentialEarlyTardyHeuristic

public ExponentialEarlyTardyHeuristic(SingleMachineSchedulingProblem problem)
Constructs a ExponentialEarlyTardyHeuristic heuristic. Uses a default value of k=1.
Parameters:
`problem` - The instance of a scheduling problem that is the target of the heuristic.
• ### ExponentialEarlyTardyHeuristic

public ExponentialEarlyTardyHeuristic(SingleMachineSchedulingProblem problem, double k)
Constructs a ExponentialEarlyTardyHeuristic heuristic.
Parameters:
`problem` - The instance of a scheduling problem that is the target of the heuristic.
`k` - A parameter of the heuristic (see class documentation). Must be at least 1.
Throws:
`IllegalArgumentException` - if k < 1.
• ## Method Details

• ### 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.
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.
• ### createIncrementalEvaluation

public  createIncrementalEvaluation()
Description copied from interface: `ConstructiveHeuristic`

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. The object returned incrementally computes any data associated with a Partial as needed by the `ConstructiveHeuristic.h(org.cicirello.search.ss.Partial<T>, int, org.cicirello.search.ss.IncrementalEvaluation<T>)` method. The `ConstructiveHeuristic.h(org.cicirello.search.ss.Partial<T>, int, org.cicirello.search.ss.IncrementalEvaluation<T>)` method will assume that it will be given an object of the specific runtime type returned by this method. It is unsafe to pass IncrementalEvaluation objects created by one heuristic to the `ConstructiveHeuristic.h(org.cicirello.search.ss.Partial<T>, int, org.cicirello.search.ss.IncrementalEvaluation<T>)` method of another.

The default implementation simply returns null, which is appropriate for heuristics that won't benefit from incrementally computing heuristic information.

Returns:
An IncrementalEvaluation for an empty Partial to be used for incrementally computing any data required by the `ConstructiveHeuristic.h(org.cicirello.search.ss.Partial<T>, int, org.cicirello.search.ss.IncrementalEvaluation<T>)` method.
• ### getProblem

public final  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  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