Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
23e931c7
Commit
23e931c7
authored
May 23, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix in operator that must have been broken in merge
parent
21201865
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
36 deletions
+9
-36
dream/simulation/Operator.py
dream/simulation/Operator.py
+9
-36
No files found.
dream/simulation/Operator.py
View file @
23e931c7
...
@@ -348,47 +348,20 @@ class Operator(ObjectResource):
...
@@ -348,47 +348,20 @@ class Operator(ObjectResource):
G
.
outputIndex
+=
1
G
.
outputIndex
+=
1
G
.
outputIndex
+=
1
G
.
outputIndex
+=
1
# =======================================================================
# =======================================================================
# outputs results to JSON File
# outputs results to JSON File
# =======================================================================
# =======================================================================
def
outputResultsJSON
(
self
):
def
outputResultsJSON
(
self
):
from
Globals
import
G
from
Globals
import
G
# if we had just one replication output the results to JSON
from
Globals
import
getConfidenceIntervals
if
(
G
.
numberOfReplications
==
1
):
json
=
{
'_class'
:
self
.
class_name
,
json
=
{}
'id'
:
self
.
id
,
json
[
'_class'
]
=
'Dream.'
+
self
.
type
;
'results'
:
{}}
json
[
'id'
]
=
str
(
self
.
id
)
if
(
G
.
numberOfReplications
==
1
):
json
[
'results'
]
=
{}
json
[
'results'
][
'working_ratio'
]
=
100
*
self
.
totalWorkingTime
/
G
.
maxSimTime
json
[
'results'
][
'working_ratio'
]
=
100
*
self
.
totalWorkingTime
/
G
.
maxSimTime
json
[
'results'
][
'waiting_ratio'
]
=
100
*
self
.
totalWaitingTime
/
G
.
maxSimTime
json
[
'results'
][
'waiting_ratio'
]
=
100
*
self
.
totalWaitingTime
/
G
.
maxSimTime
#if we had multiple replications we output confidence intervals to excel
else
:
# for some outputs the results may be the same for each run (eg model is stochastic but failures fixed
json
[
'results'
][
'working_ratio'
]
=
getConfidenceIntervals
(
self
.
Working
)
# so failurePortion will be exactly the same in each run). That will give 0 variability and errors.
json
[
'results'
][
'waiting_ratio'
]
=
getConfidenceIntervals
(
self
.
Waiting
)
# so for each output value we check if there was difference in the runs' results
# if yes we output the Confidence Intervals. if not we output just the fix value
else
:
json
=
{}
json
[
'_class'
]
=
'Dream.Repairman'
;
json
[
'id'
]
=
str
(
self
.
id
)
json
[
'results'
]
=
{}
json
[
'results'
][
'working_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Working
):
json
[
'results'
][
'working_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'working_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'working_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'working_ratio'
][
'min'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'working_ratio'
][
'avg'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'working_ratio'
][
'max'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'waiting_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Waiting
):
json
[
'results'
][
'waiting_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'waiting_ratio'
][
'min'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
G
.
outputJSON
[
'elementList'
].
append
(
json
)
G
.
outputJSON
[
'elementList'
].
append
(
json
)
\ 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