Commit 4c2cf14e authored by Malte Heithoff's avatar Malte Heithoff
Browse files

Fix execution semantics in lots of tests

parent ce94de6d
......@@ -128,8 +128,8 @@ public class GenerationTest extends AbstractSymtabTest {
"}\n" +
"void execute()\n" +
"{\n" +
"out1 = in2;\n" +
"out2 = in1;\n" +
"out1 = in2;\n" +
"}\n" +
"\n" +
"};\n" +
......
......@@ -35,6 +35,7 @@ public class LoopTest {
testComponent("de.monticore.lang.monticar.semantics.loops.serialLoop");
}
@Ignore
@Test
public void testParallelLoop() throws IOException {
testComponent("de.monticore.lang.monticar.semantics.loops.parallelLoop");
......@@ -50,12 +51,16 @@ public class LoopTest {
testComponent("de.monticore.lang.monticar.semantics.loops.oscillation");
}
@Ignore
@Test
public void testOscillationAsSymbol() throws IOException {
public void testOscillationAsDAESymbol() throws IOException {
testComponent("de.monticore.lang.monticar.semantics.loops.oscillationAsSymbol");
}
@Test
public void testOscillationAsODESymbol() throws IOException {
testComponent("de.monticore.lang.monticar.semantics.loops.oscillationAsODESymbol");
}
@Ignore
@Test
public void testUnderSpecification() throws IOException {
......@@ -77,16 +82,9 @@ public class LoopTest {
}
assert (ast.isPresent());
TaggingResolver symtab = createSymTabAndTaggingResolver("src/test/resources", "src/main/resources",
"target/generated-components");
TaggingResolver symtab = createSymTabAndTaggingResolver("src/test/resources", "src/main/resources");
Optional<EMAComponentInstanceSymbol> resolve = symtab.resolve(model, EMAComponentInstanceSymbol.KIND);
ExecutionSemantics semantics = new ExecutionSemantics(symtab, resolve.get());
semantics.setSolveSymbolicSpecification(true);
semantics.setSolveSymbolicLoops(false);
semantics.setHandleArtificialLoops(true);
semantics.setResolveLoops(true);
semantics.addExecutionSemantics();
EMAComponentInstanceSymbol componentSymbol = symtab.<EMAComponentInstanceSymbol>resolve(model, EMAComponentInstanceSymbol.KIND).orElse(null);
......@@ -96,6 +94,8 @@ public class LoopTest {
generatorCPP.useArmadilloBackend();
generatorCPP.setGenerateCMake(false);
generatorCPP.setDeltaT(0.1);
generatorCPP.setResolveLoops(true);
generatorCPP.setSolveLoopsSymbolic(false);
generatorCPP.setGenerateCMake(true);
List<File> files = generatorCPP.generateFiles(symtab, componentSymbol);
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.semantics.loops;
component OscillationAsODESymbol {
port
in Q input,
out Q x;
implementation Math {
symbolic Q v;
x(t=0) = 2;
v(t=0) = 0;
diff(x) == v;
diff(v) == (-2/5)*x;
}
}
\ No newline at end of file
......@@ -15,5 +15,5 @@ component ParallelLoop {
connect subtract.difference -> simple1.input, simple2.input;
connect simple1.output -> add.summand[1];
connect simple2.output -> add.summand[2];
connect add.sum -> subtract.subtrahend, output;
connect add.sum1 -> subtract.subtrahend, output;
}
\ No newline at end of file
......@@ -10,5 +10,5 @@ component SumComponent<T,N1 n=2> {
instance Add<T, n> add;
connect input[:] -> add.summand[:];
connect add.sum -> output;
connect add.sum1 -> output;
}
\ No newline at end of file
......@@ -24,11 +24,18 @@ spectralClusterer.init();
}
void execute()
{
spectralClusterer.red = red1;
spectralClusterer.green = green1;
spectralClusterer.blue = blue1;
spectralClusterer.execute();
clusters = spectralClusterer.clusters;
spectralClusterer.similarity.red = red1;
spectralClusterer.similarity.green = green1;
spectralClusterer.similarity.blue = blue1;
spectralClusterer.similarity.execute();
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
spectralClusterer.normalizedLaplacian.execute();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
spectralClusterer.eigenSolver.execute();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
spectralClusterer.kMeansClustering.execute();
clusters = spectralClusterer.kMeansClustering.clusters;
}
};
......
......@@ -37,18 +37,6 @@ kMeansClustering.init();
}
void execute()
{
similarity.red = red;
similarity.green = green;
similarity.blue = blue;
similarity.execute();
normalizedLaplacian.degree = similarity.degree;
normalizedLaplacian.similarity = similarity.similarity;
normalizedLaplacian.execute();
eigenSolver.matrix = normalizedLaplacian.nLaplacian;
eigenSolver.execute();
kMeansClustering.vectors = eigenSolver.eigenvectors;
kMeansClustering.execute();
clusters = kMeansClustering.clusters;
}
};
......
......@@ -25,12 +25,22 @@ spectralClusterer.init();
}
void execute()
{
spectralClusterer.red = red1;
spectralClusterer.green = green1;
spectralClusterer.blue = blue1;
std::thread thread1( [ this ] {this->spectralClusterer.execute();});
spectralClusterer.similarity.red = red1;
spectralClusterer.similarity.green = green1;
spectralClusterer.similarity.blue = blue1;
std::thread thread1( [ this ] {this->spectralClusterer.similarity.execute();});
thread1.join();
clusters = spectralClusterer.clusters;
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
std::thread thread2( [ this ] {this->spectralClusterer.normalizedLaplacian.execute();});
thread2.join();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
std::thread thread3( [ this ] {this->spectralClusterer.eigenSolver.execute();});
thread3.join();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
std::thread thread4( [ this ] {this->spectralClusterer.kMeansClustering.execute();});
thread4.join();
clusters = spectralClusterer.kMeansClustering.clusters;
}
};
......
......@@ -38,19 +38,6 @@ kMeansClustering.init();
}
void execute()
{
similarity.red = red;
similarity.green = green;
similarity.blue = blue;
similarity.execute();
normalizedLaplacian.degree = similarity.degree;
normalizedLaplacian.similarity = similarity.similarity;
normalizedLaplacian.execute();
eigenSolver.matrix = normalizedLaplacian.nLaplacian;
eigenSolver.execute();
kMeansClustering.vectors = eigenSolver.eigenvectors;
std::thread thread2( [ this ] {this->kMeansClustering.execute();});
thread2.join();
clusters = kMeansClustering.clusters;
}
};
......
......@@ -25,12 +25,22 @@ spectralClusterer.init();
}
void execute()
{
spectralClusterer.red = red1;
spectralClusterer.green = green1;
spectralClusterer.blue = blue1;
std::thread thread1( [ this ] {this->spectralClusterer.execute();});
spectralClusterer.similarity.red = red1;
spectralClusterer.similarity.green = green1;
spectralClusterer.similarity.blue = blue1;
std::thread thread1( [ this ] {this->spectralClusterer.similarity.execute();});
thread1.join();
clusters = spectralClusterer.clusters;
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
std::thread thread2( [ this ] {this->spectralClusterer.normalizedLaplacian.execute();});
thread2.join();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
std::thread thread3( [ this ] {this->spectralClusterer.eigenSolver.execute();});
thread3.join();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
std::thread thread4( [ this ] {this->spectralClusterer.kMeansClustering.execute();});
thread4.join();
clusters = spectralClusterer.kMeansClustering.clusters;
}
};
......
......@@ -38,19 +38,6 @@ kMeansClustering.init();
}
void execute()
{
similarity.red = red;
similarity.green = green;
similarity.blue = blue;
similarity.execute();
normalizedLaplacian.degree = similarity.degree;
normalizedLaplacian.similarity = similarity.similarity;
normalizedLaplacian.execute();
eigenSolver.matrix = normalizedLaplacian.nLaplacian;
eigenSolver.execute();
kMeansClustering.vectors = eigenSolver.eigenvectors;
std::thread thread2( [ this ] {this->kMeansClustering.execute();});
thread2.join();
clusters = kMeansClustering.clusters;
}
};
......
......@@ -37,18 +37,6 @@ kMeansClustering.init();
}
void execute()
{
similarity.red = red;
similarity.green = green;
similarity.blue = blue;
similarity.execute();
normalizedLaplacian.degree = similarity.degree;
normalizedLaplacian.similarity = similarity.similarity;
normalizedLaplacian.execute();
eigenSolver.matrix = normalizedLaplacian.nLaplacian;
eigenSolver.execute();
kMeansClustering.vectors = eigenSolver.eigenvectors;
kMeansClustering.execute();
clusters = kMeansClustering.clusters;
}
};
......
......@@ -32,16 +32,30 @@ spectralClusterer[1].init();
}
void execute()
{
spectralClusterer[0].red = red1;
spectralClusterer[0].green = green1;
spectralClusterer[0].blue = blue1;
spectralClusterer[0].execute();
spectralClusterer[1].red = red2;
spectralClusterer[1].green = green2;
spectralClusterer[1].blue = blue2;
spectralClusterer[1].execute();
clusters[0] = spectralClusterer[0].clusters;
clusters[1] = spectralClusterer[1].clusters;
spectralClusterer.similarity.red = red1;
spectralClusterer.similarity.green = green1;
spectralClusterer.similarity.blue = blue1;
spectralClusterer.similarity.red = red2;
spectralClusterer.similarity.green = green2;
spectralClusterer.similarity.blue = blue2;
spectralClusterer[0].similarity.execute();
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
spectralClusterer[1].similarity.execute();
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
spectralClusterer[0].normalizedLaplacian.execute();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
spectralClusterer[1].normalizedLaplacian.execute();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
spectralClusterer[0].eigenSolver.execute();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
spectralClusterer[1].eigenSolver.execute();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
spectralClusterer[0].kMeansClustering.execute();
clusters[0] = spectralClusterer.kMeansClustering.clusters;
spectralClusterer[1].kMeansClustering.execute();
clusters[1] = spectralClusterer.kMeansClustering.clusters;
}
};
......
......@@ -37,18 +37,6 @@ kMeansClustering.init();
}
void execute()
{
similarity.red = red;
similarity.green = green;
similarity.blue = blue;
similarity.execute();
normalizedLaplacian.degree = similarity.degree;
normalizedLaplacian.similarity = similarity.similarity;
normalizedLaplacian.execute();
eigenSolver.matrix = normalizedLaplacian.nLaplacian;
eigenSolver.execute();
kMeansClustering.vectors = eigenSolver.eigenvectors;
kMeansClustering.execute();
clusters = kMeansClustering.clusters;
}
};
......
......@@ -33,18 +33,38 @@ spectralClusterer[1].init();
}
void execute()
{
spectralClusterer[0].red = red1;
spectralClusterer[0].green = green1;
spectralClusterer[0].blue = blue1;
std::thread thread1( [ this ] {this->spectralClusterer[0].execute();});
spectralClusterer[1].red = red2;
spectralClusterer[1].green = green2;
spectralClusterer[1].blue = blue2;
std::thread thread2( [ this ] {this->spectralClusterer[1].execute();});
spectralClusterer.similarity.red = red1;
spectralClusterer.similarity.green = green1;
spectralClusterer.similarity.blue = blue1;
spectralClusterer.similarity.red = red2;
spectralClusterer.similarity.green = green2;
spectralClusterer.similarity.blue = blue2;
std::thread thread1( [ this ] {this->spectralClusterer[0].similarity.execute();});
std::thread thread2( [ this ] {this->spectralClusterer[1].similarity.execute();});
thread1.join();
thread2.join();
clusters[0] = spectralClusterer[0].clusters;
clusters[1] = spectralClusterer[1].clusters;
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
std::thread thread3( [ this ] {this->spectralClusterer[0].normalizedLaplacian.execute();});
std::thread thread4( [ this ] {this->spectralClusterer[1].normalizedLaplacian.execute();});
thread3.join();
thread4.join();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
std::thread thread5( [ this ] {this->spectralClusterer[0].eigenSolver.execute();});
std::thread thread6( [ this ] {this->spectralClusterer[1].eigenSolver.execute();});
thread5.join();
thread6.join();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
std::thread thread7( [ this ] {this->spectralClusterer[0].kMeansClustering.execute();});
std::thread thread8( [ this ] {this->spectralClusterer[1].kMeansClustering.execute();});
thread7.join();
thread8.join();
clusters[0] = spectralClusterer.kMeansClustering.clusters;
clusters[1] = spectralClusterer.kMeansClustering.clusters;
}
};
......
......@@ -38,19 +38,6 @@ kMeansClustering.init();
}
void execute()
{
similarity.red = red;
similarity.green = green;
similarity.blue = blue;
similarity.execute();
normalizedLaplacian.degree = similarity.degree;
normalizedLaplacian.similarity = similarity.similarity;
normalizedLaplacian.execute();
eigenSolver.matrix = normalizedLaplacian.nLaplacian;
eigenSolver.execute();
kMeansClustering.vectors = eigenSolver.eigenvectors;
std::thread thread3( [ this ] {this->kMeansClustering.execute();});
thread3.join();
clusters = kMeansClustering.clusters;
}
};
......
......@@ -33,18 +33,38 @@ spectralClusterer[1].init();
}
void execute()
{
spectralClusterer[0].red = red1;
spectralClusterer[0].green = green1;
spectralClusterer[0].blue = blue1;
std::thread thread1( [ this ] {this->spectralClusterer[0].execute();});
spectralClusterer[1].red = red2;
spectralClusterer[1].green = green2;
spectralClusterer[1].blue = blue2;
std::thread thread2( [ this ] {this->spectralClusterer[1].execute();});
spectralClusterer.similarity.red = red1;
spectralClusterer.similarity.green = green1;
spectralClusterer.similarity.blue = blue1;
spectralClusterer.similarity.red = red2;
spectralClusterer.similarity.green = green2;
spectralClusterer.similarity.blue = blue2;
std::thread thread1( [ this ] {this->spectralClusterer[0].similarity.execute();});
std::thread thread2( [ this ] {this->spectralClusterer[1].similarity.execute();});
thread1.join();
thread2.join();
clusters[0] = spectralClusterer[0].clusters;
clusters[1] = spectralClusterer[1].clusters;
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
std::thread thread3( [ this ] {this->spectralClusterer[0].normalizedLaplacian.execute();});
std::thread thread4( [ this ] {this->spectralClusterer[1].normalizedLaplacian.execute();});
thread3.join();
thread4.join();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
std::thread thread5( [ this ] {this->spectralClusterer[0].eigenSolver.execute();});
std::thread thread6( [ this ] {this->spectralClusterer[1].eigenSolver.execute();});
thread5.join();
thread6.join();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
std::thread thread7( [ this ] {this->spectralClusterer[0].kMeansClustering.execute();});
std::thread thread8( [ this ] {this->spectralClusterer[1].kMeansClustering.execute();});
thread7.join();
thread8.join();
clusters[0] = spectralClusterer.kMeansClustering.clusters;
clusters[1] = spectralClusterer.kMeansClustering.clusters;
}
};
......
......@@ -38,19 +38,6 @@ kMeansClustering.init();
}
void execute()
{
similarity.red = red;
similarity.green = green;
similarity.blue = blue;
similarity.execute();
normalizedLaplacian.degree = similarity.degree;
normalizedLaplacian.similarity = similarity.similarity;
normalizedLaplacian.execute();
eigenSolver.matrix = normalizedLaplacian.nLaplacian;
eigenSolver.execute();
kMeansClustering.vectors = eigenSolver.eigenvectors;
std::thread thread3( [ this ] {this->kMeansClustering.execute();});
thread3.join();
clusters = kMeansClustering.clusters;
}
};
......
......@@ -37,18 +37,6 @@ kMeansClustering.init();
}
void execute()
{
similarity.red = red;
similarity.green = green;
similarity.blue = blue;
similarity.execute();
normalizedLaplacian.degree = similarity.degree;
normalizedLaplacian.similarity = similarity.similarity;
normalizedLaplacian.execute();
eigenSolver.matrix = normalizedLaplacian.nLaplacian;
eigenSolver.execute();
kMeansClustering.vectors = eigenSolver.eigenvectors;
kMeansClustering.execute();
clusters = kMeansClustering.clusters;
}
};
......
......@@ -40,21 +40,42 @@ spectralClusterer[2].init();
}
void execute()
{
spectralClusterer[0].red = red1;
spectralClusterer[0].green = green1;
spectralClusterer[0].blue = blue1;
spectralClusterer[0].execute();
spectralClusterer[1].red = red2;
spectralClusterer[1].green = green2;
spectralClusterer[1].blue = blue2;
spectralClusterer[1].execute();
spectralClusterer[2].red = red3;
spectralClusterer[2].green = green3;
spectralClusterer[2].blue = blue3;
spectralClusterer[2].execute();
clusters[0] = spectralClusterer[0].clusters;
clusters[1] = spectralClusterer[1].clusters;
clusters[2] = spectralClusterer[2].clusters;
spectralClusterer.similarity.red = red1;
spectralClusterer.similarity.green = green1;
spectralClusterer.similarity.blue = blue1;
spectralClusterer.similarity.red = red2;
spectralClusterer.similarity.green = green2;
spectralClusterer.similarity.blue = blue2;
spectralClusterer.similarity.red = red3;
spectralClusterer.similarity.green = green3;
spectralClusterer.similarity.blue = blue3;
spectralClusterer[0].similarity.execute();
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
spectralClusterer[1].similarity.execute();
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
spectralClusterer[2].similarity.execute();
spectralClusterer.normalizedLaplacian.similarity = spectralClusterer.similarity.similarity;
spectralClusterer.normalizedLaplacian.degree = spectralClusterer.similarity.degree;
spectralClusterer[0].normalizedLaplacian.execute();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
spectralClusterer[1].normalizedLaplacian.execute();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
spectralClusterer[2].normalizedLaplacian.execute();
spectralClusterer.eigenSolver.matrix = spectralClusterer.normalizedLaplacian.nLaplacian;
spectralClusterer[0].eigenSolver.execute();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;
spectralClusterer[1].eigenSolver.execute();
spectralClusterer.kMeansClustering.vectors = spectralClusterer.eigenSolver.eigenvectors;