mil.af.afit.uvr
Class HSolver

java.lang.Object
  |
  +--mil.af.afit.uvr.HSolver
Direct Known Subclasses:
SolomonConstructionSolver, TS4UVRSolver

public abstract class HSolver
extends java.lang.Object

HSolvers take the information given to the HEngine and try to solve the problem of servicing orders with vehicles. Solvers have access to a list of good starting solutions generated by a heuristic developed by Gary Kinney at the Air Force Institute of Technology (www.afit.af.mil).

Since:
1.0
See Also:
HOrder, HVehicle

Constructor Summary
HSolver()
           
 
Method Summary
 void addHSolverListener(mil.af.afit.uvr.HSolverListener listener)
          Add a listener to the solver.
 void fireNewBestSolutionEvent()
          This method should be called when a new best solution is found.
 void fireSolverFinishedEvent()
          This method should be called when the solver has finished working.
 void fireSolverPercentDoneEvent()
          This method should be called periodically to keep the user up to date on the solver's progress.
 void fireSolverStartedEvent()
          This should be called when the solver starts solving.
abstract  HSolution getBestHSolution()
          Return the best solution found so far.
abstract  java.lang.String getCredits()
          Credits for the solver (authors, etc).
abstract  java.lang.String getLongDescription()
          Long description of the solver.
abstract  java.lang.String getName()
          Name of the solver
 float getPercentDone()
          Return the percent done for the solver, between zero and one.
abstract  java.lang.String getShortDescription()
          Short description of the solver.
abstract  java.lang.String getVersion()
          Version of the solver
abstract  void initializeSolver(HSolution[] solutions, HEvaluator evaluator, double requestedSolutionEffort, int numberOfThreads)
          Called when the HEngine has started solving.
 void removeHSolverListener(mil.af.afit.uvr.HSolverListener listener)
          Remove a listener from the solver.
abstract  boolean requestsStartingSolutions()
          If true, the HEngine will generate a list of good starting solutions based on a heuristic developed by Gary Kinney for the Air Force Institute of Technology (www.afit.af.mil).
 void setPercentDone(float percentDone)
          Call to set the percent done for the solver, between zero and one.
abstract  void startSolving()
          Called when the HEngine is ready for the solver to start.
abstract  void stopSolving()
          Stop the solver as soon as possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HSolver

public HSolver()
Method Detail

getName

public abstract java.lang.String getName()
Name of the solver
Returns:
name of the solver
Since:
1.0

getShortDescription

public abstract java.lang.String getShortDescription()
Short description of the solver. May be used for tooltips
Returns:
short decription of the solver
Since:
1.0

getLongDescription

public abstract java.lang.String getLongDescription()
Long description of the solver.
Returns:
long decription of the solver
Since:
1.0

getCredits

public abstract java.lang.String getCredits()
Credits for the solver (authors, etc).
Returns:
credits for the solver
Since:
1.0

getVersion

public abstract java.lang.String getVersion()
Version of the solver
Returns:
version of the solver
Since:
1.0

stopSolving

public abstract void stopSolving()
Stop the solver as soon as possible. Be sure to call fireSolverFinishedEvent.
Since:
1.0
See Also:
HSolverEvent

requestsStartingSolutions

public abstract boolean requestsStartingSolutions()
If true, the HEngine will generate a list of good starting solutions based on a heuristic developed by Gary Kinney for the Air Force Institute of Technology (www.afit.af.mil).
Returns:
whether or not the solver would like starting solutions
Since:
1.0
See Also:
HEngine

initializeSolver

public abstract void initializeSolver(HSolution[] solutions,
                                      HEvaluator evaluator,
                                      double requestedSolutionEffort,
                                      int numberOfThreads)
Called when the HEngine has started solving. The solutions array will either be the starting solutions, if requested, or a single solution with all orders in the dummy tour.
Parameters:
solutions - starting solution(s)
evaluator - evaluator to use with the solutions
requestedSolutionEffort - effort requested by the user in the range of zero to one
numberOfThreads - suggested number of threads to use
Since:
1.0
See Also:
HSolution, HEvaluator

startSolving

public abstract void startSolving()
Called when the HEngine is ready for the solver to start. It is not necessary to return immediate control because the method is called from within a thread dedicated to calling this method.
Since:
1.0

getBestHSolution

public abstract HSolution getBestHSolution()
Return the best solution found so far.
Returns:
the best solution
Since:
1.0
See Also:
HSolution

setPercentDone

public final void setPercentDone(float percentDone)
Call to set the percent done for the solver, between zero and one.
Parameters:
percentDone - percent done, between zero and one
Since:
1.0

getPercentDone

public final float getPercentDone()
Return the percent done for the solver, between zero and one.
Returns:
percent done
Since:
1.0

addHSolverListener

public final void addHSolverListener(mil.af.afit.uvr.HSolverListener listener)
Add a listener to the solver. This listener will be notified when solver events happen.
Parameters:
listener - the listener to notify of solver events
Since:
1.0
See Also:
HSolverListener, HSolverEvent

removeHSolverListener

public final void removeHSolverListener(mil.af.afit.uvr.HSolverListener listener)
Remove a listener from the solver. This listener will no longer be notified when solver events happen.
Parameters:
listener - the listener which will no longer receive solver events
Since:
1.0
See Also:
HSolverListener, HSolverEvent

fireSolverStartedEvent

public final void fireSolverStartedEvent()
This should be called when the solver starts solving. Interested objects will be notified that the solver has started
Since:
1.0
See Also:
HSolverListener, HSolverEvent

fireSolverFinishedEvent

public final void fireSolverFinishedEvent()
This method should be called when the solver has finished working. Interested objects, mainly the UVR engine, will be notified that the solver has finished.
Since:
1.0
See Also:
HSolverListener, HSolverEvent

fireSolverPercentDoneEvent

public final void fireSolverPercentDoneEvent()
This method should be called periodically to keep the user up to date on the solver's progress.
Parameters:
percentDone - percent completed
Since:
1.0
See Also:
HSolverListener, HSolverEvent

fireNewBestSolutionEvent

public final void fireNewBestSolutionEvent()
This method should be called when a new best solution is found.
Parameters:
percentDone - percent completed
Since:
1.0
See Also:
HSolverListener, HSolverEvent