JOpt.SDK.Implementation
Class Optimization

java.lang.Object
  extended byjava.lang.Thread
      extended byJOpt.SDK.Implementation.Optimization
All Implemented Interfaces:
IOptimization, java.lang.Runnable

public class Optimization
extends java.lang.Thread
implements IOptimization, java.lang.Runnable


Nested Class Summary
 class Optimization.WorkerThread
           
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Optimization()
           
 
Method Summary
 void addDistanceMatrix(double[][] matrix)
           
 void addElement(INode node)
          add a node to the current optimization.
 void addElement(IResource resource)
          add a resource to the current optimization.
 void addElement(IRoute route)
           
 void addElement(java.util.Properties properties)
          add a property to the current optimization.
 void addTimeMatrix(double[][] matrix)
           
 IRoute checkAppointment(INode appointment)
          ckecks a desired appointment against the current optimization.
 java.lang.String getLicence()
           
 double[][] getMatrix()
           
 double[][] getTimeMatrix()
           
 IRoute insertAppointment(INode appointment)
          inserts a desired appointment into the current optimization.
 void onAsynchronousOptimizationResult(IOptimizationResult result)
          called after the optimization has been finished according to the defined terminating condition
 void onProgress(double progress)
          called each time when one percentage of the optimization is done
 void onProgress(double progress, double totaldistance, double costfunction)
          called each time when one percentage of the optimization is done
 void onProgress(double progress, double totaldistance1, double costfunction1, double totaldistance2, double costfunction2)
           
 void run()
           
 void setLicence(java.lang.String licence)
           
 void startAsynchronousOptimizationRun()
          starts a new optimization background process for all added elements, destroys all previous results
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Optimization

public Optimization()
Method Detail

addElement

public void addElement(java.util.Properties properties)
Description copied from interface: IOptimization
add a property to the current optimization.
JOptExitCondition.Type {JOptGenerationCount,JOptCostConvergency...}
JOptExitCondition.JOptGenerationCount [1,MAX_INT]
JOptWeight.TotalDistance [0.0,10.0]
JOptWeight.RouteDistance [0.0,10.0]
JOptWeight.ResourceActive [0.0,10.0]
JOptWeight.NodeType [0.0,10.0]
JOptWeight.TimeWindow [0.0,10.0]

Specified by:
addElement in interface IOptimization
Parameters:
properties - a property to define the optimization's behaviour

addElement

public void addElement(IResource resource)
Description copied from interface: IOptimization
add a resource to the current optimization.

Specified by:
addElement in interface IOptimization
Parameters:
resource - a resource to perform the optimization's schedule

addElement

public void addElement(INode node)
Description copied from interface: IOptimization
add a node to the current optimization.

Specified by:
addElement in interface IOptimization
Parameters:
node - a node to be visited within the schedule

addElement

public void addElement(IRoute route)

checkAppointment

public IRoute checkAppointment(INode appointment)
Description copied from interface: IOptimization
ckecks a desired appointment against the current optimization. If the appointment can be realized a route is returned. To insert the appointment use insertAppointment

Specified by:
checkAppointment in interface IOptimization
Parameters:
appointment - a node with a time window
Returns:
a route containing the appointment or null if the appointment cannot be relaized within the exisisting optimization

insertAppointment

public IRoute insertAppointment(INode appointment)
Description copied from interface: IOptimization
inserts a desired appointment into the current optimization. If the appointment can be inserted a route is returned.

Specified by:
insertAppointment in interface IOptimization
Parameters:
appointment - a node with a time window
Returns:
a route containing the appointment or null if the appointment cannot be inserted within the exisisting optimization

startAsynchronousOptimizationRun

public void startAsynchronousOptimizationRun()
                                      throws JOpt.Licence.LicenceNotFoundException
Description copied from interface: IOptimization
starts a new optimization background process for all added elements, destroys all previous results

Specified by:
startAsynchronousOptimizationRun in interface IOptimization
Throws:
JOpt.Licence.LicenceNotFoundException

run

public void run()
Specified by:
run in interface java.lang.Runnable

onAsynchronousOptimizationResult

public void onAsynchronousOptimizationResult(IOptimizationResult result)
Description copied from interface: IOptimization
called after the optimization has been finished according to the defined terminating condition

Specified by:
onAsynchronousOptimizationResult in interface IOptimization
Parameters:
result - contains the optimization result or null if an error occured

onProgress

public void onProgress(double progress)
Description copied from interface: IOptimization
called each time when one percentage of the optimization is done

Specified by:
onProgress in interface IOptimization
Parameters:
progress -

onProgress

public void onProgress(double progress,
                       double totaldistance,
                       double costfunction)
Description copied from interface: IOptimization
called each time when one percentage of the optimization is done

Specified by:
onProgress in interface IOptimization
Parameters:
progress -
totaldistance - current distance of all routes
costfunction - abstract value of the current costfunction

onProgress

public void onProgress(double progress,
                       double totaldistance1,
                       double costfunction1,
                       double totaldistance2,
                       double costfunction2)

addDistanceMatrix

public void addDistanceMatrix(double[][] matrix)
Specified by:
addDistanceMatrix in interface IOptimization
Parameters:
matrix - the distance matrix defining all distances between the nodes

getMatrix

public double[][] getMatrix()
Specified by:
getMatrix in interface IOptimization
Returns:
the distance matrix

addTimeMatrix

public void addTimeMatrix(double[][] matrix)
Specified by:
addTimeMatrix in interface IOptimization
Parameters:
matrix - the time matrix defining all travelling times between the nodes

getTimeMatrix

public double[][] getTimeMatrix()

setLicence

public void setLicence(java.lang.String licence)

getLicence

public java.lang.String getLicence()