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
 java.util.HashMap serviceTimePointer
           
 
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)
          add a route to the current optimization.
 void addElement(java.util.Properties properties)
          add a property to the current optimization.
 void addTimeMatrix(double[][] matrix)
           
 IRoute checkAppointment(INode appointment)
          NOT YET INCLUDED IN JOPT - MIGHT BE INCLUDED IN THE LONG TERM ckecks a desired appointment against the current optimization.
 java.lang.String getLicenceKey()
           
 double[][] getMatrix()
           
 java.util.Properties getProperties()
           
 double[][] getTimeMatrix()
           
 void init()
           
 IRoute insertAppointment(INode appointment)
          NOT YET INCLUDED IN JOPT - MIGHT BE INCLUDED IN THE LONG TERM 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 onError(int errorcode, java.lang.String message)
          called in case an error occurs
 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 onProgress(double progress, double totaldistance, double costfunction, int optimizationStage, java.lang.String optimizationMode)
          called each time when one percentage of the optimization is done
 void onProgress(double progress, double totaldistance, double costfunction, int optimizationStage, java.lang.String optimizationMode, IViolationSummary violationSummary)
          called each time when one percentage of the optimization is done
 void run()
           
 void setLicenceKey(java.lang.String licenceKey)
           
 JOpt.SDK.Core.Individuum single2opt(JOpt.SDK.Core.Individuum ind)
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serviceTimePointer

public java.util.HashMap serviceTimePointer
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)
Description copied from interface: IOptimization
add a route to the current optimization.

Specified by:
addElement in interface IOptimization

checkAppointment

public IRoute checkAppointment(INode appointment)
Description copied from interface: IOptimization
NOT YET INCLUDED IN JOPT - MIGHT BE INCLUDED IN THE LONG TERM 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
NOT YET INCLUDED IN JOPT - MIGHT BE INCLUDED IN THE LONG TERM 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 totaldistance,
                       double costfunction,
                       int optimizationStage,
                       java.lang.String optimizationMode)
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
optimizationStage - 1 = construction, 2 = improvement
optimizationMode - assisted singledepot, assisted mutlidepot, unassisted

onProgress

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

onProgress

public void onProgress(double progress,
                       double totaldistance,
                       double costfunction,
                       int optimizationStage,
                       java.lang.String optimizationMode,
                       IViolationSummary violationSummary)
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
optimizationStage - 1 = construction, 2 = improvement
optimizationMode - assisted singledepot, assisted multidepot, strict assisted singledepot,strict assisted multidepot, unassisted
violationSummary - a summary of current violations

onError

public void onError(int errorcode,
                    java.lang.String message)
Description copied from interface: IOptimization
called in case an error occurs

Specified by:
onError in interface IOptimization
Parameters:
errorcode -
message -

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()

setLicenceKey

public void setLicenceKey(java.lang.String licenceKey)

getLicenceKey

public java.lang.String getLicenceKey()

getProperties

public java.util.Properties getProperties()
Specified by:
getProperties in interface IOptimization
Returns:
the system properties

init

public void init()

single2opt

public JOpt.SDK.Core.Individuum single2opt(JOpt.SDK.Core.Individuum ind)