Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
E
EMAM2Middleware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Middleware
Commits
11f70b08
Commit
11f70b08
authored
Mar 04, 2019
by
Dinh-An Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Monte Carlo Refactoring
parent
dbf5b788
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
src/main/java/de/monticore/lang/monticar/generator/middleware/Simulation/MonteCarloIntegration.java
...enerator/middleware/Simulation/MonteCarloIntegration.java
+6
-7
No files found.
src/main/java/de/monticore/lang/monticar/generator/middleware/Simulation/MonteCarloIntegration.java
View file @
11f70b08
...
...
@@ -13,7 +13,7 @@ public class MonteCarloIntegration {
// index 1: Spectral Clustering
// Index 2: Random Clustering
public
static
double
simulate
(
int
iterations
,
EMAComponentInstanceSymbol
componentInstanceSymbol
,
int
numberOfClusters
,
int
index
){
EMAComponentInstanceSymbol
flattenedComponent
=
FlattenArchitecture
.
flattenArchitecture
(
componentInstanceSymbol
);
//
EMAComponentInstanceSymbol flattenedComponent = FlattenArchitecture.flattenArchitecture(componentInstanceSymbol);
double
sum
=
0
;
...
...
@@ -22,24 +22,24 @@ public class MonteCarloIntegration {
// This would be with Spectral Clustering
SpectralClusteringAlgorithm
spectralClusteringAlgorithm
=
new
SpectralClusteringAlgorithm
();
Object
[]
params
=
new
Object
[]{
SpectralClusteringBuilder
.
SpectralParameters
.
SPECTRAL_NUM_CLUSTERS
,
numberOfClusters
};
List
<
Set
<
EMAComponentInstanceSymbol
>>
clusters
=
spectralClusteringAlgorithm
.
cluster
(
flattenedComponent
,
params
);
List
<
Set
<
EMAComponentInstanceSymbol
>>
clusters
=
spectralClusteringAlgorithm
.
cluster
(
componentInstanceSymbol
,
params
);
//iterate through all clusters and add all cost of the ROS Tags between clusters
sum
+=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
flattenedComponent
,
clusters
);
sum
+=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
,
clusters
);
}
}
else
if
(
index
==
2
)
{
for
(
int
j
=
0
;
j
<
iterations
;
j
++)
{
// Let's Random cluster the model
List
<
Set
<
EMAComponentInstanceSymbol
>>
clusters
=
randomClustering
(
flattenedComponent
,
numberOfClusters
);
List
<
Set
<
EMAComponentInstanceSymbol
>>
clusters
=
randomClustering
(
componentInstanceSymbol
,
numberOfClusters
);
//iterate through all clusters and add all cost of the ROS Tags between clusters
sum
+=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
flattenedComponent
,
clusters
);
sum
+=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
,
clusters
);
}
}
// return average costs of clustering with spectral
double
res
=
sum
/
iterations
;
System
.
out
.
println
(
"Average Costs: "
+
res
);
//
System.out.println("Average Costs: " + res);
return
res
;
}
...
...
@@ -83,7 +83,6 @@ public class MonteCarloIntegration {
clusters
.
get
(
randCluster
).
add
(
arrayListSubComponent
.
get
(
randElement
));
arrayListSubComponent
.
remove
(
randElement
);
}
return
clusters
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment