Class Optimization
- All Implemented Interfaces:
IOptimizationEventListener,IOptimization
Optimization the ILicenseManager and the IOptimizationScheme are
set, all the INode, IResource and Properties are added and the IEntity can be accessed.- Since:
- Sep 27, 2019
- Version:
- Sep 27, 2019
- Author:
- Jens Richter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStartThe initial optimization mode GE.protected com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStartThe initial optimization mode SA.protected String -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new optimization.Optimization(com.dna.jopt.framework.body.setup.IOptimizationSetup optimizationSetup) Instantiates a new optimization.Optimization(com.dna.jopt.framework.body.setup.IOptimizationSetup optimizationSetup, OptimizationEvents optimizationEvents) Instantiates a new optimization. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDistanceMatrix(double[][] distanceMatrix) Deprecated.voidaddElement(INode node) Adds anINodeto the optimization.voidaddElement(IPillarNode pillarnode) Adds aIPillarNodeto the optimization.voidaddElement(IResource res) Adds anIResourceto the optimization.voidaddElement(Properties properties) Sets the given properties asgetUserProperties()and invokes the user properties.voidAdds allnodesin the list to the optimization.voidaddReassignNodes(List<INode> nodes) Adds reassign nodes.voidaddReassignResources(List<IResource> ress) Adds reassign resources.voidaddResources(List<IResource> resources) Adds allresourcesin the list to the optimization.voidaddTimeMatrix(double[][] timeMatrix) Deprecated.voidClean up none optimizable elements detail holder.booleanClean up optimization boolean.CallsIEntity.getAllEntityElements()andINodeUnassigner.getUnassignedNodes(), then returns all of these elements.getAllRoutesElements(String resourceId) com.dna.jopt.revision.algorithm.IOptimizationAlgorithmgetFirstMatchingRoute(INode node) getFirstMatchingRoute(String nodeId) longgetId()Gets the id of the current thread.Gets thegetNodeConnector().protected Map<String,ILogicRouteElementDetailItem> Gets the none optimizable elements detail holder.Gets thegetNoneOptimizableElementsDetailHolder().getNoneOptimizableNodDetail(String elementId) Gets the value in thegetNoneOptimizableElementsDetailHolder()for the givenelementId.Gets the optimization element.getOptimizationElement(String id, boolean includeUnassignedElements) Gets the optimization element.Gets the optimization run ident.Gets the definedIOptimizationScheme.com.dna.jopt.framework.body.setup.IOptimizationSetupGets theIOptimizationSetup.intcom.dna.jopt.framework.inputplausibility.properties.IPropertyProviderGets the property provider throughIOptimizationSetup.getPropertyProvider().Gets thethreadPrefix, the standard value is"JOPT-".Gets an unassigned element if present.Gets theINodeUnassignerof the optimization.Gets theuserEntityCoreBuildOptionsOpt.Deprecated.getVersionForStatus(String desc, String propertyPrefix, Properties props) Gets theworkEntity.voidHandle on error interruption state after throwable in preparation statebooleanCheckshasEntitySetByUser(), the default value isfalse.booleanUsed internally to keep track if the optimization is stopped.voidChecks thatgetCurrentOptimizationAlgo()is notnull, then callsIOptimizationAlgorithm.jumpToEnd().voidonAfterNodeFilteringOptimizationResult(IOptimizationResult requestedresult) voidonAsynchronousOptimizationResult(IOptimizationResult rapoptResult) On asynchronous optimization result.voidonBeforeNodeFilteringOptimizationResult(IOptimizationResult requestedresult) voidOn error.voidonError(IErrorEvent errorEvent) On error.voidonNodeFiltering(int code, String message, List<INodeFilterReason> filterReasons) On node filtering.voidonNodeFiltering(NodeFilteringEvent nodeFilteringEvent) On node filtering.voidonProgress(IOptimizationProgress progress) On progress.voidonProgress(String progressString) Deprecated.voidonRequestCodeExecutionDone(String executionId) On asynch execution done.voidOn status.voidonStatus(IStatusEvent statusEvent) On status.voidOn warning.voidonWarning(IWarningEvent warningEvent) On warning.voidpause()voidvoidproceed()Checks thatgetCurrentOptimizationAlgo()is notnull, then callsIOptimizationAlgorithm.proceed()which wakes up all threads that are waiting on this object's monitor.protected voidputAllNoneOptimizableNodDetail(Map<String, ILogicRouteElementDetailItem> noneOptimizableElementsDetailHolder) Put all none optimizable nod detail.voidputNoneOptimizableNodDetail(String elementId, ILogicRouteElementDetailItem details) Puts a value atelementIdingetNoneOptimizableElementsDetailHolder().voidRequested asynchronous optimization result.voidrequestExportState(OutputStream output, String executionId) Request export state with 100 Days of internal timeOut.voidrequestExportState(OutputStream output, String executionId, Duration timeOut) Request export state with time out.voidRequesting aIOptimizationProgress progresswhich will be provided in an async.voidRequesting an intermediateIOptimizationResult resultwhich will be provided in an async.voidReset initial entity.voidsetAutoFilterExecutionSchedule(List<Double> userExecutionList) voidsetInitialEntity(IEntity initialEntity) voidsetInitialEntity(IEntity initialEntity, boolean reassignUnassignedNode) Sets the givenIEntityas the initial Entity.voidsetInitialEntityRenewAutoFilterControllers(IEntity initialEntity) Deprecated.voidsetLicenceKey(String textkey) Deprecated.voidsetLicense(com.dna.jopt.framework.licensing.IRapotLicense license) Deprecated.voidsetLicense(File file) Deprecated.voidsetLicense(ObjectInputStream licensestream) Deprecated.voidsetLicenseJSON(File file) voidsetLicenseJSON(String jsonLic) voidsetNodeConnector(INodeEdgeConnector nodeConnector) Sets thegetNodeConnector().voidsetOptimizationAlgorithmStart(com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart modeSA, com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart modeGE) Sets theinitialOptimizationModeGEandinitialOptimizationModeSA, both have the default valueSTATE_MODE_BATCH.booleansetOptimizationCreator(String creator) booleansetOptimizationRunIdent(String ident) Sets the optimization run identification string.voidsetOptimizationScheme(IOptimizationScheme optimizationScheme) Sets theIOptimizationScheme.voidsetThreadPrefix(String threadPrefix) Sets thegetThreadPrefix(), the default value is"JOPT-".voidInternally called to settle the optimization, e.g.voidsetTypeDictionaryManager(ITypeDictionaryManager typeDictionaryManager) voidsetUnassignNodeManager(INodeUnassigner unassignNodeManager) Sets theINodeUnassigner.voidsetUserEntityCoreBuildOptions(Properties userEntityCoreBuildOptions) SetsuserEntityCoreBuildOptionsOptas anOptionalwith the parameter values if notnull.voidsetWorkEntity(IEntity workEntity) Sets theworkEntity.voidDeprecated.Start run async.startRunAsync(ObjectInputStream license) Deprecated.startRunSync(long timeout, TimeUnit unit) Start run sync.voidChecks thatgetCurrentOptimizationAlgo()is notnull, then setsisStopOptimization()totrueand callsIOptimizationAlgorithm.jumpToEnd().
-
Field Details
-
initialOptimizationModeSA
protected com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart initialOptimizationModeSAThe initial optimization mode SA. -
initialOptimizationModeGE
protected com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart initialOptimizationModeGEThe initial optimization mode GE. -
jsonLic
-
-
Constructor Details
-
Optimization
public Optimization()Instantiates a new optimization. -
Optimization
public Optimization(com.dna.jopt.framework.body.setup.IOptimizationSetup optimizationSetup) Instantiates a new optimization.- Parameters:
optimizationSetup- the optimization setup
-
Optimization
public Optimization(com.dna.jopt.framework.body.setup.IOptimizationSetup optimizationSetup, OptimizationEvents optimizationEvents) Instantiates a new optimization.- Parameters:
optimizationSetup- the optimization setupoptimizationEvents- the optimization events
-
-
Method Details
-
setOptimizationCreator
- Specified by:
setOptimizationCreatorin interfaceIOptimization
-
getOptimizationCreator
- Specified by:
getOptimizationCreatorin interfaceIOptimization
-
setOptimizationRunIdent
Description copied from interface:IOptimizationSets the optimization run identification string. This can be an arbitrary user provided String to identify a run. If no ident is provided, the Optimizer will generate an ident whenever the optimization is saved.- Specified by:
setOptimizationRunIdentin interfaceIOptimization- Parameters:
ident- the ident- Returns:
- true, if accepted
-
getOptimizationRunIdent
Description copied from interface:IOptimizationGets the optimization run ident. If no ident was provided the Optimizer creates an ident on the first call of this method.- Specified by:
getOptimizationRunIdentin interfaceIOptimization- Returns:
- the optimization run ident
-
setAutoFilterExecutionSchedule
Description copied from interface:IOptimization- Specified by:
setAutoFilterExecutionSchedulein interfaceIOptimization- Parameters:
userExecutionList- theList<Double>to be set as userExecutionList
-
getId
public long getId()Description copied from interface:IOptimizationGets the id of the current thread.- Specified by:
getIdin interfaceIOptimization- Returns:
- the long thread id
- See Also:
-
getOptimizationEvents
Description copied from interface:IOptimizationGets theOptimizationEventswhich are backed by multipleReplaySubjectandCompletableFuture.OptimizationEventscan be used to subscribe to different events of the optimization.- Specified by:
getOptimizationEventsin interfaceIOptimization- Returns:
- the optimizationevents
-
setOptimizationAlgorithmStart
public void setOptimizationAlgorithmStart(com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart modeSA, com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart modeGE) Description copied from interface:IOptimizationSets theinitialOptimizationModeGEandinitialOptimizationModeSA, both have the default valueSTATE_MODE_BATCH.- Specified by:
setOptimizationAlgorithmStartin interfaceIOptimization- Parameters:
modeSA- the modeSAmodeGE- the modeGE
-
putNoneOptimizableNodDetail
Description copied from interface:IOptimizationPuts a value atelementIdingetNoneOptimizableElementsDetailHolder().- Specified by:
putNoneOptimizableNodDetailin interfaceIOptimization- Parameters:
elementId- the string id for the value to be putdetails- the iLogicRouteElementDetailItem that is supposed to be put
-
putAllNoneOptimizableNodDetail
protected void putAllNoneOptimizableNodDetail(Map<String, ILogicRouteElementDetailItem> noneOptimizableElementsDetailHolder) Put all none optimizable nod detail.- Parameters:
noneOptimizableElementsDetailHolder- the none optimizable elements detail holder
-
getNoneOptimizableNodDetail
Description copied from interface:IOptimizationGets the value in thegetNoneOptimizableElementsDetailHolder()for the givenelementId. This method is primarily used for internal purpose. Please try to extract details from the route itself.- Specified by:
getNoneOptimizableNodDetailin interfaceIOptimization- Parameters:
elementId- the string key for the value- Returns:
- the value of the elementId in noneOptimizableElementsDetailHolder
-
getNoneOptimizableElementsDetailHolder
Gets the none optimizable elements detail holder.- Returns:
- the none optimizable elements detail holder
-
cleanUpNoneOptimizableElementsDetailHolder
Description copied from interface:IOptimizationClean up none optimizable elements detail holder.- Specified by:
cleanUpNoneOptimizableElementsDetailHolderin interfaceIOptimization- Parameters:
deadIds- the dead ids
-
getNoneOptimizableElementsDetails
Description copied from interface:IOptimizationGets thegetNoneOptimizableElementsDetailHolder().- Specified by:
getNoneOptimizableElementsDetailsin interfaceIOptimization- Returns:
- none optimizable elements details
-
requestedAsynchronousOptimizationResult
Description copied from interface:IOptimizationRequested asynchronous optimization result.- Specified by:
requestedAsynchronousOptimizationResultin interfaceIOptimization- Specified by:
requestedAsynchronousOptimizationResultin interfaceIOptimizationEventListener- Parameters:
result- the result to print
-
getOptimizationSetup
public com.dna.jopt.framework.body.setup.IOptimizationSetup getOptimizationSetup()Description copied from interface:IOptimizationGets theIOptimizationSetup.- Specified by:
getOptimizationSetupin interfaceIOptimization- Returns:
- the optimizationSetup
-
setOptimizationScheme
Description copied from interface:IOptimizationSets theIOptimizationScheme.- Specified by:
setOptimizationSchemein interfaceIOptimization- Parameters:
optimizationScheme- the iOptimizationscheme to add
-
getOptimizationScheme
Description copied from interface:IOptimizationGets the definedIOptimizationScheme.- Specified by:
getOptimizationSchemein interfaceIOptimization- Returns:
- the optimizationscheme
-
setNodeConnector
Description copied from interface:IOptimizationSets thegetNodeConnector().Cannot be
null.- Specified by:
setNodeConnectorin interfaceIOptimization- Parameters:
nodeConnector- the new node connector
-
getNodeConnector
Description copied from interface:IOptimizationGets thegetNodeConnector().- Specified by:
getNodeConnectorin interfaceIOptimization- Returns:
- the node connector
-
getUnassignNodeManager
Description copied from interface:IOptimizationGets theINodeUnassignerof the optimization.- Specified by:
getUnassignNodeManagerin interfaceIOptimization- Returns:
- the unassignNodeManager
-
setUnassignNodeManager
Description copied from interface:IOptimizationSets theINodeUnassigner.Cannot be
null.- Specified by:
setUnassignNodeManagerin interfaceIOptimization- Parameters:
unassignNodeManager- the unassign node manager
-
getTypeDictionaryManager
- Specified by:
getTypeDictionaryManagerin interfaceIOptimization
-
setTypeDictionaryManager
- Specified by:
setTypeDictionaryManagerin interfaceIOptimization
-
getPropertyProvider
public com.dna.jopt.framework.inputplausibility.properties.IPropertyProvider getPropertyProvider()Description copied from interface:IOptimizationGets the property provider throughIOptimizationSetup.getPropertyProvider().- Specified by:
getPropertyProviderin interfaceIOptimization- Returns:
- the propertyProvider
-
addElement
Description copied from interface:IOptimizationAdds anINodeto the optimization.- Specified by:
addElementin interfaceIOptimization- Parameters:
node- the element to be added.
-
addNodes
Description copied from interface:IOptimizationAdds allnodesin the list to the optimization.- Specified by:
addNodesin interfaceIOptimization- Parameters:
nodes- thelist<INode>of nodes to be added
-
addReassignNodes
Description copied from interface:IOptimizationAdds reassign nodes. In case a custom solution is usedIOptimization.setInitialEntity(com.dna.jopt.member.bucket.entity.IEntity), or the optimization is resumed from a snapshot additional nodes can be added. In contrast toIOptimization.addElement(com.dna.jopt.member.unit.node.INode), nodes are put in an optimized fashion into the existing solution.If no solution by the user is provided, calling this method has the same effect as
IOptimization.addElement(com.dna.jopt.member.unit.node.INode).- Specified by:
addReassignNodesin interfaceIOptimization- Parameters:
nodes- the nodes
-
getReassignNodes
- Specified by:
getReassignNodesin interfaceIOptimization
-
addReassignResources
Description copied from interface:IOptimizationAdds reassign resources. In case a custom solution is usedIOptimization.setInitialEntity(com.dna.jopt.member.bucket.entity.IEntity), or the optimization is resumed from a snapshot additional resources can be added.If no solution by the user is provided, calling this method has the same effect as
IOptimization.addElement(com.dna.jopt.member.unit.node.INode).- Specified by:
addReassignResourcesin interfaceIOptimization- Parameters:
ress- the resources
-
getReassignResources
- Specified by:
getReassignResourcesin interfaceIOptimization
-
addResources
Description copied from interface:IOptimizationAdds allresourcesin the list to the optimization.- Specified by:
addResourcesin interfaceIOptimization- Parameters:
resources- thelist<IResource>to be added
-
addElement
Description copied from interface:IOptimizationAdds aIPillarNodeto the optimization.- Specified by:
addElementin interfaceIOptimization- Parameters:
pillarnode- the pillarnode to be added
-
addElement
Description copied from interface:IOptimizationAdds anIResourceto the optimization.- Specified by:
addElementin interfaceIOptimization- Parameters:
res- the resource
-
addElement
Description copied from interface:IOptimizationSets the given properties asgetUserProperties()and invokes the user properties.A list of all properties can be generated by the following code example:
public static void printJOptProperties() { List<String> categories = new ArrayList<>(); categories.add("CATEGORY_MISC"); categories.add("CATEGORY_SYSTEM"); categories.add("CATEGORY_OPTIMIZATION_GENERAL_SETUP"); categories.add("CATEGORY_OPTIMIZATION_CONSTRUCTION"); categories.add("CATEGORY_OPTIMIZATION_PRE_OPTIMIZATION_SETUP"); categories.add("CATEGORY_OPTIMIZATION_GENETIC_SETUP"); categories.add("CATEGORY_OPTIMIZATION_2OPT"); categories.add("CATEGORY_OPTIMIZATION_WEIGHTS"); categories.add("CATEGORY_OPTIMIZATION_AUTOFILTER"); categories.add("CATEGORY_OPTIMIZATION_CO_SETUP"); categories.add("CATEGORY_OPTIMIZATION_DEPRECATED"); IOptimization myDummyOptimization = new Optimization(); // Read out current properties List<PropertyItem> categorySortedPropItems = myDummyOptimization.getPropertyProvider() .getPropertyItems() .stream() .sorted((o1,o2)->Integer.compare(o1.getCategoryIdent(), o2.getCategoryIdent())) .collect(Collectors.toList()); categorySortedPropItems .stream() .forEach( i -> { if (i.getCategoryIdent() == PropertyItem.CATEGORY_OPTIMIZATION_DEPRECATED) { System.out.print("\n-== DEPRECATED PROPERTY ==-"); } else { System.out.print("\n"); } System.out.print( "\nCategory: " + categories.get(i.getCategoryIdent()) + "\nDescription: " + i.getDescription() + "\nDefault Key: " + i.getValidatedPropertyName() + "\nDefault Value: " + i.getDefaultValue() + "\nAllowed Values: " + i.getAllowedValues() + "\n"); }); }- Specified by:
addElementin interfaceIOptimization- Parameters:
properties- the properties
-
getUserProperties
Description copied from interface:IOptimization- Specified by:
getUserPropertiesin interfaceIOptimization- Returns:
- the userProperties
-
setLicenseJSON
- Specified by:
setLicenseJSONin interfaceIOptimization
-
setLicenseJSON
- Specified by:
setLicenseJSONin interfaceIOptimization- Throws:
IOException
-
setLicense
Deprecated.Description copied from interface:IOptimizationSets the license key via a file object.- Specified by:
setLicensein interfaceIOptimization- Parameters:
file- the key- Throws:
IOException- the io exception
-
setLicenceKey
Deprecated.Description copied from interface:IOptimizationSets the licence key.- Specified by:
setLicenceKeyin interfaceIOptimization- Parameters:
textkey- the string new licence key
-
setLicense
Deprecated.Description copied from interface:IOptimizationSets the license key loaded from a file and already read in license object.- Specified by:
setLicensein interfaceIOptimization- Parameters:
license- the iRapotLicense new license
-
setLicense
Deprecated.Description copied from interface:IOptimizationSets the license key via an input stream.The following code example can be used to read in a file from a resource folder:
public class ExampleLicenseHelper { private static final String LICNCES_PATH = "src/test/resources/myKeyFile.dli"; private ExampleLicenseHelper() { // Nothing to do } public static boolean setLicense(IOptimization opti) { try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File(ExampleLicenseHelper.LICNCES_PATH))); opti.setLicense(ois); return true; } catch (IOException e) { e.printStackTrace(); return false; } } }- Specified by:
setLicensein interfaceIOptimization- Parameters:
licensestream- the objectinputstream
-
startAsynchronousOptimizationRun
Deprecated.Description copied from interface:IOptimizationCallsIOptimization.startRunSync(long, TimeUnit)withMAX_VALUEaslongandMILLISECONDSasTimeUnit.- Specified by:
startAsynchronousOptimizationRunin interfaceIOptimization- Throws:
InvalidLicenceException- the invalid licence exception
-
startRunSync
public IOptimizationResult startRunSync(long timeout, TimeUnit unit) throws InvalidLicenceException, InterruptedException, ExecutionException, TimeoutException Description copied from interface:IOptimizationStart run sync. internally creates acompletable future. The optimization is started within aForkJoinPool. Internallyget()is called on it so that the code will block until thecompletable futurereturns. However, as the run is outsourced into multiple threads the Optimization object itself stays responsive to allow for example to request an intermediate optimization result.The
timeoutsets the time within which thecompletable futureneeds to return, otherwise aTimeoutExceptionis thrownFor use without a timeout please use
IOptimization.startRunAsync()- Specified by:
startRunSyncin interfaceIOptimization- Parameters:
timeout- the long number of the to be defined time unit until timeoutunit- the timeUnit of the timeout- Returns:
- the ioptimization result
- Throws:
InvalidLicenceException- the invalid licence exceptionInterruptedException- the interrupted exceptionExecutionException- the execution exceptionTimeoutException- the timeout exception if the completable future has not been done within the timeout
-
startRunAsync
Description copied from interface:IOptimizationStart run async. creates acompletable futurewhich is returned.- Specified by:
startRunAsyncin interfaceIOptimization- Returns:
- completable future
- Throws:
InvalidLicenceException- the invalid licence exception
-
handleOnErrorInterruptionState
Description copied from interface:IOptimizationHandle on error interruption state after throwable in preparation state- Specified by:
handleOnErrorInterruptionStatein interfaceIOptimization- Parameters:
e- the e
-
prePreparation
public void prePreparation() -
startRunAsync
@Deprecated public CompletableFuture<IOptimizationResult> startRunAsync(ObjectInputStream license) throws InvalidLicenceException Deprecated.Description copied from interface:IOptimizationStart run async by providing an additional license stream.- Specified by:
startRunAsyncin interfaceIOptimization- Parameters:
license- the license- Returns:
- the completable future
- Throws:
InvalidLicenceException- the invalid licence exception- See Also:
-
getVersionForStatus
-
setInitialEntity
Description copied from interface:IOptimizationSets the initialIEntityas the workEntity andhasEntitySetByUser()totrue. This method is used to load custom solutions and is used during the loading of a snapshot.Will throw an
IllegalStateExceptionif the initial entity isnull.- Specified by:
setInitialEntityin interfaceIOptimization- Parameters:
initialEntity- the new initial entity
-
resetInitialEntity
public void resetInitialEntity()Description copied from interface:IOptimizationReset initial entity. This method will reset an entity that was assigned to the optimization. It is only allowed to reset an entity before the optimization is started.This methods helps to use an existing solution to be used only as data provider, ignoring an existing solution.
- Specified by:
resetInitialEntityin interfaceIOptimization
-
setInitialEntityRenewAutoFilterControllers
Deprecated.Description copied from interface:IOptimizationSetshasEntitySetByUser()andtryRenewAutoFilterControllertotrue, then sets the input initialEntity as thegetWorkEntity().- Specified by:
setInitialEntityRenewAutoFilterControllersin interfaceIOptimization- Parameters:
initialEntity- the iEntity to be set as workEntity
-
hasEntitySetByUser
public boolean hasEntitySetByUser()Description copied from interface:IOptimizationCheckshasEntitySetByUser(), the default value isfalse.- Specified by:
hasEntitySetByUserin interfaceIOptimization- Returns:
- the boolean hasUserEntity
-
setInitialEntity
Description copied from interface:IOptimizationSets the givenIEntityas the initial Entity.- Specified by:
setInitialEntityin interfaceIOptimization- Parameters:
initialEntity- the entity to be setreassignUnassignedNode- the reassign unassigned node
-
setWorkEntity
Description copied from interface:IOptimizationSets theworkEntity.- Specified by:
setWorkEntityin interfaceIOptimization- Parameters:
workEntity- the workEntity to be set
-
setUserEntityCoreBuildOptions
Description copied from interface:IOptimizationSetsuserEntityCoreBuildOptionsOptas anOptionalwith the parameter values if notnull. Will set it as an emptyOptionalifnull.- Specified by:
setUserEntityCoreBuildOptionsin interfaceIOptimization- Parameters:
userEntityCoreBuildOptions- the optional with the given parameters
-
getUserEntityCoreBuildOptions
Description copied from interface:IOptimizationGets theuserEntityCoreBuildOptionsOpt. The default value is an emptyOptional.- Specified by:
getUserEntityCoreBuildOptionsin interfaceIOptimization- Returns:
- the optional userEntityCoreBuildOptionsOpt
-
getWorkEntity
Description copied from interface:IOptimizationGets theworkEntity.- Specified by:
getWorkEntityin interfaceIOptimization- Returns:
- the iEntity workEntity
-
getOptimizationElement
Description copied from interface:IOptimizationGets the optimization element. Extracts an element (Resource or Node) that is member of any route of the current optimization run. Unassigned elements are not found.- Specified by:
getOptimizationElementin interfaceIOptimization- Parameters:
id- the id- Returns:
- the optimization element
-
getOptimizationElement
public Optional<IOptimizationElement> getOptimizationElement(String id, boolean includeUnassignedElements) Description copied from interface:IOptimizationGets the optimization element. Extracts an element (Resource or Node) that is member of any route of the current optimization run. Unassigned elements can be found if includeUnassignedElements is true.- Specified by:
getOptimizationElementin interfaceIOptimization- Parameters:
id- the idincludeUnassignedElements- the include unassigned elements- Returns:
- the optimization element
-
getUnassignedElement
Description copied from interface:IOptimizationGets an unassigned element if present.- Specified by:
getUnassignedElementin interfaceIOptimization- Parameters:
id- the id- Returns:
- the unassigned element
-
getAllElements
Description copied from interface:IOptimizationCallsIEntity.getAllEntityElements()andINodeUnassigner.getUnassignedNodes(), then returns all of these elements. Returns a newArraylistif these arenull.- Specified by:
getAllElementsin interfaceIOptimization- Returns:
- the
List<IOptimizationElement>with all the elements
-
getNoneOptimizableElements
Description copied from interface:IOptimizationCallsIEntity.getNoneOptimizableElements()ifgetWorkEntity()is notnull. Otherwise returns a newArraylist.- Specified by:
getNoneOptimizableElementsin interfaceIOptimization- Returns:
- a
List<IOptimizationElement>
-
getOptimizableElements
Description copied from interface:IOptimizationCallsIEntity.getNoneOptimizableElements()if theIOptimization.getWorkEntity()is notnull. Otherwise returns a newArraylist.- Specified by:
getOptimizableElementsin interfaceIOptimization- Returns:
- the
List<IOptimizationElement>
-
getAllRoutesElements
Description copied from interface:IOptimizationCallsIEntity.getAllRoutesElements(String), ifIOptimization.getWorkEntity()is notnull.If the route of the given resource does not have any elements returns a new
ArrayList<>.- Specified by:
getAllRoutesElementsin interfaceIOptimization- Parameters:
resourceId- the string resourceId- Returns:
- the
ArrayList<>of the route elements
-
getFirstMatchingRoute
Description copied from interface:IOptimization- Specified by:
getFirstMatchingRoutein interfaceIOptimization- Parameters:
nodeId- the string of the nodeId that is supposed to match- Returns:
- an optional with the matching route or an empty optional
-
getFirstMatchingRoute
Description copied from interface:IOptimization- Specified by:
getFirstMatchingRoutein interfaceIOptimization- Parameters:
node- the iNode that is supposed to match- Returns:
- an optional with the matching route or an empty optional
-
getAnchoredRoutes
Description copied from interface:IOptimization- Specified by:
getAnchoredRoutesin interfaceIOptimization- Returns:
- the anchored routes
-
setThreadPrefix
Description copied from interface:IOptimizationSets thegetThreadPrefix(), the default value is"JOPT-". This helps to identify the running optimization thread on the user system.- Specified by:
setThreadPrefixin interfaceIOptimization- Parameters:
threadPrefix- the prefix to be set
-
getThreadPrefix
Description copied from interface:IOptimizationGets thethreadPrefix, the standard value is"JOPT-".- Specified by:
getThreadPrefixin interfaceIOptimization- Returns:
- the string threadPrefix
-
getOptimizationStage
public int getOptimizationStage()Description copied from interface:IOptimizationCallsOptimizationSubController.getCurrentOptimizationAlgo(). For example, in case three optimization algorithms and currently the second algorithm is running the stage identifier is one. The first algorithm would have the stage identifier zero.- Specified by:
getOptimizationStagein interfaceIOptimization- Returns:
- returns the optimizationAlgo
-
getCurrentOptimizationAlgo
public com.dna.jopt.revision.algorithm.IOptimizationAlgorithm getCurrentOptimizationAlgo()Description copied from interface:IOptimizationCallsOptimizationSubController.getCurrentOptimizationAlgo(). Returns the currently running optimization algorithm.- Specified by:
getCurrentOptimizationAlgoin interfaceIOptimization- Returns:
- the current optimizationalgorithm
-
settleOptimization
public void settleOptimization()Description copied from interface:IOptimizationInternally called to settle the optimization, e.g. finishing all running postStepManagers.- Specified by:
settleOptimizationin interfaceIOptimization
-
requestResult
public void requestResult()Description copied from interface:IOptimizationRequesting an intermediateIOptimizationResult resultwhich will be provided in an async. manner.Checks that
getCurrentOptimizationAlgo()is notnull, then callsIOptimizationAlgorithm.requestResult().- Specified by:
requestResultin interfaceIOptimization
-
requestProgress
public void requestProgress()Description copied from interface:IOptimizationRequesting aIOptimizationProgress progresswhich will be provided in an async. manner.Checks that
getCurrentOptimizationAlgo()is notnull, then callsIOptimizationAlgorithm.requestProgress().- Specified by:
requestProgressin interfaceIOptimization
-
requestExportState
Description copied from interface:IOptimizationRequest export state with 100 Days of internal timeOut. The optimization will be saved as JSON to the provided outputStream. Further, when the saving is done, to returned CompletableFuture is completed with the provided executionId.- Specified by:
requestExportStatein interfaceIOptimization- Parameters:
output- the outputexecutionId- the execution id
-
requestExportState
public void requestExportState(OutputStream output, String executionId, Duration timeOut) throws TimeoutException Description copied from interface:IOptimizationRequest export state with time out. The optimization will be saved as JSON to the provided outputStream. Further, when the saving is done, to returned CompletableFuture is completed with the provided executionId.- Specified by:
requestExportStatein interfaceIOptimization- Parameters:
output- the outputexecutionId- the execution idtimeOut- the time out- Throws:
TimeoutException- the timeout exception
-
jumpToNextStage
public void jumpToNextStage()Description copied from interface:IOptimizationChecks thatgetCurrentOptimizationAlgo()is notnull, then callsIOptimizationAlgorithm.jumpToEnd().- Specified by:
jumpToNextStagein interfaceIOptimization
-
stopOptimization
public void stopOptimization()Description copied from interface:IOptimizationChecks thatgetCurrentOptimizationAlgo()is notnull, then setsisStopOptimization()totrueand callsIOptimizationAlgorithm.jumpToEnd(). This call will trigger a graceful optimization stop triggering the optimization result.- Specified by:
stopOptimizationin interfaceIOptimization
-
isStopOptimization
public boolean isStopOptimization()Description copied from interface:IOptimizationUsed internally to keep track if the optimization is stopped.- Specified by:
isStopOptimizationin interfaceIOptimization- Returns:
- the boolean optimizationWasStopped
-
proceed
public void proceed()Description copied from interface:IOptimizationChecks thatgetCurrentOptimizationAlgo()is notnull, then callsIOptimizationAlgorithm.proceed()which wakes up all threads that are waiting on this object's monitor.- Specified by:
proceedin interfaceIOptimization- See Also:
-
pause
public void pause()Description copied from interface:IOptimization- Specified by:
pausein interfaceIOptimization- See Also:
-
getVersion
Deprecated.Description copied from interface:IOptimizationGets information about the build of the library.- Specified by:
getVersionin interfaceIOptimization- Returns:
- the string myVersion
-
getCoreVersionProperties
Description copied from interface:IOptimization- Specified by:
getCoreVersionPropertiesin interfaceIOptimization- Returns:
- the
versionCoreProperties
-
getCoreVersion
Description copied from interface:IOptimization- Specified by:
getCoreVersionin interfaceIOptimization- Returns:
- the
versionCoreProperties
-
cleanUpOptimization
public boolean cleanUpOptimization()Description copied from interface:IOptimizationClean up optimization boolean. Returnstrue.- Specified by:
cleanUpOptimizationin interfaceIOptimization- Returns:
- true
-
addDistanceMatrix
Deprecated.Adds the distance matrix.- Specified by:
addDistanceMatrixin interfaceIOptimization- Parameters:
distanceMatrix- the distance matrix- Category:
- Legacy
Adds the distance matrix.
-
addTimeMatrix
Deprecated.Adds the time matrix.- Specified by:
addTimeMatrixin interfaceIOptimization- Parameters:
timeMatrix- the time matrix- Category:
- Legacy
Adds the time matrix.
-
onProgress
Deprecated.Description copied from interface:IOptimizationEventListenerOn progress. UseIOptimizationEventListener.onProgress(IOptimizationProgress)instead- Specified by:
onProgressin interfaceIOptimizationEventListener- Parameters:
progressString- the winner progress string
-
onProgress
Description copied from interface:IOptimizationEventListenerOn progress.- Specified by:
onProgressin interfaceIOptimizationEventListener- Parameters:
progress- the cur best entity
-
onAsynchronousOptimizationResult
Description copied from interface:IOptimizationEventListenerOn asynchronous optimization result.- Specified by:
onAsynchronousOptimizationResultin interfaceIOptimizationEventListener- Parameters:
rapoptResult- the winner
-
onError
Description copied from interface:IOptimizationEventListenerOn error.- Specified by:
onErrorin interfaceIOptimizationEventListener- Parameters:
code- the codemessage- the message
-
onError
Description copied from interface:IOptimizationEventListenerOn error.- Specified by:
onErrorin interfaceIOptimizationEventListener- Parameters:
errorEvent- the error event
-
onWarning
Description copied from interface:IOptimizationEventListenerOn warning.- Specified by:
onWarningin interfaceIOptimizationEventListener- Parameters:
code- the codemessage- the message
-
onWarning
Description copied from interface:IOptimizationEventListenerOn warning.- Specified by:
onWarningin interfaceIOptimizationEventListener- Parameters:
warningEvent- the i warning event
-
onStatus
Description copied from interface:IOptimizationEventListenerOn status.- Specified by:
onStatusin interfaceIOptimizationEventListener- Parameters:
code- the codemessage- the message
-
onStatus
Description copied from interface:IOptimizationEventListenerOn status.- Specified by:
onStatusin interfaceIOptimizationEventListener- Parameters:
statusEvent- the status event
-
onNodeFiltering
Description copied from interface:IOptimizationEventListenerOn node filtering.- Specified by:
onNodeFilteringin interfaceIOptimizationEventListener- Parameters:
code- the codemessage- the messagefilterReasons- the filter reasons
-
onNodeFiltering
Description copied from interface:IOptimizationEventListenerOn node filtering.- Specified by:
onNodeFilteringin interfaceIOptimizationEventListener- Parameters:
nodeFilteringEvent- the node filtering event
-
onRequestCodeExecutionDone
Description copied from interface:IOptimizationEventListenerOn asynch execution done.- Specified by:
onRequestCodeExecutionDonein interfaceIOptimizationEventListener- Parameters:
executionId- the execution id
-
onBeforeNodeFilteringOptimizationResult
- Specified by:
onBeforeNodeFilteringOptimizationResultin interfaceIOptimizationEventListener
-
onAfterNodeFilteringOptimizationResult
- Specified by:
onAfterNodeFilteringOptimizationResultin interfaceIOptimizationEventListener
-