Class BMSSCSolution
java.lang.Object
es.urjc.etsii.grafo.solution.Solution<BMSSCSolution,BMSSCInstance>
es.urjc.etsii.grafo.bmssc.model.sol.BMSSCSolution
-
Field Summary
Fields inherited from class es.urjc.etsii.grafo.solution.Solution
lastModifiedTime, lastMoves -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecachedAssignCost(int a, int k) doublecalculateAssignCost(int a, int k) Clone the current solution.intclusterOf(int a) Get the set a point is inside ofstatic double[]costPerCluster(BMSSCInstance instance, Set<Integer>[] solution) booleanvoidgetCluster(int i) intgetClusterSize(int i) int[]doublegetScore()booleanisAssigned(int a) Checks if a point is asigned to a clusterbooleanisFullCluster(int cluster) Checks if a cluster is full.doublevoidrelaxClusterSizeConstraint(float margin) Relax cluster size constraint, by the given margin.voidRestore cluster size constraint to the feasible value provided by the instancestatic doublescore(BMSSCInstance instance, Set<Integer>[] solution) Calculate the score of a set of points without using a solution, and without side effects, used for validation purposestoString()Resume this solution Generate a toString method using your IDEMethods inherited from class es.urjc.etsii.grafo.solution.Solution
customProperties, getInstance, getLastModifiedTime, getVersion, lastExecutesMoves, lastExecutesMovesAsString, notifyUpdate, notifyUpdate
-
Constructor Details
-
BMSSCSolution
-
BMSSCSolution
-
-
Method Details
-
score
Calculate the score of a set of points without using a solution, and without side effects, used for validation purposes- Parameters:
instance- current instancesolution- Solution data- Returns:
- Score calculated from scratch.
-
costPerCluster
-
relaxClusterSizeConstraint
public void relaxClusterSizeConstraint(float margin) Relax cluster size constraint, by the given margin. New cluster sizes will be clusterSize * (1 + margin) Subsequent calls to this method do NOT further relax the constraint.- Parameters:
margin- margin, must be greater or equal to zero.
-
restoreClusterSizeConstraint
public void restoreClusterSizeConstraint()Restore cluster size constraint to the feasible value provided by the instance -
cloneSolution
Description copied from class:SolutionClone the current solution. Deep clone mutable data or you will regret it.- Specified by:
cloneSolutionin classSolution<BMSSCSolution,BMSSCInstance> - Returns:
- A deep clone of the current solution
-
getScore
public double getScore() -
recalculateScore
public double recalculateScore() -
toString
Description copied from class:SolutionResume this solution Generate a toString method using your IDE- Specified by:
toStringin classSolution<BMSSCSolution,BMSSCInstance> - Returns:
- string representation of the current solution
-
getClusterSize
public int getClusterSize(int i) -
getClusterSizes
public int[] getClusterSizes() -
feasibleClusterSizes
public boolean feasibleClusterSizes() -
getCluster
-
getNotAssignedPoints
-
generateCachedScore
public void generateCachedScore() -
isFullCluster
public boolean isFullCluster(int cluster) Checks if a cluster is full. Checks if the cluster size restriction is relaxed, and takes it into account- Parameters:
cluster- cluster to check- Returns:
- true if the current cluster size is equals to its assigned size, false otherwise
-
clusterOf
public int clusterOf(int a) Get the set a point is inside of- Parameters:
a- Point to get which cluster is assigned to- Returns:
- the cluster ID, or -1 if the point is not assigned yet
-
cachedAssignCost
public double cachedAssignCost(int a, int k) -
calculateAssignCost
public double calculateAssignCost(int a, int k) -
isAssigned
public boolean isAssigned(int a) Checks if a point is asigned to a cluster- Parameters:
a- Point to check- Returns:
- true if assigned to a cluster, false otherwise
-