Fix typo: clustring -> clustering

parent 685288af
......@@ -12,7 +12,7 @@ o Order all sub components by name (neccessary for the adjacency matrix).
o Create adjacency matrix to use with a clustering algorithm, with subcomponents as nodes and connectors between subcomponents as vertices. Sift out all connectors to the super component.
2) Feed adjacency matrix into the selected clustering algorithm
o We are using the machine learning library "smile ml" (see: https://github.com/haifengl/smile) which provides a broad range of different clustering and partitioning approaches. As a prime example we are using "spectral clustering" here. For a closer look at this approach, see the section below.
o The clustring algorithm yields multiple cluster labels with the clustered entries of the adjacency matrix assigned to them. We have to convert them back to a set of symbol tables of components representing the clusters.
o The clustering algorithm yields multiple cluster labels with the clustered entries of the adjacency matrix assigned to them. We have to convert them back to a set of symbol tables of components representing the clusters.
3) Generate middleware tags separating the clusters
o This will build the cluster-to-ROS connections.
o We won’t take account of ports of the super component and only consider connected top level components.
......
......@@ -2,6 +2,7 @@ package de.monticore.lang.monticar.generator.middleware;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.middleware.cli.ClusteringParameters;
import de.monticore.lang.monticar.generator.middleware.clustering.ClusterFromTagsHelper;
import de.monticore.lang.monticar.generator.middleware.helpers.*;
import de.monticore.lang.monticar.generator.middleware.impls.GeneratorImpl;
......@@ -26,6 +27,7 @@ public class DistributedTargetGenerator extends CMakeGenerator {
private Set<String> subDirs = new HashSet<>();
private ClusteringParameters clusteringParameters;
public DistributedTargetGenerator() {
}
......
......@@ -13,19 +13,19 @@ public class CliParameters {
private Set<String> generators;
private String emadlBackend;
private Boolean writeTagFile;
private ClustringParameters clustringParameters;
private ClusteringParameters clusteringParameters;
public CliParameters() {
}
public CliParameters(String modelsDir, String outputDir, String rootModel, Set<String> generators, String emadlBackend, Boolean writeTagFile, ClustringParameters clustringParameters) {
public CliParameters(String modelsDir, String outputDir, String rootModel, Set<String> generators, String emadlBackend, Boolean writeTagFile, ClusteringParameters clusteringParameters) {
this.modelsDir = modelsDir;
this.outputDir = outputDir;
this.rootModel = rootModel;
this.generators = generators;
this.emadlBackend = emadlBackend;
this.writeTagFile = writeTagFile;
this.clustringParameters = clustringParameters;
this.clusteringParameters = clusteringParameters;
}
public String getModelsDir() {
......@@ -52,8 +52,8 @@ public class CliParameters {
return writeTagFile == null ? DEFAULT_WRITE_TAG_FILE : writeTagFile;
}
public Optional<ClustringParameters> getClustringParameters() {
return Optional.ofNullable(clustringParameters);
public Optional<ClusteringParameters> getClusteringParameters() {
return Optional.ofNullable(clusteringParameters);
}
}
......@@ -6,12 +6,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ClustringParameters {
public class ClusteringParameters {
private Integer numberOfClusters;
private ResultChoosingStrategy chooseBy = ResultChoosingStrategy.bestWithFittingN;
private List<AlgorithmCliParameters> algorithmParameters = new ArrayList<>();
public ClustringParameters() {
public ClusteringParameters() {
}
public Optional<Integer> getNumberOfClusters() {
......
......@@ -12,7 +12,7 @@ public class AffinityPropagationCliParameters extends AlgorithmCliParameters{
}
@Override
public ClusteringAlgorithm asClustringAlgorithm() {
public ClusteringAlgorithm asClusteringAlgorithm() {
return new AffinityPropagationAlgorithm();
}
......
......@@ -18,7 +18,7 @@ public abstract class AlgorithmCliParameters {
return name;
}
public abstract ClusteringAlgorithm asClustringAlgorithm();
public abstract ClusteringAlgorithm asClusteringAlgorithm();
public abstract List<Object> asAlgorithmArgs();
......
......@@ -23,7 +23,7 @@ public class DBScanCliParameters extends AlgorithmCliParameters {
}
@Override
public ClusteringAlgorithm asClustringAlgorithm() {
public ClusteringAlgorithm asClusteringAlgorithm() {
DBSCANClusteringAlgorithm dbscanClusteringAlgorithm = new DBSCANClusteringAlgorithm();
dbscanClusteringAlgorithm.setArgs(asAlgorithmArgs());
return dbscanClusteringAlgorithm;
......
......@@ -23,7 +23,7 @@ public class MarkovCliParameters extends AlgorithmCliParameters {
}
@Override
public ClusteringAlgorithm asClustringAlgorithm() {
public ClusteringAlgorithm asClusteringAlgorithm() {
MarkovClusteringAlgorithm markovClusteringAlgorithm = new MarkovClusteringAlgorithm();
markovClusteringAlgorithm.setArgs(asAlgorithmArgs());
return markovClusteringAlgorithm;
......
......@@ -23,7 +23,7 @@ public class SpectralClusteringCliParameters extends AlgorithmCliParameters {
}
@Override
public ClusteringAlgorithm asClustringAlgorithm() {
public ClusteringAlgorithm asClusteringAlgorithm() {
SpectralClusteringAlgorithm clusteringAlgorithm = new SpectralClusteringAlgorithm();
clusteringAlgorithm.setArgs(asAlgorithmArgs());
return clusteringAlgorithm;
......
......@@ -15,7 +15,7 @@ public class UnknownAlgorithmCliParameters extends AlgorithmCliParameters {
}
@Override
public ClusteringAlgorithm asClustringAlgorithm() {
public ClusteringAlgorithm asClusteringAlgorithm() {
return null;
}
......
......@@ -2,7 +2,7 @@ package de.monticore.lang.monticar.generator.middleware;
import de.monticore.lang.monticar.generator.middleware.cli.CliParametersLoader;
import de.monticore.lang.monticar.generator.middleware.cli.CliParameters;
import de.monticore.lang.monticar.generator.middleware.cli.ClustringParameters;
import de.monticore.lang.monticar.generator.middleware.cli.ClusteringParameters;
import de.monticore.lang.monticar.generator.middleware.cli.ResultChoosingStrategy;
import de.monticore.lang.monticar.generator.middleware.cli.algorithms.*;
import org.junit.Test;
......@@ -27,27 +27,27 @@ public class ParameterLoadingTest {
@Test
public void testClusterParamsDefaultValues() throws FileNotFoundException {
CliParameters params = loadCliParameters("clusterParamsDefaultValues");
ClustringParameters clustringParameters = params.getClustringParameters().get();
assertFalse(clustringParameters.getNumberOfClusters().isPresent());
assertEquals(ResultChoosingStrategy.bestWithFittingN, clustringParameters.getChooseBy());
assertTrue(clustringParameters.getAlgorithmParameters().isEmpty());
ClusteringParameters clusteringParameters = params.getClusteringParameters().get();
assertFalse(clusteringParameters.getNumberOfClusters().isPresent());
assertEquals(ResultChoosingStrategy.bestWithFittingN, clusteringParameters.getChooseBy());
assertTrue(clusteringParameters.getAlgorithmParameters().isEmpty());
}
@Test
public void testClusterParamsNoAlgo() throws FileNotFoundException {
CliParameters params = loadCliParameters("clusterParamsNoAlgo");
ClustringParameters clustringParameters = params.getClustringParameters().get();
assertEquals(3, (long) clustringParameters.getNumberOfClusters().get());
assertEquals(ResultChoosingStrategy.bestOverall, clustringParameters.getChooseBy());
assertTrue(clustringParameters.getAlgorithmParameters().isEmpty());
ClusteringParameters clusteringParameters = params.getClusteringParameters().get();
assertEquals(3, (long) clusteringParameters.getNumberOfClusters().get());
assertEquals(ResultChoosingStrategy.bestOverall, clusteringParameters.getChooseBy());
assertTrue(clusteringParameters.getAlgorithmParameters().isEmpty());
}
@Test
public void testClusterParamsAllAlgos() throws FileNotFoundException {
CliParameters params = loadCliParameters("clusterParamsAllAlgos");
ClustringParameters clustringParameters = params.getClustringParameters().get();
ClusteringParameters clusteringParameters = params.getClusteringParameters().get();
List<AlgorithmCliParameters> algorithmParameters = clustringParameters.getAlgorithmParameters();
List<AlgorithmCliParameters> algorithmParameters = clusteringParameters.getAlgorithmParameters();
assertEquals(4, algorithmParameters.size());
Map<String, AlgorithmCliParameters> nameToParams = new HashMap<>();
......@@ -88,9 +88,9 @@ public class ParameterLoadingTest {
@Test
public void testClusterParamsInvalidAlgos() throws FileNotFoundException {
CliParameters params = loadCliParameters("clusterParamsInvalidAlgos");
ClustringParameters clustringParameters = params.getClustringParameters().get();
ClusteringParameters clusteringParameters = params.getClusteringParameters().get();
List<AlgorithmCliParameters> algorithmParameters = clustringParameters.getAlgorithmParameters();
List<AlgorithmCliParameters> algorithmParameters = clusteringParameters.getAlgorithmParameters();
assertEquals(2, algorithmParameters.size());
assertTrue(algorithmParameters.get(0) instanceof UnknownAlgorithmCliParameters);
......
......@@ -3,7 +3,7 @@
"outputDir": "target/cliTest/validConfigFile",
"rootModel": "tests.a.addComp",
"generators": ["cpp","roscpp"],
"clustringParameters":{
"clusteringParameters":{
"algorithmParameters":[
{
"name":"SpectralClustering",
......
......@@ -3,6 +3,6 @@
"outputDir": "target/cliTest/validConfigFile",
"rootModel": "tests.a.addComp",
"generators": ["cpp","roscpp"],
"clustringParameters":{
"clusteringParameters":{
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
"outputDir": "target/cliTest/validConfigFile",
"rootModel": "tests.a.addComp",
"generators": ["cpp","roscpp"],
"clustringParameters":{
"clusteringParameters":{
"algorithmParameters":[
{
"name":"Invalid"
......
......@@ -3,7 +3,7 @@
"outputDir": "target/cliTest/validConfigFile",
"rootModel": "tests.a.addComp",
"generators": ["cpp","roscpp"],
"clustringParameters":{
"clusteringParameters":{
"numberOfClusters":3,
"chooseBy":"bestOverall"
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment