eventsims 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.Gemfile.lock.swp +0 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +70 -0
- data/LICENSE.txt +21 -0
- data/README.md +191 -0
- data/Rakefile +11 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/eventsims.gemspec +36 -0
- data/lib/eventsims.rb +10 -0
- data/lib/eventsims/discrete.rb +207 -0
- data/lib/eventsims/randgen.rb +154 -0
- data/lib/eventsims/simevent.rb +300 -0
- data/lib/eventsims/version.rb +22 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c14a98f8416741099ed89150135a0fcb2875cb1a
|
4
|
+
data.tar.gz: edb09fc49abceb6650406dbb0cbf1c23d02bbbf8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b944852af53fccc3b5b1d70ee041a2dce356b9d63f25c1dc730e277e7e5480b3f0a31a10f03eda1bf3239e4e5631d749265aed1b995e371670a20df170b4616
|
7
|
+
data.tar.gz: 1c2ef1840388301c1795bc43eab208c40713ae8398e12bee73cc600a77d418006b2933e7554812a83fa8ab7f9c4c9871be02cc314b1ae00c5868515f8f0f730d
|
data/.Gemfile.lock.swp
ADDED
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
|
43
|
+
# Rails files
|
44
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
45
|
+
dsl.watch_spec_files_for(rails.app_files)
|
46
|
+
dsl.watch_spec_files_for(rails.views)
|
47
|
+
|
48
|
+
watch(rails.controllers) do |m|
|
49
|
+
[
|
50
|
+
rspec.spec.("routing/#{m[1]}_routing"),
|
51
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
52
|
+
rspec.spec.("acceptance/#{m[1]}")
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Rails config changes
|
57
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
58
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
59
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
60
|
+
|
61
|
+
# Capybara features specs
|
62
|
+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
63
|
+
watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
|
64
|
+
|
65
|
+
# Turnip features and steps
|
66
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
67
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
68
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
69
|
+
end
|
70
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
# Eventsims
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
Eventsims contains various useful tools to makes discrete event easy to simulate.
|
6
|
+
|
7
|
+
|
8
|
+
# MODULE NAME --> Eventsims
|
9
|
+
|
10
|
+
|
11
|
+
## Module Classes
|
12
|
+
|
13
|
+
|
14
|
+
### Calculate
|
15
|
+
|
16
|
+
**Calculate** takes two list Arrays (outcome, cummulative probability) as arguments and an optional integer value `(steps)` for simplifying and calculating several data.
|
17
|
+
|
18
|
+
#### Methods
|
19
|
+
|
20
|
+
* prob() ----> To calculate the probability based on the given outcome list(second argument of the **Calculate** instance).
|
21
|
+
* discreteemp() ----> To generate a random outcome depending on its probability of occurrence.
|
22
|
+
* expectval() ----> To generate an expectation value i.e. the mean of the outcome depending on its probability
|
23
|
+
* estmean() ----> Same as expectval() because they always give the same output.
|
24
|
+
* estvar() ----> To calculate the estimated variance of the list data
|
25
|
+
* eststddev ----> To calculate the estimated standard deviation of the list data
|
26
|
+
|
27
|
+
#### Usage Example
|
28
|
+
|
29
|
+
```
|
30
|
+
require "Eventsims"
|
31
|
+
|
32
|
+
sample = Eventsims::Calculate.new([-1, 0, 3, 4], [0.1, 0.4, 0.7, 1], 10)
|
33
|
+
|
34
|
+
puts "probability: #{sample.prob()}"
|
35
|
+
puts "Arrival time: #{sample.discreteemp()}"
|
36
|
+
puts "Estimated standard deviation: #{sample.eststddev()}"
|
37
|
+
puts "Estimated mean: #{sample.estmean()}"
|
38
|
+
```
|
39
|
+
#### Result
|
40
|
+
```
|
41
|
+
probability: [0.1, 0.3, 0.3, 0.3]
|
42
|
+
Arrival time: [-1, 3, 0, 4, 0, -1, 3, 0, 0, 3]
|
43
|
+
Estimated standard deviation: 6.0
|
44
|
+
Estimated mean: 20.0
|
45
|
+
```
|
46
|
+
|
47
|
+
### Generate
|
48
|
+
|
49
|
+
**Generate** that takes integer numbers as arguments *(from no argument to 5 arguments)* with optional arguments being "r" or "s". r for reverse sorted and s for ascending order sort. it's methods and uses are shown below.
|
50
|
+
|
51
|
+
* outcome() —-> generate outcomes based on the inputs supplied as arguments.
|
52
|
+
* unique() —-> generate unique outcomes based on the inputs supplied as arguments. You can think of it as a set of the outcome() method result.
|
53
|
+
* occur() —-> generate the number of times a unique item is found.
|
54
|
+
* getprob() —-> generate the probability of the outcome with respect to the unique outcome.
|
55
|
+
* getcum() —-> generate the cummulative probability of occurrence with respect to the unique outcome.
|
56
|
+
|
57
|
+
#### Usage example
|
58
|
+
```
|
59
|
+
require "Eventsims"
|
60
|
+
|
61
|
+
sample = Eventsims::Generate.new(2, 5, 7, "s")
|
62
|
+
|
63
|
+
puts ("Outcome: #{sample.outcome()}")
|
64
|
+
puts ("Unique Outcome: {sample.unique()}")
|
65
|
+
puts ("Occurrence: #{sample.occur()}")
|
66
|
+
puts ("Probability: #sample.getprob()}")
|
67
|
+
puts ("Cummulative Probability: #{sample.getcum()}")
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
#### Result
|
72
|
+
|
73
|
+
```
|
74
|
+
Outcome: [2, 3, 3, 4, 4, 5, 5]
|
75
|
+
Unique Outcome: [2, 3, 4, 5]
|
76
|
+
Occurrence: [1, 2, 2, 2]
|
77
|
+
Probability: [0.1429, 0.2857, 0.2857, 0.2857]
|
78
|
+
Cummulative Probability: [0.1429, 0.4286, 0.7143, 1.0]
|
79
|
+
```
|
80
|
+
### Randomsim and Simulate
|
81
|
+
|
82
|
+
contains classes for generating and estimating events that happens in a workplace scenario. Simulating events using methods some methods covered below
|
83
|
+
|
84
|
+
|
85
|
+
#### What they do
|
86
|
+
* Randomsim which generates random values to populate the inter-arrival and service time ad then calculates the rest of the values (accepts 0 - 3 arguments)
|
87
|
+
|
88
|
+
* Simulate, a more flexible class that allows you to input your own inter-arrival time and service time as a list Array (takes 1-2 arguments [inter-arrival, service] time). If only one list Array is passed to the argument. it becomes the inter-arrival time and a random list between 1 and 10 will be generated for service time
|
89
|
+
|
90
|
+
|
91
|
+
#### Methods
|
92
|
+
|
93
|
+
* intarrival() —-> Displays the inter-arrival time in a list.
|
94
|
+
* arrival() —-> Displays the arrival time in a list.
|
95
|
+
* service() —-> Displays the service time in a list.
|
96
|
+
* servbegin() —-> Display the time service begins in a list.
|
97
|
+
* servend() —-> Display the time service ends in a list.
|
98
|
+
* queuewait() —-> Display the time the customer spent waiting in a list.
|
99
|
+
* custspend() —-> Display the time the customer spent in the system i.e. total time of service.
|
100
|
+
* idle() —> Display the idle time of the server (cashier).
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
#### Usage Example
|
105
|
+
```
|
106
|
+
require "Eventsims"
|
107
|
+
|
108
|
+
sample = Eventsims::Simulate.new([0, 1, 5, 3, 5, 5, 3, 5, 5]) #can take two arguments.
|
109
|
+
# or
|
110
|
+
sample = Eventsims::Randomsim.new(5,8,9)
|
111
|
+
puts "Inter-Arrival time: #{sample.intarrival()}"
|
112
|
+
puts "Arrival time: #{sample.arrival()}"
|
113
|
+
puts "Idle time: #{sample.idle()}"
|
114
|
+
```
|
115
|
+
|
116
|
+
#### Result
|
117
|
+
```
|
118
|
+
Inter-Arrival time: [0, 1, 5, 3, 5, 5, 3, 5, 5]
|
119
|
+
Arrival time: [0, 1, 6, 9, 14, 19, 22, 27, 32]
|
120
|
+
Idle time: [0, 0, 2, 0, 0, 0, 0, 0, 0]
|
121
|
+
```
|
122
|
+
|
123
|
+
## Module methods
|
124
|
+
###trimval
|
125
|
+
|
126
|
+
**trimval** that takes in one argument, (numbers or lists and strips it of leading zeros and round up to 4 decimal places
|
127
|
+
|
128
|
+
## trimlist
|
129
|
+
|
130
|
+
**trimlist** that takes in as many arguments as possibe and does the same thing **trimval** does but very useful if there is a nested list in the list of arguments.
|
131
|
+
|
132
|
+
`
|
133
|
+
They both help to display lists and numbers in a better and easier way to read rather than have values with many leading decimal numbers in a list keeping it concise. `
|
134
|
+
|
135
|
+
#### Usage example
|
136
|
+
```
|
137
|
+
require "Eventsims"
|
138
|
+
|
139
|
+
sample = Eventsims.trimval([3.6789876])
|
140
|
+
puts "new value: #{sample}"
|
141
|
+
|
142
|
+
|
143
|
+
sample = Eventsims.trimlist([3.6789876], "dog", [2.76542, "rat", [4]])
|
144
|
+
puts "new list: #{sample}"
|
145
|
+
```
|
146
|
+
|
147
|
+
#### Result
|
148
|
+
```
|
149
|
+
new val: [[3.679]]
|
150
|
+
new list: [[3.679], "dog", [2.7654, "rat", [4]]
|
151
|
+
```
|
152
|
+
|
153
|
+
## Requirements
|
154
|
+
|
155
|
+
|
156
|
+
* Any version of Ruby
|
157
|
+
|
158
|
+
|
159
|
+
## Installation
|
160
|
+
|
161
|
+
Add this line to your application's Gemfile:
|
162
|
+
|
163
|
+
```ruby
|
164
|
+
gem 'eventsims'
|
165
|
+
```
|
166
|
+
|
167
|
+
And then execute:
|
168
|
+
|
169
|
+
$ bundle
|
170
|
+
|
171
|
+
Or install it yourself as:
|
172
|
+
|
173
|
+
$ gem install eventsims
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
## Development
|
178
|
+
|
179
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
180
|
+
|
181
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
182
|
+
|
183
|
+
## Contributing
|
184
|
+
|
185
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tushortz/eventsims.
|
186
|
+
|
187
|
+
|
188
|
+
## License
|
189
|
+
|
190
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
191
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "eventsims"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/eventsims.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'eventsims/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "eventsims"
|
8
|
+
spec.version = Eventsims::VERSION
|
9
|
+
spec.authors = ["Taiwo Kareem"]
|
10
|
+
spec.email = ["taiwo.kareem36@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Eventsims uses various useful tools in simulating discrete system events based on outcome and probabilities}
|
13
|
+
spec.description = %q{Eventsims is a Ruby package for simulating discrete event. It has four classes (Calculate, Generate, Randomsim and Simulate) and two methods(trimval and trimlist) for making this possible. }
|
14
|
+
spec.homepage = "http://github.com/tushortz/eventsims"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# # delete this section to allow pushing this gem to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
# spec.add_development_dependency "rspec"
|
33
|
+
# spec.add_development_dependency "guard"
|
34
|
+
# spec.add_development_dependency "guard-rspec"
|
35
|
+
# spec.add_development_dependency "coveralls"
|
36
|
+
end
|
data/lib/eventsims.rb
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
module Eventsims
|
2
|
+
#module Discrete
|
3
|
+
|
4
|
+
#Removes leading zeros after decimal and/or approximate to 4dp
|
5
|
+
def self.trimval(thelist)
|
6
|
+
''' Takes in number list or float and removes leading zeros '''
|
7
|
+
#Checks if passed argument is a list
|
8
|
+
if thelist.is_a?(Array)
|
9
|
+
temp = []
|
10
|
+
# Loops through each list and convert to 4dp if needed
|
11
|
+
thelist.each{|i| temp.push i.is_a?(Float)? i.round(4) : i}
|
12
|
+
thelist = temp
|
13
|
+
return thelist
|
14
|
+
|
15
|
+
elsif thelist.is_a?(Float)
|
16
|
+
return thelist.round(4)
|
17
|
+
|
18
|
+
else
|
19
|
+
return thelist
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.trimlist(*args)
|
25
|
+
''' Takes in number list or float and removes leading zeros '''
|
26
|
+
store = []
|
27
|
+
values = []
|
28
|
+
args.each{|mylist|
|
29
|
+
a = []
|
30
|
+
mylist.each{|x|
|
31
|
+
if x.is_a?(Float)
|
32
|
+
a.push(x.round(4))
|
33
|
+
|
34
|
+
elsif x.is_a?(Array)
|
35
|
+
inner = []
|
36
|
+
x.each{|y| inner.push y.is_a?(Float)? y.round(4) : y}
|
37
|
+
a.push(inner)
|
38
|
+
|
39
|
+
else a.push(x)
|
40
|
+
|
41
|
+
end
|
42
|
+
}
|
43
|
+
values.push(a)
|
44
|
+
|
45
|
+
}
|
46
|
+
store.push(values)
|
47
|
+
return store[0]
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
class Calculate
|
53
|
+
def initialize(*args)
|
54
|
+
''' Initialising the instances '''
|
55
|
+
#Checking for valid arguments and value assignment
|
56
|
+
@args = args
|
57
|
+
|
58
|
+
if args.length == 3
|
59
|
+
@steps = args[2]
|
60
|
+
|
61
|
+
elsif args.length == 2
|
62
|
+
@steps = 1
|
63
|
+
|
64
|
+
else
|
65
|
+
raise "Invalid arguments: must be 2 or 3 --> Outcome , Cummulative probability, optional: steps"
|
66
|
+
end
|
67
|
+
|
68
|
+
@outcome, @cum_prob, @probability = args[0], args[1], []
|
69
|
+
|
70
|
+
# Checks in case user hasn't inputted the right information #Error checks for invalid inputs
|
71
|
+
@last_cum = @cum_prob.at(-1)
|
72
|
+
|
73
|
+
if @outcome.size != @cum_prob.size
|
74
|
+
raise "'prob' arguments must be of same length"
|
75
|
+
|
76
|
+
elsif @last_cum != 1
|
77
|
+
raise "last value of 2nd argument must be 1"
|
78
|
+
end
|
79
|
+
|
80
|
+
args[1].each{|i|
|
81
|
+
raise "cummulative probability must be between 0 and 1" if 0 > i or i > 1 }
|
82
|
+
end
|
83
|
+
# Calculates the probability of an outcome given its cummulative probability
|
84
|
+
def prob()
|
85
|
+
''' Returns a probability given its cummulative probability '''
|
86
|
+
|
87
|
+
# Starting variables
|
88
|
+
y = 1; @probability.push(@cum_prob[0])
|
89
|
+
|
90
|
+
while y < @cum_prob.size
|
91
|
+
@probability << (@cum_prob[y] - @cum_prob[y-1]).round(4)
|
92
|
+
y+=1
|
93
|
+
end
|
94
|
+
|
95
|
+
return Eventsims.trimval(@probability)
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
# Generates a discreteEmp for the given outcome
|
100
|
+
def discreteemp()
|
101
|
+
'''returns a random number from the outcome list'''
|
102
|
+
#--- generating a random number based on discreteemp
|
103
|
+
|
104
|
+
emplist = []
|
105
|
+
|
106
|
+
def twoargs()
|
107
|
+
count, number = 0, rand()
|
108
|
+
|
109
|
+
while count < (@cum_prob).size
|
110
|
+
if @cum_prob[count] < number and number <= @cum_prob[count+1]
|
111
|
+
return Eventsims.trimval(@outcome[count+1])
|
112
|
+
|
113
|
+
elsif 0 <= number and number <= @cum_prob[0]
|
114
|
+
return Eventsims.trimval(@outcome[0])
|
115
|
+
end
|
116
|
+
count+=1
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
if @args.length == 2
|
121
|
+
return Eventsims.trimval(twoargs())
|
122
|
+
|
123
|
+
elsif @args.length == 3
|
124
|
+
@amount, increment = @args[2], 0
|
125
|
+
if @amount.is_a? (String )
|
126
|
+
raise "Only integers allowed as third argument"
|
127
|
+
end
|
128
|
+
if @amount == 1
|
129
|
+
return Eventsims.trimval(twoargs())
|
130
|
+
|
131
|
+
else
|
132
|
+
#try:
|
133
|
+
while increment < @amount
|
134
|
+
generated = twoargs()
|
135
|
+
if generated.is_a?(Float)
|
136
|
+
generated = Eventsims.trimval(generated)
|
137
|
+
end
|
138
|
+
emplist << (generated)
|
139
|
+
increment +=1
|
140
|
+
end
|
141
|
+
|
142
|
+
return emplist
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Calculates the expectation value given its outcome and cummulative probability
|
148
|
+
def expectval()
|
149
|
+
''' returns the expectation value of the outcomes'''
|
150
|
+
|
151
|
+
expectation, increment, probability = 0,0, prob()
|
152
|
+
|
153
|
+
while increment < @cum_prob.size
|
154
|
+
expectation += probability[increment] * @outcome[increment]
|
155
|
+
increment += 1
|
156
|
+
end
|
157
|
+
|
158
|
+
if @args.size == 2
|
159
|
+
return Eventsims.trimval(expectation)
|
160
|
+
|
161
|
+
elsif @args.size == 3
|
162
|
+
expectation *= @steps
|
163
|
+
return Eventsims.trimval(expectation)
|
164
|
+
|
165
|
+
else
|
166
|
+
raise "arguments must be two or three"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Calculates the estimated variance of the given lists
|
171
|
+
def eststddev()
|
172
|
+
'''returns estimated variance of the outcome'''
|
173
|
+
#arguments are: [outcomes], [cummulative probabilities], optional: float(steps)]
|
174
|
+
|
175
|
+
mean = expectval / @steps
|
176
|
+
increment, occurtimes = 0, 0
|
177
|
+
|
178
|
+
while increment < @cum_prob.size
|
179
|
+
occurtimes += @probability[increment] * (@outcome[increment] - mean)**2
|
180
|
+
increment +=1
|
181
|
+
end
|
182
|
+
|
183
|
+
if @args.size == 2
|
184
|
+
return Eventsims.trimval((occurtimes)**0.5)
|
185
|
+
|
186
|
+
elsif @args.size == 3
|
187
|
+
return Eventsims.trimval(occurtimes**0.5 * @steps**0.5)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def estmean()
|
192
|
+
return expectval
|
193
|
+
end
|
194
|
+
|
195
|
+
# Calculates the estimated standard deviation of the given lists
|
196
|
+
def estvar()
|
197
|
+
''' Returns the estimated standard deviation of the outcome'''
|
198
|
+
#arguments are: [outcomes], [cummulative probabilities], optional: float(steps)]
|
199
|
+
variance = eststddev**2
|
200
|
+
return Eventsims.trimval(variance)
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
#end
|
206
|
+
end
|
207
|
+
|
@@ -0,0 +1,154 @@
|
|
1
|
+
|
2
|
+
module Randgen
|
3
|
+
|
4
|
+
|
5
|
+
# Generating random outcomes and probabilities
|
6
|
+
class Generate
|
7
|
+
def initialize(*args)
|
8
|
+
''' Initialisation of all values'''
|
9
|
+
# Starting variables that change result depending on the if statements
|
10
|
+
start, stop, jump = 0, 10, 1
|
11
|
+
@@outcome, @@occur, @@unique, @@problist, @@cumprob = [], [], [], [], []
|
12
|
+
amount = (2..20).step(jump).to_a.sample
|
13
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
14
|
+
|
15
|
+
# If statements to run different functions
|
16
|
+
if args.size == 0
|
17
|
+
@@outcome = @@outcome
|
18
|
+
|
19
|
+
elsif args.size == 1
|
20
|
+
if args[0].is_a?(Integer)
|
21
|
+
amount, @@outcome = args[0], []
|
22
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
23
|
+
|
24
|
+
elsif args[0] == "r"
|
25
|
+
@@outcome.sort!{|x,y| y<=>x}
|
26
|
+
|
27
|
+
elsif args[0] == "s"
|
28
|
+
@@outcome.sort!
|
29
|
+
|
30
|
+
else
|
31
|
+
raise "\nInvalid argument: Use (amount, 'r' or 's')"
|
32
|
+
end
|
33
|
+
|
34
|
+
elsif args.size == 2
|
35
|
+
if args.all?{|x| x.is_a?(Integer)}
|
36
|
+
start, stop, @@outcome = args[0], args[1], []
|
37
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
38
|
+
|
39
|
+
elsif args[1] == "r"
|
40
|
+
amount, @@outcome = args[0], []
|
41
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
42
|
+
@@outcome.sort!{|x,y| y<=>x}
|
43
|
+
|
44
|
+
elsif args[1] == "s"
|
45
|
+
amount, @@outcome = args[0], []
|
46
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
47
|
+
@@outcome.sort!
|
48
|
+
|
49
|
+
else
|
50
|
+
raise "\nInvalid argument: Use (start, stop) or (amount, 'r' or 's')'"
|
51
|
+
end
|
52
|
+
|
53
|
+
elsif args.size == 3
|
54
|
+
if args.all?{|x| x.is_a?(Integer)}
|
55
|
+
start, stop, amount, @@outcome = args[0], args[1], args[2], []
|
56
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
57
|
+
|
58
|
+
elsif args[2] == "r"
|
59
|
+
start, stop, @@outcome = args[0], args[1], []
|
60
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
61
|
+
@@outcome.sort!{|x,y| y<=>x}
|
62
|
+
|
63
|
+
elsif args[2] == "s"
|
64
|
+
start, stop, @@outcome = args[0], args[1], []
|
65
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
66
|
+
@@outcome.sort!
|
67
|
+
|
68
|
+
else
|
69
|
+
raise "\nInvalid argument: Use (start, stop, amount) or (amount, 'r' or 's')'"
|
70
|
+
end
|
71
|
+
|
72
|
+
elsif args.size == 4
|
73
|
+
if args.all?{|x| x.is_a?(Integer)}
|
74
|
+
start, stop, jump, amount, @@outcome = args[0], args[1], args[2], args[3], []
|
75
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
76
|
+
|
77
|
+
elsif args[3] == "r"
|
78
|
+
start, stop, amount, @@outcome = args[0], args[1], args[2], []
|
79
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
80
|
+
@@outcome.sort!{|x,y| y<=>x}
|
81
|
+
|
82
|
+
elsif args[3] == "s"
|
83
|
+
start, stop, amount, @@outcome = args[0], args[1], args[2], []
|
84
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
85
|
+
@@outcome.sort!
|
86
|
+
|
87
|
+
else
|
88
|
+
raise "\nInvalid argument: Use (start, stop, step, amount) or \n\t(start, stop, amount, 'r' or 's')'"
|
89
|
+
end
|
90
|
+
|
91
|
+
elsif args.size == 5
|
92
|
+
if args[4] == "r"
|
93
|
+
start, stop, jump, amount, @@outcome = args[0], args[1], args[2], args[3], []
|
94
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
95
|
+
@@outcome.sort!{|x,y| y<=>x}
|
96
|
+
|
97
|
+
elsif args[4] == "s"
|
98
|
+
start, stop, jump, amount, @@outcome = args[0], args[1], args[2], args[3], []
|
99
|
+
amount.times{@@outcome << (start..stop).step(jump).to_a.sample}
|
100
|
+
@@outcome.sort!
|
101
|
+
|
102
|
+
else
|
103
|
+
raise "\nInvalid argument: Use (start, stop, step, amount, 'r' or 's')'"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
#Generates a set and times of occurrence ofoutcome
|
108
|
+
@@outcome.each{|item| @@unique << item unless @@unique.include?(item)}
|
109
|
+
result = @@outcome.each_with_object(Hash.new(0)) { |word, counts| counts[word] += 1 }
|
110
|
+
result.each{|x,y| @@occur << y}
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
# Returns a probability list of all items in its argument
|
115
|
+
def getprob()
|
116
|
+
probability = []
|
117
|
+
'''Returns a probability list of all items in its argument'''
|
118
|
+
@@occur.each{|i| probability << (i*1.0/@@outcome.size).round(4)}
|
119
|
+
|
120
|
+
return probability
|
121
|
+
end
|
122
|
+
|
123
|
+
# Returns a cummulative probability list of all items in its argument
|
124
|
+
def getcum()
|
125
|
+
'''Returns a cummulative probability list of all items in its argument'''
|
126
|
+
increase, probability, cumlist = 0, getprob(), []
|
127
|
+
probability.each{|i| increase +=i
|
128
|
+
cumlist << increase.round(4) }
|
129
|
+
cumlist[-1] = 1.0 #makes sure the last value is 1.0
|
130
|
+
return cumlist
|
131
|
+
end
|
132
|
+
|
133
|
+
# Returns the outcome
|
134
|
+
def outcome()
|
135
|
+
''' Returns a generated outcome '''
|
136
|
+
return @@outcome
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returns the unique outcome
|
140
|
+
def unique()
|
141
|
+
'''Returns the unique outcome'''
|
142
|
+
return @@unique
|
143
|
+
end
|
144
|
+
|
145
|
+
# # Returns the number of times the unique item is found
|
146
|
+
def occur
|
147
|
+
'''Returns the number of times the unique item is found'''
|
148
|
+
return @@occur
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
@@ -0,0 +1,300 @@
|
|
1
|
+
|
2
|
+
module Eventsims
|
3
|
+
#module Simevent
|
4
|
+
|
5
|
+
class Randomsim
|
6
|
+
def initialize(*args)
|
7
|
+
''' Initialisation '''
|
8
|
+
|
9
|
+
stop, amount, @_intarrival, @_service = 10, (2..20).step(1).to_a.sample, [], []
|
10
|
+
|
11
|
+
if args.size == 0
|
12
|
+
amount.times{@_intarrival << (1..stop).step(1).to_a.sample}
|
13
|
+
amount.times{@_service << (1..stop).step(1).to_a.sample}
|
14
|
+
|
15
|
+
elsif args.size == 1
|
16
|
+
args[0].times{@_intarrival << (1..stop).step(1).to_a.sample}
|
17
|
+
args[0].times{@_service << (1..stop).step(1).to_a.sample}
|
18
|
+
|
19
|
+
elsif args.size == 2
|
20
|
+
args[1].times{@_intarrival << (1..args[0]).step(1).to_a.sample}
|
21
|
+
args[1].times{@_service << (1..args[0]).step(1).to_a.sample}
|
22
|
+
|
23
|
+
elsif args.size == 3
|
24
|
+
args[2].times{@_intarrival << (1..args[0]).step(1).to_a.sample}
|
25
|
+
args[2].times{@_service << (1..args[1]).step(1).to_a.sample}
|
26
|
+
|
27
|
+
else
|
28
|
+
raise "Arguments must be between 0 to 3"
|
29
|
+
end
|
30
|
+
|
31
|
+
#Sets its first value to zero
|
32
|
+
@_intarrival[0] = 0
|
33
|
+
|
34
|
+
# Required variables
|
35
|
+
@_arrival, @_preservstart, @_servstart = [], [0], []
|
36
|
+
@_queue, @_servend, @_custspend, @_idle = [], [], [], [0]
|
37
|
+
|
38
|
+
def getarrive_()
|
39
|
+
'''Returns arrival time'''
|
40
|
+
increase = 0
|
41
|
+
@_intarrival.each {|i| increase +=i
|
42
|
+
@_arrival << increase }
|
43
|
+
return @_arrival
|
44
|
+
end
|
45
|
+
|
46
|
+
def servbegins_()
|
47
|
+
'''Returns time when service begin'''
|
48
|
+
increase = 0
|
49
|
+
i = 0; while i < @_service.size
|
50
|
+
increase+= @_service[i]
|
51
|
+
@_preservstart << increase
|
52
|
+
i+=1
|
53
|
+
end
|
54
|
+
@_preservstart.pop
|
55
|
+
return @_preservstart
|
56
|
+
end
|
57
|
+
|
58
|
+
#populate @_servend with values. just to get same size
|
59
|
+
@_intarrival.each{|i| @_servend << i}
|
60
|
+
|
61
|
+
#Please maintain order if you are editing the code!
|
62
|
+
# Calling functions
|
63
|
+
getarrive_() #Returns arrival time
|
64
|
+
servbegins_() #Returns time when servce begin
|
65
|
+
|
66
|
+
def get_servend_()
|
67
|
+
'''Retuns time when service ends'''
|
68
|
+
x = 0; while x < ((@_preservstart).size)
|
69
|
+
@_servend[x] = @_preservstart[x] + @_service[x]
|
70
|
+
s = 1; while s < (@_preservstart).size
|
71
|
+
if @_preservstart[s] < (maximum = @_arrival[s] > @_servend[x]? @_arrival[s] : @_servend[x])
|
72
|
+
@_preservstart[s] = (maximum)
|
73
|
+
end
|
74
|
+
s+=1
|
75
|
+
end
|
76
|
+
x+=1
|
77
|
+
end
|
78
|
+
|
79
|
+
return @_servend
|
80
|
+
end
|
81
|
+
|
82
|
+
# Method used to calculate the rest of the data like
|
83
|
+
#time when service begins
|
84
|
+
#wait time in queue, (_queue)
|
85
|
+
#time customer spent in the system (_custspend)
|
86
|
+
def otherresults(list1, list2, list3)
|
87
|
+
''' Stores and return the value of (list2 - list3) in list1 '''
|
88
|
+
x = 0; while x < list2.size
|
89
|
+
list1 << (list2[x] - list3[x])
|
90
|
+
x+=1
|
91
|
+
end
|
92
|
+
list1[0] = 0 if list1[0] < 0
|
93
|
+
end
|
94
|
+
|
95
|
+
def idletime_()
|
96
|
+
'''Returns the idle time of server'''
|
97
|
+
x,y = 0,1
|
98
|
+
while y < @_servend.size
|
99
|
+
(@_idle) << (@_servstart[y] - @_servend[x])
|
100
|
+
x+=1; y+=1
|
101
|
+
end
|
102
|
+
return @_idle
|
103
|
+
end
|
104
|
+
|
105
|
+
# Calling other methods
|
106
|
+
get_servend_()
|
107
|
+
otherresults(@_servstart, @_servend, @_service)
|
108
|
+
otherresults(@_queue, @_servstart, @_arrival)
|
109
|
+
otherresults(@_custspend, @_servend, @_arrival)
|
110
|
+
idletime_()
|
111
|
+
end
|
112
|
+
|
113
|
+
#Methods to be used outside of initialize returning necessary values
|
114
|
+
#Main methods
|
115
|
+
|
116
|
+
def intarrival()
|
117
|
+
'''Returns the interarrival time'''
|
118
|
+
return @_intarrival
|
119
|
+
end
|
120
|
+
|
121
|
+
def arrival()
|
122
|
+
'''Returns the arrival time'''
|
123
|
+
return @_arrival
|
124
|
+
end
|
125
|
+
|
126
|
+
def service()
|
127
|
+
'''Returns the service time'''
|
128
|
+
return @_service
|
129
|
+
end
|
130
|
+
|
131
|
+
def servbegin()
|
132
|
+
'''Returns the time when service began'''
|
133
|
+
return @_servstart
|
134
|
+
end
|
135
|
+
|
136
|
+
def queuewait()
|
137
|
+
"""Returns the customer's waiting time in the queue"""
|
138
|
+
return @_queue
|
139
|
+
end
|
140
|
+
|
141
|
+
def servend()
|
142
|
+
'''Returns the time service ended'''
|
143
|
+
return @_servend
|
144
|
+
end
|
145
|
+
|
146
|
+
def custspend()
|
147
|
+
'''Returns the time customer spends in system'''
|
148
|
+
return @_custspend
|
149
|
+
end
|
150
|
+
|
151
|
+
def idle()
|
152
|
+
'''Returns the idle time of server'''
|
153
|
+
return @_idle
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
class Simulate < Randomsim
|
160
|
+
def initialize(*args)
|
161
|
+
''' Initialisation '''
|
162
|
+
|
163
|
+
stop, amount = 10, (2..20).step(1).to_a.sample
|
164
|
+
@_intarrival, @_service = [], []
|
165
|
+
|
166
|
+
if args.size == 1
|
167
|
+
@_intarrival = args[0]
|
168
|
+
raise "Argument must be a list" unless args[0].is_a?(Array)
|
169
|
+
(args[0].size).times{@_service << (1..stop).step(1).to_a.sample}
|
170
|
+
|
171
|
+
args[0].each{|y|
|
172
|
+
raise "Only numbers allowed in Arrays" if y.is_a?(String) }
|
173
|
+
|
174
|
+
elsif args.size == 2
|
175
|
+
#checks if both arguments are arrays
|
176
|
+
unless args.all?{|x| x.is_a?(Array) }
|
177
|
+
raise "Argument one and two must be Arrays"
|
178
|
+
end
|
179
|
+
@_intarrival = args[0]
|
180
|
+
@_service = args[1]
|
181
|
+
|
182
|
+
args[0].each{|y|
|
183
|
+
raise "Only numbers allowed in Arrays" if y.is_a?(String) }
|
184
|
+
args[1].each{|y|
|
185
|
+
raise "Only numbers allowed in Arrays" if y.is_a?(String) }
|
186
|
+
|
187
|
+
#Check length of both lists and throw error if not equal
|
188
|
+
if args[0].size != args[1].size
|
189
|
+
raise "List arguments must be of equal length"
|
190
|
+
end
|
191
|
+
|
192
|
+
else
|
193
|
+
raise "You must supply one or two Array arguments"
|
194
|
+
end
|
195
|
+
|
196
|
+
# If first value less than 0 set it to zero
|
197
|
+
@_intarrival[0] = 0 if @_intarrival[0] < 0
|
198
|
+
|
199
|
+
# Required variables and input error handling
|
200
|
+
@_preservstart = []; @_preservstart << args[0][0]
|
201
|
+
@_preservstart[0] = 0 if @_preservstart[0] < 0
|
202
|
+
|
203
|
+
# Other variable declaration
|
204
|
+
@_arrival, @_servstart, @_queue = [], [], []
|
205
|
+
@_servend, @_custspend, @_idle = [], [], [0]
|
206
|
+
|
207
|
+
# Makes display less annoying
|
208
|
+
def makenice(thelist)
|
209
|
+
temp = []
|
210
|
+
thelist.each{|i| if i.is_a?(Integer)
|
211
|
+
temp << i
|
212
|
+
else
|
213
|
+
temp << i.round(4)
|
214
|
+
end }
|
215
|
+
thelist = temp
|
216
|
+
return thelist
|
217
|
+
end
|
218
|
+
|
219
|
+
def getarrive_()
|
220
|
+
'''Returns arrival time'''
|
221
|
+
increase = 0
|
222
|
+
@_intarrival.each{|i| increase +=i
|
223
|
+
@_arrival << increase }
|
224
|
+
return @_arrival
|
225
|
+
end
|
226
|
+
|
227
|
+
def servbegins_()
|
228
|
+
'''Returns time when service begin'''
|
229
|
+
increase, i = 0, 0
|
230
|
+
while i < @_service.size
|
231
|
+
increase += @_service[i]
|
232
|
+
@_preservstart << increase
|
233
|
+
i+=1
|
234
|
+
end
|
235
|
+
@_preservstart.pop()
|
236
|
+
|
237
|
+
return @_preservstart
|
238
|
+
end
|
239
|
+
|
240
|
+
#populate @_servend with values. just to get same size
|
241
|
+
@_intarrival.each{|i| @_servend << i}
|
242
|
+
|
243
|
+
# #Please maintain order if you are editing the code!
|
244
|
+
# # Calling functions
|
245
|
+
getarrive_() #Returns arrival time
|
246
|
+
servbegins_() #Returns time when servce begin
|
247
|
+
|
248
|
+
def get_servend_()
|
249
|
+
'''Retuns time when service ends'''
|
250
|
+
x = 0; while x < ((@_preservstart).size)
|
251
|
+
@_servend[x] = @_preservstart[x] + @_service[x]
|
252
|
+
s = 1; while s < (@_preservstart).size
|
253
|
+
if @_preservstart[s] < (maximum = @_arrival[s] > @_servend[x]? @_arrival[s] : @_servend[x])
|
254
|
+
@_preservstart[s] = (maximum)
|
255
|
+
end
|
256
|
+
s+=1
|
257
|
+
end
|
258
|
+
x+=1
|
259
|
+
end
|
260
|
+
|
261
|
+
return @_servend
|
262
|
+
end
|
263
|
+
|
264
|
+
# Method used to calculate the rest of the data like
|
265
|
+
#time when service begins
|
266
|
+
#wait time in queue, (_queue)
|
267
|
+
#time customer spent in the system (_custspend)
|
268
|
+
def otherresults(list1, list2, list3)
|
269
|
+
''' Stores and return the value of (list2 - list3) in list1 '''
|
270
|
+
x = 0; while x < list2.size
|
271
|
+
list1 << (list2[x] - list3[x])
|
272
|
+
x+=1
|
273
|
+
end
|
274
|
+
list1[0] = 0 if list1[0] < 0
|
275
|
+
end
|
276
|
+
|
277
|
+
def idletime_()
|
278
|
+
'''Returns the idle time of server'''
|
279
|
+
x,y = 0,1
|
280
|
+
while y < @_servend.size
|
281
|
+
(@_idle) << (@_servstart[y] - @_servend[x])
|
282
|
+
x+=1; y+=1
|
283
|
+
end
|
284
|
+
return @_idle
|
285
|
+
end
|
286
|
+
|
287
|
+
# Calling other methods
|
288
|
+
get_servend_()
|
289
|
+
otherresults(@_servstart, @_servend, @_service)
|
290
|
+
otherresults(@_queue, @_servstart, @_arrival)
|
291
|
+
otherresults(@_custspend, @_servend, @_arrival)
|
292
|
+
idletime_()
|
293
|
+
end
|
294
|
+
#Simulation class will inherit methods from the Randomsim class
|
295
|
+
|
296
|
+
end
|
297
|
+
|
298
|
+
#end
|
299
|
+
end
|
300
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Eventsims
|
2
|
+
VERSION = "0.0.1"
|
3
|
+
end
|
4
|
+
|
5
|
+
#Files
|
6
|
+
# --> 1 = discrete.rb
|
7
|
+
# --> 2 = randgen.rb
|
8
|
+
# --> 3 = simevent.rb
|
9
|
+
|
10
|
+
#All Eventsim methods
|
11
|
+
#1. trimval, --> 1
|
12
|
+
#2. trimlist, --> 1
|
13
|
+
|
14
|
+
#All Eventsim classes
|
15
|
+
#3. Calculate --> 1
|
16
|
+
#4 Generate --> 2
|
17
|
+
#5. Randomsim --> 3
|
18
|
+
#6. Simulate --> 3
|
19
|
+
|
20
|
+
#####################
|
21
|
+
#5. Simtable --> 3 # not implemented
|
22
|
+
#####################
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eventsims
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Taiwo Kareem
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: 'Eventsims is a Ruby package for simulating discrete event. It has four
|
42
|
+
classes (Calculate, Generate, Randomsim and Simulate) and two methods(trimval and
|
43
|
+
trimlist) for making this possible. '
|
44
|
+
email:
|
45
|
+
- taiwo.kareem36@gmail.com
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- .Gemfile.lock.swp
|
51
|
+
- .gitignore
|
52
|
+
- .rspec
|
53
|
+
- Gemfile
|
54
|
+
- Guardfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- bin/console
|
59
|
+
- bin/setup
|
60
|
+
- eventsims.gemspec
|
61
|
+
- lib/eventsims.rb
|
62
|
+
- lib/eventsims/discrete.rb
|
63
|
+
- lib/eventsims/randgen.rb
|
64
|
+
- lib/eventsims/simevent.rb
|
65
|
+
- lib/eventsims/version.rb
|
66
|
+
homepage: http://github.com/tushortz/eventsims
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.0.14
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: Eventsims uses various useful tools in simulating discrete system events
|
90
|
+
based on outcome and probabilities
|
91
|
+
test_files: []
|