$darkmode
DENOPTIM
denoptim.fragspace.APMapFinder Class Reference

An utility class to encapsulate the search for an AttachmentPoint-AttachmentPoint mapping. More...

Collaboration diagram for denoptim.fragspace.APMapFinder:
[legend]

Public Member Functions

 APMapFinder (FragmentSpace fragSpace, Vertex vA, Vertex vB, boolean screenAll)
 Constructor that launches the search for a mapping between the AttachmentPoints on the first vertex to those of the second. More...
 
 APMapFinder (FragmentSpace fragSpace, Vertex vA, Vertex vB, APMapping fixedRootAPs, boolean screenAll, boolean onlyCompleteMappings, boolean compatibleIfFree)
 Constructor that launches the search for a mapping between the AttachmentPoints on the first vertex to those of the second. More...
 
 APMapFinder (FragmentSpace fragSpace, List< AttachmentPoint > lstA, List< AttachmentPoint > needyAPsA, List< AttachmentPoint > lstB, List< AttachmentPoint > needyAPsB, APMapping fixedRootAPs, boolean screenAll, boolean onlyCompleteMappings, boolean compatibleIfFree)
 Constructor that launches the search for a mapping between the AttachmentPoints on two lists. More...
 
boolean foundMapping ()
 Returns true if any mapping has been found. More...
 
APMapping getChosenAPMapping ()
 Returns the AttachmentPoint-AttachmentPoint mapping chosen among the possible mappings. More...
 
List< APMappinggetAllAPMappings ()
 Returns all AttachmentPoint-AttachmentPoint mapping found. More...
 

Static Public Member Functions

static LinkedHashMap< AttachmentPoint, List< AttachmentPoint > > findMappingCompatibileAPs (List< AttachmentPoint > lstA, List< AttachmentPoint > lstB, boolean compatibleIfFree, FragmentSpace fragSpace)
 Compares the AttachmentPoint of two lists searching for all the APs of the second list that are "compatible" with each of the APs of the first list. More...
 

Private Member Functions

void findAllMappings (List< AttachmentPoint > lstA, List< AttachmentPoint > needyAPsA, List< AttachmentPoint > lstB, List< AttachmentPoint > needyAPsB, APMapping fixedRootAPs, boolean screenAll, boolean onlyCompleteMappings, boolean compatibleIfFree)
 Searches for mappings between the AttachmentPoints on the two lists. More...
 

Private Attributes

APMapping chosenAPMap
 The chosen AttachmentPoint-AttachmentPoint mapping. More...
 
List< APMappingallAPMappings = new ArrayList<APMapping>()
 The collection of all AttachmentPoint-AttachmentPoint mappings that have been found. More...
 
FragmentSpace fragSpace = null
 Program-specific fragment space. More...
 

Static Private Attributes

static int maxCombs = 250
 Maximum number of combinations. More...
 

Detailed Description

An utility class to encapsulate the search for an AttachmentPoint-AttachmentPoint mapping.

Ignores symmetry, which is a potential thing to improve.

Author
Marco Foscato

Definition at line 41 of file APMapFinder.java.

Constructor & Destructor Documentation

◆ APMapFinder() [1/3]

denoptim.fragspace.APMapFinder.APMapFinder ( FragmentSpace  fragSpace,
Vertex  vA,
Vertex  vB,
boolean  screenAll 
)

Constructor that launches the search for a mapping between the AttachmentPoints on the first vertex to those of the second.

Note that if APs are available throughout any template barrier we consider only the existence of an AP to be a reason for a compatible AP-AP mapping, irrespectively of the APClass. All APs that are available (i.e., available throughout the templates barriers) will be considered compatible because they do not have any requirement from APClass compatibility rules or bond types. The present status of the APs on each vertex (i.e., whether they are used or available as defined by the DGraph#getInterfaceAPs(List) method when considering a single-vertex subgraph) determines which APs will be required to have a mapping.

Parameters
fragSpacethe fragment space to use.
vAthe first vertex.
vBthe second vertex.
screenAlluse true to NOT stop at the first compatible combinations.

Definition at line 94 of file APMapFinder.java.

References denoptim.fragspace.APMapFinder.fragSpace.

◆ APMapFinder() [2/3]

denoptim.fragspace.APMapFinder.APMapFinder ( FragmentSpace  fragSpace,
Vertex  vA,
Vertex  vB,
APMapping  fixedRootAPs,
boolean  screenAll,
boolean  onlyCompleteMappings,
boolean  compatibleIfFree 
)

Constructor that launches the search for a mapping between the AttachmentPoints on the first vertex to those of the second.

Note that if APs are available throughout any template barrier we consider only the existence of an AP to be a reason for a compatible AP-AP mapping, irrespectively of the APClass. The present status of the APs on each vertex (i.e., whether they are used or available as defined by the DGraph#getInterfaceAPs(List) method when considering a single-vertex subgraph) determines which APs will be required to have a mapping.

Parameters
fragSpacethe fragment space to use.
vAthe first vertex.
vBthe second vertex.
fixedRootAPsif not null, sets a required mapping that must be present in the all the AP mappings.
screenAlluse true to NOT stop at the first compatible combinations.
onlyCompleteMappingsuse true to collect only mappings that include all of the APs on the first vertex.
compatibleIfFreeuse true to make APs that are available (i.e., available throughout the template barriers) be compatible.

Definition at line 125 of file APMapFinder.java.

References denoptim.fragspace.APMapFinder.findAllMappings(), denoptim.fragspace.APMapFinder.fragSpace, denoptim.graph.Vertex.getAttachmentPoints(), denoptim.graph.Vertex.getGraphOwner(), and denoptim.graph.DGraph.getInterfaceAPs().

Here is the call graph for this function:

◆ APMapFinder() [3/3]

denoptim.fragspace.APMapFinder.APMapFinder ( FragmentSpace  fragSpace,
List< AttachmentPoint lstA,
List< AttachmentPoint needyAPsA,
List< AttachmentPoint lstB,
List< AttachmentPoint needyAPsB,
APMapping  fixedRootAPs,
boolean  screenAll,
boolean  onlyCompleteMappings,
boolean  compatibleIfFree 
)

Constructor that launches the search for a mapping between the AttachmentPoints on two lists.

Note that if APs are available throughout any template barrier we consider only the existence of an AP to be a reason for a compatible AP-AP mapping, irrespectively of the APClass.

Parameters
lstAthe first list.
needyAPsAa subset of the attachment points in the first list and that are required to have appear in any mapping.
lstBthe second list.
needyAPsBa subset of the attachment points in the second list and that are required to have appear in any mapping.
fixedRootAPsif not null, sets a required mapping that must be present in the all the AP mappings.
screenAlluse true to NOT stop at the first compatible combinations.
onlyCompleteMappingsuse true to collect only mappings that include all of the APs on the first vertex.
compatibleIfFreeuse true to make APs that are available (i.e., available throughout the template barriers) be compatible.

Definition at line 174 of file APMapFinder.java.

References denoptim.fragspace.APMapFinder.findAllMappings(), and denoptim.fragspace.APMapFinder.fragSpace.

Here is the call graph for this function:

Member Function Documentation

◆ findAllMappings()

void denoptim.fragspace.APMapFinder.findAllMappings ( List< AttachmentPoint lstA,
List< AttachmentPoint needyAPsA,
List< AttachmentPoint lstB,
List< AttachmentPoint needyAPsB,
APMapping  fixedRootAPs,
boolean  screenAll,
boolean  onlyCompleteMappings,
boolean  compatibleIfFree 
)
private

Searches for mappings between the AttachmentPoints on the two lists.

Note that is APs are available throughout any template barrier we consider only the existence of an AP to be a reason for a compatible AP-AP mapping, irrespectively of the APClass.

Parameters
lstAthe first list
lstBthe second list.
fixedRootAPsif not null, sets a required mapping that will be added to all the AP mappings.
screenAlluse true to NOT stop at the first compatible combinations.
onlyCompleteMappingsuse true to collect only mappings that include all of the APs on the first vertex.
compatibleIfFreeuse true to make APs that are available (i.e., available throughout the template barriers) be compatible.

Definition at line 206 of file APMapFinder.java.

References denoptim.fragspace.APMapFinder.allAPMappings, denoptim.fragspace.APMapFinder.chosenAPMap, denoptim.graph.APMapping.clone(), denoptim.fragspace.APMapFinder.findMappingCompatibileAPs(), denoptim.fragspace.APMapFinder.fragSpace, denoptim.fragspace.FragmentSpace.getRandomizer(), denoptim.fragspace.APMapFinder.maxCombs, denoptim.utils.Randomizer.randomlyChooseOne(), and denoptim.fragspace.FragmentSpaceUtils.recursiveCombiner().

Referenced by denoptim.fragspace.APMapFinder.APMapFinder().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findMappingCompatibileAPs()

static LinkedHashMap< AttachmentPoint, List< AttachmentPoint > > denoptim.fragspace.APMapFinder.findMappingCompatibileAPs ( List< AttachmentPoint lstA,
List< AttachmentPoint lstB,
boolean  compatibleIfFree,
FragmentSpace  fragSpace 
)
static

Compares the AttachmentPoint of two lists searching for all the APs of the second list that are "compatible" with each of the APs of the first list.

Note that "compatible" does not mean APClass- compatible to form connection, but that can be interchanges, i.e., one AP from the second list is compatible with one from the first list, if it can replace the latter in whatever role that AP has.

Parameters
lstAthe first list of APs.
lstBthe second list ofAPs.
compatibleIfFreeuse true to make APs that are available (i.e., available throughout the template barriers) be compatible.
Returns
the map between the APs in the first list (keys) and the list (value) of all those from the second list that are "compatible" with it.

Definition at line 404 of file APMapFinder.java.

References denoptim.fragspace.APMapFinder.fragSpace, denoptim.graph.AttachmentPoint.getAPClass(), denoptim.graph.AttachmentPoint.getLinkedAPThroughout(), denoptim.graph.AttachmentPoint.isAvailableThroughout(), denoptim.graph.APClass.isCPMapCompatibleWith(), and denoptim.fragspace.FragmentSpace.useAPclassBasedApproach().

Referenced by denoptim.fragspace.APMapFinder.findAllMappings(), and denoptim.fragspace.APMapFinderTest.testFindMappingCompatibileAPs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ foundMapping()

boolean denoptim.fragspace.APMapFinder.foundMapping ( )

Returns true if any mapping has been found.

Returns
true if any mapping has been found.

Definition at line 542 of file APMapFinder.java.

References denoptim.fragspace.APMapFinder.allAPMappings.

Referenced by denoptim.ga.GraphOperations.checkAndAddXoverSites(), denoptim.fragspace.GraphLinkFinder.GraphLinkFinder(), denoptim.ga.GraphOperations.performCrossover(), denoptim.fragspace.APMapFinderTest.testAPMapFinder(), denoptim.fragspace.APMapFinderTest.testAPMapFinder_ConstrainAll(), and denoptim.fragspace.APMapFinderTest.testAPMapFinder_Constrained().

Here is the caller graph for this function:

◆ getAllAPMappings()

List< APMapping > denoptim.fragspace.APMapFinder.getAllAPMappings ( )

Returns all AttachmentPoint-AttachmentPoint mapping found.

Returns
the collection of all AP mappings (can be empty, but not null) found. This is either the total amount of possible mappings or the amount found before stopping to prevent combinatorial explosion.

Definition at line 572 of file APMapFinder.java.

References denoptim.fragspace.APMapFinder.allAPMappings.

Referenced by denoptim.fragspace.GraphLinkFinder.GraphLinkFinder(), denoptim.fragspace.APMapFinderTest.testAPMapFinder(), denoptim.fragspace.APMapFinderTest.testAPMapFinder_ConstrainAll(), and denoptim.fragspace.APMapFinderTest.testAPMapFinder_Constrained().

Here is the caller graph for this function:

◆ getChosenAPMapping()

APMapping denoptim.fragspace.APMapFinder.getChosenAPMapping ( )

Returns the AttachmentPoint-AttachmentPoint mapping chosen among the possible mappings.

If more than one possible mapping exist, then this will return a randomly chosen one.

Returns
the chosen AP mapping or null is none was found.

Definition at line 557 of file APMapFinder.java.

References denoptim.fragspace.APMapFinder.chosenAPMap.

Referenced by denoptim.fragspace.GraphLinkFinder.GraphLinkFinder(), denoptim.ga.GraphOperations.performCrossover(), denoptim.fragspace.APMapFinderTest.testAPMapFinder(), and denoptim.fragspace.APMapFinderTest.testAPMapFinder_ConstrainAll().

Here is the caller graph for this function:

Member Data Documentation

◆ allAPMappings

List<APMapping> denoptim.fragspace.APMapFinder.allAPMappings = new ArrayList<APMapping>()
private

◆ chosenAPMap

APMapping denoptim.fragspace.APMapFinder.chosenAPMap
private

The chosen AttachmentPoint-AttachmentPoint mapping.

In case of multiple possible AP mappings, the result reported here is a randomly chosen one among the possible ones.

Definition at line 49 of file APMapFinder.java.

Referenced by denoptim.fragspace.APMapFinder.findAllMappings(), and denoptim.fragspace.APMapFinder.getChosenAPMapping().

◆ fragSpace

FragmentSpace denoptim.fragspace.APMapFinder.fragSpace = null
private

◆ maxCombs

int denoptim.fragspace.APMapFinder.maxCombs = 250
staticprivate

Maximum number of combinations.

This prevents combinatorial explosion, but it is ignored if the constructor is required to screen all. Remember that the combinations are anyway randomized, so even with the maximum limit on the number of combination to consider, there is no systematic exclusion of specific combinations.

Definition at line 65 of file APMapFinder.java.

Referenced by denoptim.fragspace.APMapFinder.findAllMappings().


The documentation for this class was generated from the following file: