Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fault Tree Project
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STAR 2021 Group 6
Fault Tree Project
Commits
65b0896d
Commit
65b0896d
authored
3 years ago
by
s2010720
Browse files
Options
Downloads
Patches
Plain Diff
Run all trees, BDD fields set to oome in case of OutOfMemoryError
parent
2f25d624
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
analysis/Main/Main.java
+17
-8
17 additions, 8 deletions
analysis/Main/Main.java
simpleTrees/results.csv
+407
-1
407 additions, 1 deletion
simpleTrees/results.csv
with
424 additions
and
9 deletions
analysis/Main/Main.java
+
17
−
8
View file @
65b0896d
...
@@ -14,22 +14,24 @@ import java.nio.file.Path;
...
@@ -14,22 +14,24 @@ import java.nio.file.Path;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
public
class
Main
{
public
class
Main
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Stream
<
Path
>
treeFiles
=
Files
.
find
(
Path
.
of
(
args
[
0
]),
5
,
(
p
,
attr
)
->
attr
.
isRegularFile
()
&&
p
.
getFileName
().
toString
().
endsWith
(
".json"
));
Stream
<
Path
>
treeFiles
=
Files
.
find
(
Path
.
of
(
args
[
0
]),
5
,
(
p
,
attr
)
->
attr
.
isRegularFile
()
&&
p
.
getFileName
().
toString
().
endsWith
(
".json"
));
Path
csv
=
Path
.
of
(
args
[
0
]).
resolve
(
"results.csv"
);
Path
csv
=
Path
.
of
(
args
[
0
]).
resolve
(
"results.csv"
);
BufferedWriter
csvWriter
=
new
BufferedWriter
(
new
FileWriter
(
csv
.
toFile
()))
;
try
(
BufferedWriter
csvWriter
=
new
BufferedWriter
(
new
FileWriter
(
csv
.
toFile
()))
)
{
csvWriter
.
write
(
"tree,heuristic,bdd_size,bdd_paths,ft_events,ft_basic_events"
);
csvWriter
.
write
(
"tree,heuristic,bdd_size,bdd_paths,ft_events,ft_basic_events"
);
csvWriter
.
newLine
();
csvWriter
.
newLine
();
treeFiles
treeFiles
.
map
(
path
->
{
.
map
(
path
->
{
TreeWrapper
tw
=
Parser
.
parseFile
(
path
.
toString
());
TreeWrapper
tw
=
Parser
.
parseFile
(
path
.
toString
());
FaultTree
ft
=
tw
.
getRoot
();
FaultTree
ft
=
tw
.
getRoot
();
return
new
HashMap
.
SimpleEntry
<
Path
,
FaultTree
>(
path
,
ft
);
return
new
HashMap
.
SimpleEntry
<
Path
,
FaultTree
>(
path
,
ft
);
})
})
.
filter
(
e
->
e
.
getValue
().
basicEventCount
()
<
50
)
.
flatMap
(
e
->
evaluateTree
(
e
.
getValue
(),
e
.
getKey
().
toString
()).
entrySet
().
stream
())
.
flatMap
(
e
->
evaluateTree
(
e
.
getValue
(),
e
.
getKey
().
toString
()).
entrySet
().
stream
())
.
forEach
(
res
->
{
.
forEach
(
res
->
{
try
{
try
{
...
@@ -37,11 +39,12 @@ public class Main {
...
@@ -37,11 +39,12 @@ public class Main {
csvWriter
.
write
(
','
);
csvWriter
.
write
(
','
);
csvWriter
.
write
(
res
.
getValue
());
csvWriter
.
write
(
res
.
getValue
());
csvWriter
.
newLine
();
csvWriter
.
newLine
();
csvWriter
.
flush
();
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
ex
);
}
}
});
});
csvWriter
.
close
();
}
// CSVStore.storeCSV(
// CSVStore.storeCSV(
// Path.of(args[0]).resolve("results.csv").toString(),
// Path.of(args[0]).resolve("results.csv").toString(),
// List.of("tree,heuristic", "bdd_size", "bdd_paths", "ft_events", "ft_basic_events"),
// List.of("tree,heuristic", "bdd_size", "bdd_paths", "ft_events", "ft_basic_events"),
...
@@ -66,8 +69,14 @@ public class Main {
...
@@ -66,8 +69,14 @@ public class Main {
}
}
private
static
String
evaluateTree
(
Heuristic
heuristic
,
FaultTree
ft
)
{
private
static
String
evaluateTree
(
Heuristic
heuristic
,
FaultTree
ft
)
{
String
ftInfo
=
","
+
ft
.
eventCount
()
+
","
+
ft
.
basicEventCount
();
System
.
out
.
println
(
String
.
format
(
"- Evaluating %s"
,
heuristic
.
getName
()));
System
.
out
.
println
(
String
.
format
(
"- Evaluating %s"
,
heuristic
.
getName
()));
ITE
bdd
=
FaultTreeToITE
.
createITE
(
ft
,
heuristic
.
getOrder
(
ft
));
try
{
return
bdd
.
size
()
+
","
+
bdd
.
paths
()
+
","
+
ft
.
eventCount
()
+
","
+
ft
.
basicEventCount
();
ITE
bdd
=
FaultTreeToITE
.
createITE
(
ft
,
heuristic
.
getOrder
(
ft
));
return
bdd
.
size
()
+
","
+
bdd
.
paths
()
+
ftInfo
;
}
catch
(
OutOfMemoryError
err
)
{
System
.
out
.
println
(
" -> Out of memory"
);
return
"oome,oome"
+
ftInfo
;
}
}
}
}
}
This diff is collapsed.
Click to expand it.
simpleTrees/results.csv
+
407
−
1
View file @
65b0896d
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment