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
d209be97
Commit
d209be97
authored
Dec 02, 2018
by
Simon Eismann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
24f0d9c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
sources/qpme.simqpn.kernel/src/de/tud/cs/simqpn/kernel/loading/distributions/MARS.java
...c/de/tud/cs/simqpn/kernel/loading/distributions/MARS.java
+7
-4
sources/qpme.simqpn.kernel/src/de/tud/cs/simqpn/kernel/loading/distributions/MARSCreator.java
...d/cs/simqpn/kernel/loading/distributions/MARSCreator.java
+4
-0
No files found.
sources/qpme.simqpn.kernel/src/de/tud/cs/simqpn/kernel/loading/distributions/MARS.java
View file @
d209be97
...
...
@@ -68,7 +68,7 @@ public class MARS implements AbstractDistribution {
createFunctions
(
qplace
.
colors
);
double
result
=
constant
;
for
(
int
i
=
0
;
i
<
functions
.
length
;
i
++)
result
+=
functions
[
i
].
calculate
(
qplace
.
getQueueTokenPop
()[
i
]);
result
+=
functions
[
i
].
calculate
(
qplace
.
getQueueTokenPop
()[
color
]);
try
{
return
new
Exponential
(
1
/
result
,
RandomNumberGenerator
.
nextRandNumGen
()).
nextDouble
();
}
catch
(
SimQPNException
e
)
{
...
...
@@ -77,17 +77,20 @@ public class MARS implements AbstractDistribution {
}
private
void
createFunctions
(
String
[]
colors
)
{
functions
=
new
Function
[
colors
.
length
];
functions
=
new
Function
[
colorIds
.
length
];
int
id
=
0
;
for
(
int
i
=
0
;
i
<
colors
.
length
;
i
++)
{
for
(
int
j
=
0
;
j
<
colorIds
.
length
;
j
++)
{
if
(
colors
[
i
].
equals
(
colorIds
[
j
]))
{
if
(
sides
[
j
]
==
0
)
functions
[
i
]
=
new
LeftFunction
(
knots
[
j
],
coefficients
[
j
]);
functions
[
i
d
]
=
new
LeftFunction
(
knots
[
j
],
coefficients
[
j
]);
else
functions
[
i
]
=
new
RightFunction
(
knots
[
j
],
coefficients
[
j
]);
functions
[
id
]
=
new
RightFunction
(
knots
[
j
],
coefficients
[
j
]);
id
=
id
+
1
;
}
}
}
System
.
out
.
println
(
"Done"
);
}
interface
Function
{
...
...
sources/qpme.simqpn.kernel/src/de/tud/cs/simqpn/kernel/loading/distributions/MARSCreator.java
View file @
d209be97
...
...
@@ -67,6 +67,10 @@ public class MARSCreator extends DistributionCreator {
}
private
void
loadMARSModelFromFile
(
String
fileName
)
{
coefficients
.
clear
();
knots
.
clear
();
sides
.
clear
();
colorIds
.
clear
();
try
(
BufferedReader
br
=
new
BufferedReader
(
new
FileReader
(
new
File
(
fileName
))))
{
String
line
=
br
.
readLine
();
constant
=
Double
.
valueOf
(
line
);
...
...
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