Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qpme-core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
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
Descartes Research
qpme-core
Commits
e95a69f4
Commit
e95a69f4
authored
Apr 29, 2020
by
Simon Trapp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added relative path WEKA functionality
parent
db709f4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
sources/qpme.simqpn.kernel/src/de/tud/cs/simqpn/kernel/console/SimQPN.java
...pn.kernel/src/de/tud/cs/simqpn/kernel/console/SimQPN.java
+7
-1
sources/qpme.simqpn.kernel/src/de/tud/cs/simqpn/kernel/loading/distributions/WEKACreator.java
...d/cs/simqpn/kernel/loading/distributions/WEKACreator.java
+14
-3
No files found.
sources/qpme.simqpn.kernel/src/de/tud/cs/simqpn/kernel/console/SimQPN.java
View file @
e95a69f4
...
...
@@ -76,6 +76,7 @@ import de.tud.cs.simqpn.kernel.monitor.SimulatorProgress;
public
class
SimQPN
implements
IApplication
{
public
static
long
runtime
;
private
static
File
qpeFile
=
null
;
public
static
void
main
(
String
[]
args
)
{
startSimQPNWithCommandLine
(
args
);
...
...
@@ -100,10 +101,14 @@ public class SimQPN implements IApplication {
}
}
public
static
File
getQPEFile
()
{
return
qpeFile
;
}
private
static
void
runSimulatorOnDocument
(
Document
netDocument
,
String
configurationName
,
String
outputFilename
,
String
logConfigFilename
,
SimulatorProgress
progress
,
Date
date
)
throws
SimQPNException
{
Element
net
=
netDocument
.
getRootElement
();
SimQPNController
sim
=
SimQPNController
.
createSimQPNController
(
net
,
configurationName
,
logConfigFilename
,
date
);
SimQPNController
sim
=
SimQPNController
.
createSimQPNController
(
net
,
configurationName
,
logConfigFilename
,
date
);
long
tic
=
System
.
currentTimeMillis
();
sim
.
execute
(
configurationName
,
outputFilename
,
progress
);
long
toc
=
System
.
currentTimeMillis
();
...
...
@@ -129,6 +134,7 @@ public class SimQPN implements IApplication {
}
catch
(
URISyntaxException
ex
)
{
xmlFile
=
new
File
(
path
);
}
qpeFile
=
xmlFile
;
SAXReader
xmlReader
=
new
SAXReader
();
return
xmlReader
.
read
(
xmlFile
);
}
...
...
sources/qpme.simqpn.kernel/src/de/tud/cs/simqpn/kernel/loading/distributions/WEKACreator.java
View file @
e95a69f4
...
...
@@ -44,18 +44,28 @@ package de.tud.cs.simqpn.kernel.loading.distributions;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.nio.file.Paths
;
import
de.tud.cs.simqpn.kernel.SimQPNException
;
import
de.tud.cs.simqpn.kernel.console.SimQPN
;
import
weka.classifiers.Classifier
;
public
class
WEKACreator
extends
DistributionCreator
{
String
wekaFilename
;
Classifier
wekaModel
;
private
String
wekaFilename
;
private
Classifier
wekaModel
;
@Override
protected
void
loadParams
()
throws
SimQPNException
{
wekaFilename
=
this
.
loadStringParam
(
"wekaFile"
);
if
(!
Paths
.
get
(
wekaFilename
).
isAbsolute
())
{
// if not absolute filepath -> switch to DML environment mode
// switch from "DQL-Queries/results/" to "DML-Model/StatisticalModels/" folders
// treats wekaFile parameter as sole filename
wekaFilename
=
SimQPN
.
getQPEFile
().
getParentFile
().
getParentFile
().
getParent
()
+
SimQPN
.
getQPEFile
().
separatorChar
+
"DML-Model"
+
SimQPN
.
getQPEFile
().
separatorChar
+
"StatisticalModels"
+
SimQPN
.
getQPEFile
().
separatorChar
+
wekaFilename
;
}
try
{
FileInputStream
fis
=
new
FileInputStream
(
wekaFilename
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fis
);
...
...
@@ -63,7 +73,8 @@ public class WEKACreator extends DistributionCreator {
ois
.
close
();
fis
.
close
();
}
catch
(
ClassNotFoundException
|
IOException
e
)
{
e
.
printStackTrace
();
throw
new
IllegalStateException
(
"WEKA model with file path "
+
wekaFilename
+
" not found or wrong format!"
);
}
}
...
...
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