Class AbstractCCAHeuristic

java.lang.Object
  |
  +--AbstractCCAHeuristic
All Implemented Interfaces:
CCAHeuristic
Direct Known Subclasses:
CycleCountHeuristic, EdgeCostHeuristic

public abstract class AbstractCCAHeuristic
extends java.lang.Object
implements CCAHeuristic

This abstract class provides a skeleton implementation of the CCAHeuristic interface to minimize the effort to implement this interface.

Author:
Dries.VanDyck@rug.ac.be
See Also:
CCAHeuristic

Constructor Summary
AbstractCCAHeuristic()
          Constructs a new AbstractCCAHeuristic without a defined problem, a problem must be defined later by means of the setProblem method.
AbstractCCAHeuristic(Yutsis y)
          Constructs a new AbstractCCAHeuristic with given Yutsis object and corresponding CycleGenerator.
AbstractCCAHeuristic(Yutsis y, CycleGenerator cg)
          Constructs a new AbstractCCAHeuristic with given Yutsis object and corresponding CycleGenerator.
 
Method Summary
 Cycle bestCycle(int[] bestcycleedge)
          This function returns the best Cycle to reduce and fills the best edge to interchange out of the cycle (min length 4).
 Cycle bestCycle(int[] bestcycleedge, int[] besticnodes)
          This function returns the best Cycle to reduce and fills the best edge to interchange out of the cycle (min length 4) together with the best interchange nodes in a canonical way.
 int[] canonicalIC(int[] icedge, int[] icnodes)
          This method returns a canonical representation of the given interchange, without applying it.
 int[] canonicalIC(int[] icedge, int[] icnodes, int[] alticnodes)
          This method returns a canonical representation of the given interchange, without applying it.
 CycleGenerator cycleGenerator()
          Returns the CycleGenerator used by this CCAHeuristic.
 int[] interchangeNodes(Cycle bestcycle, int[] bestcycleedge)
          This method returns the nodes to be interchanged from the bestcycledge in order to reduce the bestcycle one unit in length and makes it canonical, without applying the interchange itself.
 Yutsis problem()
          Returns the problem considered.
 void setProblem(Yutsis y)
          Sets the Yutsis object for which operations must be choosen, a CycleGenerator will be constructed for the given Yutsis object.
 void setProblem(Yutsis y, CycleGenerator cg)
          Sets the Yutsis object defining for which operations must be choosen, together with the CycleGenerator delivering the relevant cycles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface CCAHeuristic
bestCycle
 

Constructor Detail

AbstractCCAHeuristic

public AbstractCCAHeuristic()
Constructs a new AbstractCCAHeuristic without a defined problem, a problem must be defined later by means of the setProblem method.

See Also:
setProblem(Yutsis)

AbstractCCAHeuristic

public AbstractCCAHeuristic(Yutsis y)
Constructs a new AbstractCCAHeuristic with given Yutsis object and corresponding CycleGenerator. Equivalent with the default constructor followed by a call to setProblem.

Parameters:
y - the Yutsis object for which an operation has to be chosen
See Also:
Yutsis, CycleGenerator

AbstractCCAHeuristic

public AbstractCCAHeuristic(Yutsis y,
                            CycleGenerator cg)
Constructs a new AbstractCCAHeuristic with given Yutsis object and corresponding CycleGenerator. Equivalent with the default constructor followed by a call to setProblem.

Parameters:
y - the Yutsis object for which an operation has to be chosen
cg - the cycle generator containing the relevant cycles of y
See Also:
Yutsis, CycleGenerator
Method Detail

setProblem

public void setProblem(Yutsis y)
Sets the Yutsis object for which operations must be choosen, a CycleGenerator will be constructed for the given Yutsis object.

Specified by:
setProblem in interface CCAHeuristic
Parameters:
y - the Yutsis object for an operation has to be chosen
See Also:
Yutsis, CycleGenerator

setProblem

public void setProblem(Yutsis y,
                       CycleGenerator cg)
Sets the Yutsis object defining for which operations must be choosen, together with the CycleGenerator delivering the relevant cycles.

Specified by:
setProblem in interface CCAHeuristic
Parameters:
y - the Yutsis object for which an operation has to be chosen
cg - the cycle generator containing the relevant cycles of y
See Also:
Yutsis, CycleGenerator

problem

public Yutsis problem()
Returns the problem considered.

Specified by:
problem in interface CCAHeuristic
Returns:
the Yutsis object defining the problem or null if no problem is defined.
See Also:
Yutsis

cycleGenerator

public CycleGenerator cycleGenerator()
Returns the CycleGenerator used by this CCAHeuristic.

Specified by:
cycleGenerator in interface CCAHeuristic
Returns:
the CycleGenerator used by the heuristic or null if no CycleGenerator is used.
See Also:
CycleGenerator

interchangeNodes

public int[] interchangeNodes(Cycle bestcycle,
                              int[] bestcycleedge)
This method returns the nodes to be interchanged from the bestcycledge in order to reduce the bestcycle one unit in length and makes it canonical, without applying the interchange itself. The canonical representation: take an edge (a.b) with adjacent edges (a,c), (a,d), (b,e), (b,f) then an IC a b c e is valid iff a < b && c < d.

Specified by:
interchangeNodes in interface CCAHeuristic
Parameters:
bestcycle - the Cycle to be reduced
bestcycleedge - the edge on which to apply the interchange
Returns:
the nodes to interchange of the edge bestcycleedge in order to reduce the cycle one unit in length.
See Also:
Cycle

canonicalIC

public int[] canonicalIC(int[] icedge,
                         int[] icnodes)
This method returns a canonical representation of the given interchange, without applying it. The used canonical representation: take an edge (a.b) with adjacent edges (a,c), (a,d), (b,e), (b,f) then an IC a b c e is valid iff a < b && c < d.

Specified by:
canonicalIC in interface CCAHeuristic
Parameters:
icedge - the nodes of the edge on which the interchange applies
icnodes - the nodes to be interchanged
Returns:
the nodes to interchange making the IC canonical

canonicalIC

public int[] canonicalIC(int[] icedge,
                         int[] icnodes,
                         int[] alticnodes)
This method returns a canonical representation of the given interchange, without applying it. The used canonical representation: take an edge (a.b) with adjacent edges (a,c), (a,d), (b,e), (b,f) then an IC a b c e is valid iff a < b && c < d.

Specified by:
canonicalIC in interface CCAHeuristic
Parameters:
icedge - the nodes of the edge on which the interchange applies
icnodes - the nodes to be interchanged
alticnodes - the alternative nodes to be interchanged yielding the same effect.
Returns:
the nodes to interchange making the IC canonical

bestCycle

public Cycle bestCycle(int[] bestcycleedge)
This function returns the best Cycle to reduce and fills the best edge to interchange out of the cycle (min length 4). It will use a CycleGenerator to generate all relevant cycles.

Specified by:
bestCycle in interface CCAHeuristic
Parameters:
bestcycleedge - array where the best edge to be interchanged out of the Cycle will be filled in
Returns:
the best Cycle

bestCycle

public Cycle bestCycle(int[] bestcycleedge,
                       int[] besticnodes)
This function returns the best Cycle to reduce and fills the best edge to interchange out of the cycle (min length 4) together with the best interchange nodes in a canonical way. It will use a CycleGenerator to generate all relevant cycles.

Specified by:
bestCycle in interface CCAHeuristic
Parameters:
bestcycleedge - array where the best edge to be interchanged out of the Cycle will be filled in
besticnodes - array where the best icnodes will be filled in
Returns:
the best Cycle
See Also:
CycleCostAlgorithm