y_petri 2.4.4 → 2.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Introduction_to_Ruby_for_YPetri_and_YNelson_Users.pdf +0 -0
- data/Introduction_to_YNelson_and_YPetri.pdf +0 -0
- data/Object_model_of_YNelson_and_YPetri.pdf +0 -0
- data/lib/y_petri/net/own_state.rb +1 -0
- data/lib/y_petri/transition/T.rb +31 -1
- data/lib/y_petri/version.rb +1 -1
- data/test/net_test.rb +2 -0
- metadata +3 -3
- data/Introduction_to_Ruby_for_YNelson_Users.pdf +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22a302201ca7709ed6061786b211385f5c1ae7a1
|
4
|
+
data.tar.gz: d8d30ab9b582179a79d69a541076a135a62fe32a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 583d5b7651ac596dc211a148d630dc5949ce52e7ef302e827e4bc13315fad8394aa8314a29a3763e13a94a56b2829c1c856d02f1f5fedc21268c98bce123c88c
|
7
|
+
data.tar.gz: f8e18341fdc25dcb6cf99751ebc11dc3feb2b400cbb516931ff6654562dc065bd1845c8b320669abf6bab8b8811aeff63ed721d4ddd0dd4e6d3049c1f2bba941
|
Binary file
|
Binary file
|
Binary file
|
@@ -19,6 +19,7 @@ module YPetri::Net::OwnState
|
|
19
19
|
return marking( pp ) if place_ids.nil?
|
20
20
|
place_ids.map { |id| place( id ).marking }
|
21
21
|
end
|
22
|
+
alias m marking
|
22
23
|
|
23
24
|
# Takes an array of tS transition identifiers as an optional argument, and
|
24
25
|
# returns the array of their firing under current net state. If no argument
|
data/lib/y_petri/transition/T.rb
CHANGED
@@ -10,8 +10,38 @@ module YPetri::Transition::Type_T
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# Transition's action (before validation). Requires Δt as an argument.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
def action Δt
|
15
|
+
# TODO: Unhelpful error occurs if the user constructs a transition
|
16
|
+
# like this:
|
17
|
+
#
|
18
|
+
# T = Transition s: { A: -1, B: 2 },
|
19
|
+
# rate: -> { 0.1 } # constant rate
|
20
|
+
#
|
21
|
+
# The user meant to construct a TS transition with constant rate and
|
22
|
+
# stoichiometry { A: -1, B: 2 }, but the lambda given under :rate
|
23
|
+
# parameter is nullary, while the stoichiometry is taken to imply that
|
24
|
+
# the domain consists of place 1.
|
25
|
+
#
|
26
|
+
# T.action 5.0
|
27
|
+
#
|
28
|
+
# then causes error because it tries to supply the marking of A to
|
29
|
+
# the user-supplied rate closure, which is nullary.
|
30
|
+
#
|
31
|
+
# There are 2 problems with this:
|
32
|
+
#
|
33
|
+
# Firstly, if we choose to see this as the user's problem, the user
|
34
|
+
# supplied the Transition constructor with invalid input, but received
|
35
|
+
# no warning (problem 1). The user learned about the error by typing
|
36
|
+
# T.action 5.0, and the error message is quite unhelpful (problem 2) -
|
37
|
+
# it does not inform the user that the rate closure has wrong arity.
|
38
|
+
#
|
39
|
+
# We, we might deside to see this as a missing feature and make sure
|
40
|
+
# that in these cases, the constructor infers that the codomain is
|
41
|
+
# empty from the fact that the supplied rate closure is nullary. This
|
42
|
+
# requires additional thinking, because it is not possible to infer
|
43
|
+
# domain from rate lamdas with non-matching arity in general.
|
44
|
+
#
|
15
45
|
if stoichiometric? then
|
16
46
|
rate = rate_closure.( *domain_marking )
|
17
47
|
stoichiometry.map { |coeff| rate * coeff * Δt }
|
data/lib/y_petri/version.rb
CHANGED
data/test/net_test.rb
CHANGED
@@ -80,6 +80,8 @@ describe YPetri::Net do
|
|
80
80
|
@net.state.must_equal [ @p1, @p2, @p3 ].map( &:marking )
|
81
81
|
@net.marking.must_equal [ @p1, @p2, @p3 ].map( &:marking )
|
82
82
|
@net.marking.must_be_kind_of Array
|
83
|
+
# User-expected #m alias for #marking
|
84
|
+
@net.m.must_equal @net.marking
|
83
85
|
end
|
84
86
|
|
85
87
|
it "should have standard equipment expected of a class" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: y_petri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- boris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,7 +130,7 @@ files:
|
|
130
130
|
- ".gitignore"
|
131
131
|
- ACKNOWLEDGMENT.txt
|
132
132
|
- Gemfile
|
133
|
-
-
|
133
|
+
- Introduction_to_Ruby_for_YPetri_and_YNelson_Users.pdf
|
134
134
|
- Introduction_to_YNelson_and_YPetri.pdf
|
135
135
|
- LICENSE.txt
|
136
136
|
- Object_model_of_YNelson_and_YPetri.pdf
|
Binary file
|