public class Optimization extends Object implements IOptimization
Optimization
the ILicenseManager
and the IOptimizationScheme
are
set, all the INode
, IResource
and Properties
are added and the IEntity
can be accessed.Modifier and Type | Field and Description |
---|---|
protected com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart |
initialOptimizationModeGE
The initial optimization mode GE.
|
protected com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart |
initialOptimizationModeSA
The initial optimization mode SA.
|
protected String |
jsonLic |
Constructor and Description |
---|
Optimization()
Instantiates 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.
|
Modifier and Type | Method and Description |
---|---|
void |
addDistanceMatrix(double[][] distanceMatrix)
Deprecated.
|
void |
addElement(INode node)
Adds an
INode to the optimization. |
void |
addElement(IPillarNode pillarnode)
Adds a
IPillarNode to the optimization. |
void |
addElement(IResource res)
Adds an
IResource to the optimization. |
void |
addElement(Properties properties)
Sets the given properties as
getUserProperties() and invokes the user
properties. |
void |
addNodes(List<INode> nodes)
Adds all
nodes in the list to the optimization. |
void |
addReassignNodes(List<INode> nodes)
Adds reassign nodes.
|
void |
addReassignResources(List<IResource> ress)
Adds reassign resources.
|
void |
addResources(List<IResource> resources)
Adds all
resources in the list to the optimization. |
void |
addTimeMatrix(double[][] timeMatrix)
Deprecated.
|
void |
cleanUpNoneOptimizableElementsDetailHolder(Set<String> deadIds)
Clean up none optimizable elements detail holder.
|
boolean |
cleanUpOptimization()
Clean up optimization boolean.
|
List<IOptimizationElement> |
getAllElements()
Calls
IEntity.getAllEntityElements() and INodeUnassigner.getUnassignedNodes() ,
then returns all of these elements. |
List<IOptimizationElement> |
getAllRoutesElements(String resourceId)
|
List<ILogicEntityRoute> |
getAnchoredRoutes()
|
String |
getCoreVersion()
|
Properties |
getCoreVersionProperties()
|
com.dna.jopt.revision.algorithm.IOptimizationAlgorithm |
getCurrentOptimizationAlgo()
|
Optional<ILogicEntityRoute> |
getFirstMatchingRoute(INode node)
|
Optional<ILogicEntityRoute> |
getFirstMatchingRoute(String nodeId)
|
long |
getId()
Gets the id of the current thread.
|
INodeEdgeConnector |
getNodeConnector()
Gets the
getNodeConnector() . |
List<IOptimizationElement> |
getNoneOptimizableElements()
|
protected Map<String,ILogicRouteElementDetailItem> |
getNoneOptimizableElementsDetailHolder()
Gets the none optimizable elements detail holder.
|
Map<String,ILogicRouteElementDetailItem> |
getNoneOptimizableElementsDetails()
Gets the
getNoneOptimizableElementsDetailHolder() . |
ILogicRouteElementDetailItem |
getNoneOptimizableNodDetail(String elementId)
Gets the value in the
getNoneOptimizableElementsDetailHolder() for the given
elementId . |
List<IOptimizationElement> |
getOptimizableElements()
|
Optional<String> |
getOptimizationCreator() |
Optional<IOptimizationElement> |
getOptimizationElement(String id)
Gets the optimization element.
|
Optional<IOptimizationElement> |
getOptimizationElement(String id,
boolean includeUnassignedElements)
Gets the optimization element.
|
OptimizationEvents |
getOptimizationEvents()
|
String |
getOptimizationRunIdent()
Gets the optimization run ident.
|
IOptimizationScheme |
getOptimizationScheme()
Gets the defined
IOptimizationScheme . |
com.dna.jopt.framework.body.setup.IOptimizationSetup |
getOptimizationSetup()
Gets the
IOptimizationSetup . |
int |
getOptimizationStage()
|
com.dna.jopt.framework.inputplausibility.properties.IPropertyProvider |
getPropertyProvider()
Gets the property provider through
IOptimizationSetup.getPropertyProvider() . |
List<INode> |
getReassignNodes() |
List<IResource> |
getReassignResources() |
String |
getThreadPrefix()
Gets the
threadPrefix , the standard value is "JOPT-" . |
Optional<IOptimizationElement> |
getUnassignedElement(String id)
Gets an unassigned element if present.
|
INodeUnassigner |
getUnassignNodeManager()
Gets the
INodeUnassigner of the optimization. |
Optional<Properties> |
getUserEntityCoreBuildOptions()
Gets the
userEntityCoreBuildOptionsOpt . |
Optional<Properties> |
getUserProperties()
|
String |
getVersion()
Deprecated.
|
String |
getVersionForStatus(String desc,
String propertyPrefix,
Properties props) |
IEntity |
getWorkEntity()
Gets the
workEntity . |
boolean |
hasEntitySetByUser()
Checks
hasEntitySetByUser() , the default value is false . |
boolean |
isStopOptimization()
Used internally to keep track if the optimization is stopped.
|
void |
jumpToNextStage()
Checks that
getCurrentOptimizationAlgo() is not null , then calls
IOptimizationAlgorithm.jumpToEnd() . |
void |
onAfterNodeFilteringOptimizationResult(IOptimizationResult requestedresult) |
void |
onAsynchronousOptimizationResult(IOptimizationResult rapoptResult)
On asynchronous optimization result.
|
void |
onBeforeNodeFilteringOptimizationResult(IOptimizationResult requestedresult) |
void |
onError(IErrorEvent errorEvent)
On error.
|
void |
onError(int code,
String message)
On error.
|
void |
onNodeFiltering(int code,
String message,
List<INodeFilterReason> filterReasons)
On node filtering.
|
void |
onNodeFiltering(NodeFilteringEvent nodeFilteringEvent)
On node filtering.
|
void |
onProgress(IOptimizationProgress progress)
On progress.
|
void |
onProgress(String progressString)
Deprecated.
|
void |
onRequestCodeExecutionDone(String executionId)
On asynch execution done.
|
void |
onStatus(int code,
String message)
On status.
|
void |
onStatus(IStatusEvent statusEvent)
On status.
|
void |
onWarning(int code,
String message)
On warning.
|
void |
onWarning(IWarningEvent warningEvent)
On warning.
|
void |
pause()
|
void |
prePreparation() |
void |
proceed()
Checks that
getCurrentOptimizationAlgo() is not null , then calls
IOptimizationAlgorithm.proceed() which wakes up all threads that are waiting on this
object's monitor. |
protected void |
putAllNoneOptimizableNodDetail(Map<String,ILogicRouteElementDetailItem> noneOptimizableElementsDetailHolder)
Put all none optimizable nod detail.
|
void |
putNoneOptimizableNodDetail(String elementId,
ILogicRouteElementDetailItem details)
Puts a value at
elementId in getNoneOptimizableElementsDetailHolder() . |
void |
requestedAsynchronousOptimizationResult(IOptimizationResult result)
Requested asynchronous optimization result.
|
void |
requestExportState(OutputStream output,
String executionId)
Request export state with 100 Days of internal timeOut.
|
void |
requestExportState(OutputStream output,
String executionId,
Duration timeOut)
Request export state with time out.
|
void |
requestProgress()
Requesting a
IOptimizationProgress progress which will be provided in an async. |
void |
requestResult()
Requesting an intermediate
IOptimizationResult result which will be provided in an
async. |
void |
resetInitialEntity()
Reset initial entity.
|
void |
setAutoFilterExecutionSchedule(List<Double> userExecutionList)
|
void |
setInitialEntity(IEntity initialEntity)
|
void |
setInitialEntity(IEntity initialEntity,
boolean reassignUnassignedNode)
Sets the given
IEntity as the initial Entity. |
void |
setInitialEntityRenewAutoFilterControllers(IEntity initialEntity)
Deprecated.
|
void |
setLicenceKey(String textkey)
Deprecated.
|
void |
setLicense(File file)
Deprecated.
|
void |
setLicense(com.dna.jopt.framework.licensing.IRapotLicense license)
Deprecated.
|
void |
setLicense(ObjectInputStream licensestream)
Deprecated.
|
void |
setLicenseJSON(File file) |
void |
setLicenseJSON(String jsonLic) |
void |
setNodeConnector(INodeEdgeConnector nodeConnector)
Sets the
getNodeConnector() . |
void |
setOptimizationAlgorithmStart(com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart modeSA,
com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart modeGE)
Sets the
initialOptimizationModeGE and initialOptimizationModeSA , both have the default value STATE_MODE_BATCH . |
boolean |
setOptimizationCreator(String creator) |
boolean |
setOptimizationRunIdent(String ident)
Sets the optimization run identification string.
|
void |
setOptimizationScheme(IOptimizationScheme optimizationScheme)
Sets the
IOptimizationScheme . |
void |
setThreadPrefix(String threadPrefix)
Sets the
getThreadPrefix() , the default value is "JOPT-" . |
void |
settleOptimization()
Internally called to settle the optimization, e.g.
|
void |
setUnassignNodeManager(INodeUnassigner unassignNodeManager)
Sets the
INodeUnassigner . |
void |
setUserEntityCoreBuildOptions(Properties userEntityCoreBuildOptions)
|
void |
setWorkEntity(IEntity workEntity)
Sets the
workEntity . |
void |
startAsynchronousOptimizationRun()
Deprecated.
|
CompletableFuture<IOptimizationResult> |
startRunAsync()
Start run async.
|
CompletableFuture<IOptimizationResult> |
startRunAsync(ObjectInputStream license)
Deprecated.
|
IOptimizationResult |
startRunSync(long timeout,
TimeUnit unit)
Start run sync.
|
void |
stopOptimization()
Checks that
getCurrentOptimizationAlgo() is not null , then sets
isStopOptimization() to true and calls IOptimizationAlgorithm.jumpToEnd() . |
protected com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart initialOptimizationModeSA
protected com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart initialOptimizationModeGE
protected String jsonLic
public Optimization()
public Optimization(com.dna.jopt.framework.body.setup.IOptimizationSetup optimizationSetup)
optimizationSetup
- the optimization setuppublic Optimization(com.dna.jopt.framework.body.setup.IOptimizationSetup optimizationSetup, OptimizationEvents optimizationEvents)
optimizationSetup
- the optimization setupoptimizationEvents
- the optimization eventspublic boolean setOptimizationCreator(String creator)
setOptimizationCreator
in interface IOptimization
public Optional<String> getOptimizationCreator()
getOptimizationCreator
in interface IOptimization
public boolean setOptimizationRunIdent(String ident)
IOptimization
setOptimizationRunIdent
in interface IOptimization
ident
- the identpublic String getOptimizationRunIdent()
IOptimization
getOptimizationRunIdent
in interface IOptimization
public void setAutoFilterExecutionSchedule(List<Double> userExecutionList)
IOptimization
setAutoFilterExecutionSchedule
in interface IOptimization
userExecutionList
- the List<Double>
to be set as userExecutionListpublic long getId()
IOptimization
getId
in interface IOptimization
Thread#getId()
public OptimizationEvents getOptimizationEvents()
IOptimization
OptimizationEvents
which are backed by multiple ReplaySubject
and CompletableFuture
. OptimizationEvents
can be used to subscribe to different events of the optimization.getOptimizationEvents
in interface IOptimization
public void setOptimizationAlgorithmStart(com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart modeSA, com.dna.jopt.revision.algorithm.IOptimizationAlgorithm.OptimizationAlgorithmStart modeGE)
IOptimization
initialOptimizationModeGE
and initialOptimizationModeSA
, both have the default value STATE_MODE_BATCH
.setOptimizationAlgorithmStart
in interface IOptimization
modeSA
- the modeSAmodeGE
- the modeGEpublic void putNoneOptimizableNodDetail(String elementId, ILogicRouteElementDetailItem details)
IOptimization
elementId
in getNoneOptimizableElementsDetailHolder()
.putNoneOptimizableNodDetail
in interface IOptimization
elementId
- the string id for the value to be putdetails
- the iLogicRouteElementDetailItem that is supposed to be putprotected void putAllNoneOptimizableNodDetail(Map<String,ILogicRouteElementDetailItem> noneOptimizableElementsDetailHolder)
noneOptimizableElementsDetailHolder
- the none optimizable elements detail holderpublic ILogicRouteElementDetailItem getNoneOptimizableNodDetail(String elementId)
IOptimization
getNoneOptimizableElementsDetailHolder()
for the given
elementId
. This method is primarily used for internal purpose. Please try to extract details
from the route itself.getNoneOptimizableNodDetail
in interface IOptimization
elementId
- the string key for the valueprotected Map<String,ILogicRouteElementDetailItem> getNoneOptimizableElementsDetailHolder()
public void cleanUpNoneOptimizableElementsDetailHolder(Set<String> deadIds)
IOptimization
cleanUpNoneOptimizableElementsDetailHolder
in interface IOptimization
deadIds
- the dead idspublic Map<String,ILogicRouteElementDetailItem> getNoneOptimizableElementsDetails()
IOptimization
getNoneOptimizableElementsDetailHolder()
.getNoneOptimizableElementsDetails
in interface IOptimization
public void requestedAsynchronousOptimizationResult(IOptimizationResult result)
IOptimization
requestedAsynchronousOptimizationResult
in interface IOptimizationEventListener
requestedAsynchronousOptimizationResult
in interface IOptimization
result
- the result to printpublic com.dna.jopt.framework.body.setup.IOptimizationSetup getOptimizationSetup()
IOptimization
IOptimizationSetup
.getOptimizationSetup
in interface IOptimization
public void setOptimizationScheme(IOptimizationScheme optimizationScheme)
IOptimization
IOptimizationScheme
.setOptimizationScheme
in interface IOptimization
optimizationScheme
- the iOptimizationscheme to addpublic IOptimizationScheme getOptimizationScheme()
IOptimization
IOptimizationScheme
.getOptimizationScheme
in interface IOptimization
public void setNodeConnector(INodeEdgeConnector nodeConnector)
IOptimization
getNodeConnector()
.
Cannot be null
.
setNodeConnector
in interface IOptimization
nodeConnector
- the new node connectorpublic INodeEdgeConnector getNodeConnector()
IOptimization
getNodeConnector()
.getNodeConnector
in interface IOptimization
public INodeUnassigner getUnassignNodeManager()
IOptimization
INodeUnassigner
of the optimization.getUnassignNodeManager
in interface IOptimization
public void setUnassignNodeManager(INodeUnassigner unassignNodeManager)
IOptimization
INodeUnassigner
.
Cannot be null
.
setUnassignNodeManager
in interface IOptimization
unassignNodeManager
- the unassign node managerpublic com.dna.jopt.framework.inputplausibility.properties.IPropertyProvider getPropertyProvider()
IOptimization
IOptimizationSetup.getPropertyProvider()
.getPropertyProvider
in interface IOptimization
public void addElement(INode node)
IOptimization
INode
to the optimization.addElement
in interface IOptimization
node
- the element to be added.public void addNodes(List<INode> nodes)
IOptimization
nodes
in the list to the optimization.addNodes
in interface IOptimization
nodes
- the list<INode>
of nodes to be addedpublic void addReassignNodes(List<INode> nodes)
IOptimization
IOptimization.setInitialEntity(com.dna.jopt.member.bucket.entity.IEntity)
, or the
optimization is resumed from a snapshot additional nodes can be added. In contrast to IOptimization.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)
.
addReassignNodes
in interface IOptimization
nodes
- the nodespublic List<INode> getReassignNodes()
getReassignNodes
in interface IOptimization
public void addReassignResources(List<IResource> ress)
IOptimization
IOptimization.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)
.
addReassignResources
in interface IOptimization
ress
- the resourcespublic List<IResource> getReassignResources()
getReassignResources
in interface IOptimization
public void addResources(List<IResource> resources)
IOptimization
resources
in the list to the optimization.addResources
in interface IOptimization
resources
- the list<IResource>
to be addedpublic void addElement(IPillarNode pillarnode)
IOptimization
IPillarNode
to the optimization.addElement
in interface IOptimization
pillarnode
- the pillarnode to be addedpublic void addElement(IResource res)
IOptimization
IResource
to the optimization.addElement
in interface IOptimization
res
- the resourcepublic void addElement(Properties properties)
IOptimization
getUserProperties()
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");
});
}
addElement
in interface IOptimization
properties
- the propertiespublic Optional<Properties> getUserProperties()
IOptimization
getUserProperties
in interface IOptimization
public void setLicenseJSON(String jsonLic)
setLicenseJSON
in interface IOptimization
public void setLicenseJSON(File file) throws IOException
setLicenseJSON
in interface IOptimization
IOException
@Deprecated public void setLicense(File file) throws IOException
IOptimization
setLicense
in interface IOptimization
file
- the keyIOException
- the io exception@Deprecated public void setLicenceKey(String textkey)
IOptimization
setLicenceKey
in interface IOptimization
textkey
- the string new licence key@Deprecated public void setLicense(com.dna.jopt.framework.licensing.IRapotLicense license)
IOptimization
setLicense
in interface IOptimization
license
- the iRapotLicense new license@Deprecated public void setLicense(ObjectInputStream licensestream)
IOptimization
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;
}
}
}
setLicense
in interface IOptimization
licensestream
- the objectinputstream@Deprecated public void startAsynchronousOptimizationRun() throws InvalidLicenceException
IOptimization
IOptimization.startRunSync(long, TimeUnit)
with MAX_VALUE
as long
and MILLISECONDS
as TimeUnit
.startAsynchronousOptimizationRun
in interface IOptimization
InvalidLicenceException
- the invalid licence exceptionpublic IOptimizationResult startRunSync(long timeout, TimeUnit unit) throws InvalidLicenceException, InterruptedException, ExecutionException, TimeoutException
IOptimization
completable future
. The optimization is started
within a ForkJoinPool
. Internally get()
is called on it so
that the code will block until the completable future
returns. 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 timeout
sets the time within which the completable future
needs to
return, otherwise a TimeoutException
is thrown
For use without a timeout please use IOptimization.startRunAsync()
startRunSync
in interface IOptimization
timeout
- the long number of the to be defined time unit until timeoutunit
- the timeUnit of the timeoutInvalidLicenceException
- the invalid licence exceptionInterruptedException
- the interrupted exceptionExecutionException
- the execution exceptionTimeoutException
- the timeout exception if the completable future has not been done
within the timeoutpublic CompletableFuture<IOptimizationResult> startRunAsync() throws InvalidLicenceException
IOptimization
completable future
which is returned.startRunAsync
in interface IOptimization
InvalidLicenceException
- the invalid licence exceptionpublic void prePreparation()
@Deprecated public CompletableFuture<IOptimizationResult> startRunAsync(ObjectInputStream license) throws InvalidLicenceException
IOptimization
startRunAsync
in interface IOptimization
license
- the licenseInvalidLicenceException
- the invalid licence exceptionIOptimization.startRunAsync()
public String getVersionForStatus(String desc, String propertyPrefix, Properties props)
public void setInitialEntity(IEntity initialEntity)
IOptimization
IEntity
as the workEntity and hasEntitySetByUser()
to true
. This method is used to load custom solutions and is used during the loading of
a snapshot.
Will throw an IllegalStateException
if the initial entity is null
.
setInitialEntity
in interface IOptimization
initialEntity
- the new initial entitypublic void resetInitialEntity()
IOptimization
This methods helps to use an existing solution to be used only as data provider, ignoring an existing solution.
resetInitialEntity
in interface IOptimization
@Deprecated public void setInitialEntityRenewAutoFilterControllers(IEntity initialEntity)
IOptimization
hasEntitySetByUser()
and tryRenewAutoFilterController
to true
, then sets the input initialEntity as the getWorkEntity()
.setInitialEntityRenewAutoFilterControllers
in interface IOptimization
initialEntity
- the iEntity to be set as workEntitypublic boolean hasEntitySetByUser()
IOptimization
hasEntitySetByUser()
, the default value is false
.hasEntitySetByUser
in interface IOptimization
public void setInitialEntity(IEntity initialEntity, boolean reassignUnassignedNode)
IOptimization
IEntity
as the initial Entity.setInitialEntity
in interface IOptimization
initialEntity
- the entity to be setreassignUnassignedNode
- the reassign unassigned nodepublic void setWorkEntity(IEntity workEntity)
IOptimization
workEntity
.setWorkEntity
in interface IOptimization
workEntity
- the workEntity to be setpublic void setUserEntityCoreBuildOptions(Properties userEntityCoreBuildOptions)
IOptimization
userEntityCoreBuildOptionsOpt
as an Optional
with the
parameter values if not null
. Will set it as an empty Optional
if null
.setUserEntityCoreBuildOptions
in interface IOptimization
userEntityCoreBuildOptions
- the optional with the given parameterspublic Optional<Properties> getUserEntityCoreBuildOptions()
IOptimization
userEntityCoreBuildOptionsOpt
. The default value is an empty
Optional
.getUserEntityCoreBuildOptions
in interface IOptimization
public IEntity getWorkEntity()
IOptimization
workEntity
.getWorkEntity
in interface IOptimization
public Optional<IOptimizationElement> getOptimizationElement(String id)
IOptimization
getOptimizationElement
in interface IOptimization
id
- the idpublic Optional<IOptimizationElement> getOptimizationElement(String id, boolean includeUnassignedElements)
IOptimization
getOptimizationElement
in interface IOptimization
id
- the idincludeUnassignedElements
- the include unassigned elementspublic Optional<IOptimizationElement> getUnassignedElement(String id)
IOptimization
getUnassignedElement
in interface IOptimization
id
- the idpublic List<IOptimizationElement> getAllElements()
IOptimization
IEntity.getAllEntityElements()
and INodeUnassigner.getUnassignedNodes()
,
then returns all of these elements. Returns a new Arraylist
if these are null
.getAllElements
in interface IOptimization
List<IOptimizationElement>
with all the elementspublic List<IOptimizationElement> getNoneOptimizableElements()
IOptimization
IEntity.getNoneOptimizableElements()
if getWorkEntity()
is
not null
. Otherwise returns a new Arraylist
.getNoneOptimizableElements
in interface IOptimization
List<IOptimizationElement>
public List<IOptimizationElement> getOptimizableElements()
IOptimization
IEntity.getNoneOptimizableElements()
if the IOptimization.getWorkEntity()
is not
null
. Otherwise returns a new Arraylist
.getOptimizableElements
in interface IOptimization
List<IOptimizationElement>
public List<IOptimizationElement> getAllRoutesElements(String resourceId)
IOptimization
IEntity.getAllRoutesElements(String)
, if IOptimization.getWorkEntity()
is not null
.
If the route of the given resource does not have any elements returns a new ArrayList<>
.
getAllRoutesElements
in interface IOptimization
resourceId
- the string resourceIdArrayList<>
of the route elementspublic Optional<ILogicEntityRoute> getFirstMatchingRoute(String nodeId)
IOptimization
getFirstMatchingRoute
in interface IOptimization
nodeId
- the string of the nodeId that is supposed to matchpublic Optional<ILogicEntityRoute> getFirstMatchingRoute(INode node)
IOptimization
getFirstMatchingRoute
in interface IOptimization
node
- the iNode that is supposed to matchpublic List<ILogicEntityRoute> getAnchoredRoutes()
IOptimization
getAnchoredRoutes
in interface IOptimization
public void setThreadPrefix(String threadPrefix)
IOptimization
getThreadPrefix()
, the default value is "JOPT-"
. This
helps to identify the running optimization thread on the user system.setThreadPrefix
in interface IOptimization
threadPrefix
- the prefix to be setpublic String getThreadPrefix()
IOptimization
threadPrefix
, the standard value is "JOPT-"
.getThreadPrefix
in interface IOptimization
public int getOptimizationStage()
IOptimization
OptimizationSubController.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.getOptimizationStage
in interface IOptimization
public com.dna.jopt.revision.algorithm.IOptimizationAlgorithm getCurrentOptimizationAlgo()
IOptimization
OptimizationSubController.getCurrentOptimizationAlgo()
. Returns the currently
running optimization algorithm.getCurrentOptimizationAlgo
in interface IOptimization
public void settleOptimization()
IOptimization
settleOptimization
in interface IOptimization
public void requestResult()
IOptimization
IOptimizationResult result
which will be provided in an
async. manner.
Checks that getCurrentOptimizationAlgo()
is not null
, then
calls IOptimizationAlgorithm.requestResult()
.
requestResult
in interface IOptimization
public void requestProgress()
IOptimization
IOptimizationProgress progress
which will be provided in an async. manner.
Checks that getCurrentOptimizationAlgo()
is not null
, then
calls IOptimizationAlgorithm.requestProgress()
.
requestProgress
in interface IOptimization
public void requestExportState(OutputStream output, String executionId)
IOptimization
requestExportState
in interface IOptimization
output
- the outputexecutionId
- the execution idpublic void requestExportState(OutputStream output, String executionId, Duration timeOut) throws TimeoutException
IOptimization
requestExportState
in interface IOptimization
output
- the outputexecutionId
- the execution idtimeOut
- the time outTimeoutException
- the timeout exceptionpublic void jumpToNextStage()
IOptimization
getCurrentOptimizationAlgo()
is not null
, then calls
IOptimizationAlgorithm.jumpToEnd()
.jumpToNextStage
in interface IOptimization
public void stopOptimization()
IOptimization
getCurrentOptimizationAlgo()
is not null
, then sets
isStopOptimization()
to true
and calls IOptimizationAlgorithm.jumpToEnd()
. This call will trigger a graceful optimization stop
triggering the optimization result.stopOptimization
in interface IOptimization
public boolean isStopOptimization()
IOptimization
isStopOptimization
in interface IOptimization
public void proceed()
IOptimization
getCurrentOptimizationAlgo()
is not null
, then calls
IOptimizationAlgorithm.proceed()
which wakes up all threads that are waiting on this
object's monitor.proceed
in interface IOptimization
IOptimization.pause()
public void pause()
IOptimization
pause
in interface IOptimization
IOptimization.proceed()
@Deprecated public String getVersion()
IOptimization
getVersion
in interface IOptimization
public Properties getCoreVersionProperties()
IOptimization
getCoreVersionProperties
in interface IOptimization
versionCoreProperties
public String getCoreVersion()
IOptimization
getCoreVersion
in interface IOptimization
versionCoreProperties
public boolean cleanUpOptimization()
IOptimization
true
.cleanUpOptimization
in interface IOptimization
@Deprecated public void addDistanceMatrix(double[][] distanceMatrix)
addDistanceMatrix
in interface IOptimization
distanceMatrix
- the distance matrixAdds the distance matrix.
@Deprecated public void addTimeMatrix(double[][] timeMatrix)
addTimeMatrix
in interface IOptimization
timeMatrix
- the time matrixAdds the time matrix.
@Deprecated public void onProgress(String progressString)
IOptimizationEventListener
IOptimizationEventListener.onProgress(IOptimizationProgress)
insteadonProgress
in interface IOptimizationEventListener
progressString
- the winner progress stringpublic void onProgress(IOptimizationProgress progress)
IOptimizationEventListener
onProgress
in interface IOptimizationEventListener
progress
- the cur best entitypublic void onAsynchronousOptimizationResult(IOptimizationResult rapoptResult)
IOptimizationEventListener
onAsynchronousOptimizationResult
in interface IOptimizationEventListener
rapoptResult
- the winnerpublic void onError(int code, String message)
IOptimizationEventListener
onError
in interface IOptimizationEventListener
code
- the codemessage
- the messagepublic void onError(IErrorEvent errorEvent)
IOptimizationEventListener
onError
in interface IOptimizationEventListener
errorEvent
- the error eventpublic void onWarning(int code, String message)
IOptimizationEventListener
onWarning
in interface IOptimizationEventListener
code
- the codemessage
- the messagepublic void onWarning(IWarningEvent warningEvent)
IOptimizationEventListener
onWarning
in interface IOptimizationEventListener
warningEvent
- the i warning eventpublic void onStatus(int code, String message)
IOptimizationEventListener
onStatus
in interface IOptimizationEventListener
code
- the codemessage
- the messagepublic void onStatus(IStatusEvent statusEvent)
IOptimizationEventListener
onStatus
in interface IOptimizationEventListener
statusEvent
- the status eventpublic void onNodeFiltering(int code, String message, List<INodeFilterReason> filterReasons)
IOptimizationEventListener
onNodeFiltering
in interface IOptimizationEventListener
code
- the codemessage
- the messagefilterReasons
- the filter reasonspublic void onNodeFiltering(NodeFilteringEvent nodeFilteringEvent)
IOptimizationEventListener
onNodeFiltering
in interface IOptimizationEventListener
nodeFilteringEvent
- the node filtering eventpublic void onRequestCodeExecutionDone(String executionId)
IOptimizationEventListener
onRequestCodeExecutionDone
in interface IOptimizationEventListener
executionId
- the execution idpublic void onBeforeNodeFilteringOptimizationResult(IOptimizationResult requestedresult)
onBeforeNodeFilteringOptimizationResult
in interface IOptimizationEventListener
public void onAfterNodeFilteringOptimizationResult(IOptimizationResult requestedresult)
onAfterNodeFilteringOptimizationResult
in interface IOptimizationEventListener
Copyright © 2017–2023 DNA Evolutions GmbH. All rights reserved.