Browse Source

Merge from future

Former-commit-id: 466833b425 [formerly 8d2ddbd670]
Former-commit-id: 39a0249482
main
Mavo 9 years ago
parent
commit
f664935123
  1. 5
      .gitignore
  2. 5
      CMakeLists.txt
  3. 1
      examples/dtmc/die/die.pm
  4. 41034
      examples/gspn/HypercubeGrid/hc3k4p4b12.pnml
  5. 87274
      examples/gspn/HypercubeGrid/hc4k3p3b12.pnml
  6. 1
      examples/gspn/HypercubeGrid/hc5k3p3b15.pnml.REMOVED.git-id
  7. 5554
      examples/gspn/ibm319/IBM319.pnml
  8. 14
      examples/gspn/pnpro_test1/project01.PNPRO
  9. 148
      examples/gspn/tiny/tiny01.pnml
  10. 1236
      examples/gspn/workflow_cluster/workflow_cluster.pnml
  11. 2604
      examples/jani-examples/beb.jani
  12. 27
      examples/jani-examples/beb.jani.txt
  13. 64
      examples/jani-examples/beb.modest
  14. 27
      examples/jani-examples/beb.modest.txt
  15. 2092
      examples/jani-examples/brp.jani
  16. 63
      examples/jani-examples/brp.jani.txt
  17. 213
      examples/jani-examples/brp.modest
  18. 63
      examples/jani-examples/brp.modest.txt
  19. 2129
      examples/jani-examples/consensus-6.jani
  20. 27
      examples/jani-examples/consensus-6.jani.txt
  21. 157
      examples/jani-examples/consensus-6.modest
  22. 27
      examples/jani-examples/consensus-6.modest.txt
  23. 354
      examples/jani-examples/dice.jani
  24. 29
      examples/jani-examples/dice.jani.txt
  25. 87
      examples/pctmc/polling6.sm
  26. 3
      examples/pdtmc/brp/brp.pm
  27. 2
      examples/pdtmc/brp/brp16_2.pm
  28. 2
      examples/pdtmc/brp_rewards2/brp_rewards16_2.pm
  29. 3
      examples/pdtmc/brp_rewards2/brp_rewards2.pm
  30. 2
      examples/pdtmc/brp_rewards4/brp_rewards16_2.pm
  31. 3
      examples/pdtmc/brp_rewards4/brp_rewards4.pm
  32. 35
      examples/pdtmc/die.pm
  33. 44
      examples/pdtmc/twodie.pm
  34. 58
      examples/pgcl/coupon/coupon10-classic.pgcl
  35. 60
      examples/pgcl/coupon/coupon10-cost.pgcl
  36. 62
      examples/pgcl/coupon/coupon10-observe.pgcl
  37. 60
      examples/pgcl/coupon/coupon10.pgcl
  38. 24
      examples/pgcl/coupon/coupon3-classic.pgcl
  39. 28
      examples/pgcl/coupon/coupon3-cost.pgcl
  40. 30
      examples/pgcl/coupon/coupon3-observe.pgcl
  41. 28
      examples/pgcl/coupon/coupon3.pgcl
  42. 34
      examples/pgcl/coupon/coupon4-observe.pgcl
  43. 32
      examples/pgcl/coupon/coupon5-classic.pgcl
  44. 36
      examples/pgcl/coupon/coupon5-cost.pgcl
  45. 38
      examples/pgcl/coupon/coupon5-observe.pgcl
  46. 36
      examples/pgcl/coupon/coupon5.pgcl
  47. 40
      examples/pgcl/coupon/coupon7-classic.pgcl
  48. 44
      examples/pgcl/coupon/coupon7-cost.pgcl
  49. 46
      examples/pgcl/coupon/coupon7-observe.pgcl
  50. 44
      examples/pgcl/coupon/coupon7.pgcl
  51. 35
      examples/pgcl/crowds/crowds100-100-observeOther.pgcl
  52. 34
      examples/pgcl/crowds/crowds100-100.pgcl
  53. 35
      examples/pgcl/crowds/crowds100-60-observeOther.pgcl
  54. 34
      examples/pgcl/crowds/crowds100-60-param.pgcl
  55. 34
      examples/pgcl/crowds/crowds100-60.pgcl
  56. 36
      examples/pgcl/crowds/crowds100-80-observeOther.pgcl
  57. 34
      examples/pgcl/crowds/crowds100-80.pgcl
  58. 34
      examples/pgcl/crowds/crowds3-3-param.pgcl
  59. 34
      examples/pgcl/crowds/crowds3-3.pgcl
  60. 33
      examples/pgcl/crowds/crowds3-5-param.pgcl
  61. 34
      examples/pgcl/crowds/crowds3-5.pgcl
  62. 34
      examples/pgcl/crowds/crowds5-20-param.pgcl
  63. 34
      examples/pgcl/crowds/crowds5-20.pgcl
  64. 108
      examples/pgcl/herman/herman10-det.pgcl
  65. 108
      examples/pgcl/herman/herman10.pgcl
  66. 138
      examples/pgcl/herman/herman13-det.pgcl
  67. 138
      examples/pgcl/herman/herman13.pgcl
  68. 178
      examples/pgcl/herman/herman17-det.pgcl
  69. 178
      examples/pgcl/herman/herman17.pgcl
  70. 218
      examples/pgcl/herman/herman21-det.pgcl
  71. 218
      examples/pgcl/herman/herman21.pgcl
  72. 77
      examples/pgcl/herman/herman7-det.pgcl
  73. 77
      examples/pgcl/herman/herman7.pgcl
  74. 49
      examples/pgcl/lotkavolterra.pgcl
  75. 26
      examples/pgcl/robot.pgcl
  76. 2
      examples/pmdp/brp/brp.pm
  77. 5
      examples/pmdp/coin2/coin2.pm
  78. 3
      examples/pmdp/coin4/coin4.pm
  79. 11
      examples/pmdp/zeroconf/zeroconf.pm
  80. 6
      resources/3rdparty/CMakeLists.txt
  81. 9
      resources/3rdparty/include_xerces.cmake
  82. 4
      resources/3rdparty/modernjson/CMakeLists.txt
  83. 59
      resources/3rdparty/modernjson/ChangeLog.md
  84. 35
      resources/3rdparty/modernjson/Makefile
  85. 178
      resources/3rdparty/modernjson/README.md
  86. 3
      resources/3rdparty/modernjson/appveyor.yml
  87. 77
      resources/3rdparty/modernjson/benchmarks/benchmarks.cpp
  88. 401
      resources/3rdparty/modernjson/benchmarks/benchpress.hpp
  89. 1312
      resources/3rdparty/modernjson/benchmarks/cxxopts.hpp
  90. 1
      resources/3rdparty/modernjson/benchmarks/files/jeopardy/jeopardy.json.REMOVED.git-id
  91. 9
      resources/3rdparty/modernjson/benchmarks/files/nativejson-benchmark/canada.json
  92. 50469
      resources/3rdparty/modernjson/benchmarks/files/nativejson-benchmark/citm_catalog.json
  93. 15482
      resources/3rdparty/modernjson/benchmarks/files/nativejson-benchmark/twitter.json
  94. 317
      resources/3rdparty/modernjson/doc/Doxyfile
  95. 82
      resources/3rdparty/modernjson/doc/Makefile
  96. 26
      resources/3rdparty/modernjson/doc/css/mylayout.css
  97. 27
      resources/3rdparty/modernjson/doc/css/mylayout_docset.css
  98. 36
      resources/3rdparty/modernjson/doc/examples/README.cpp
  99. 1
      resources/3rdparty/modernjson/doc/examples/README.link
  100. 27
      resources/3rdparty/modernjson/doc/examples/README.output

5
.gitignore

@ -3,7 +3,8 @@ resources/3rdparty/log4cplus-1.1.3-rc1/
resources/3rdparty/gtest-1.7.0/
resources/3rdparty/eigen/
resources/3rdparty/gmm-4.2/
resources/3rdparty/cudd-2.5.0/
resources/3rdparty/cudd-3.0.0/
resources/3rdparty/carl/
resources/3rdparty/xercesc-3.1.2/
#Visual Studio files
*.[Oo]bj
@ -49,4 +50,4 @@ src/utility/storm-version.cpp
nbproject/
.DS_Store
.idea
*.out
*.out

5
CMakeLists.txt

@ -30,13 +30,14 @@ option(STORM_USE_COTIRE "Sets whether Cotire should be used (for building precom
option(LINK_LIBCXXABI "Sets whether libc++abi should be linked." OFF)
option(USE_LIBCXX "Sets whether the standard library is libc++." OFF)
option(USE_CARL "Sets whether carl should be included." ON)
option(USE_XERCES "Sets whether xerces should be used." OFF)
option(XML_SUPPORT "Sets whether xml based format parsing should be included." ON)
option(FORCE_COLOR "Force color output" OFF)
mark_as_advanced(FORCE_COLOR)
option(STORM_PYTHON "Builds the API for Python" OFF)
option(STORM_COMPILE_WITH_CCACHE "Compile using CCache [if found]" ON)
mark_as_advanced(STORM_COMPILE_WITH_CCACHE)
option(STORM_LOG_DISABLE_DEBUG "Disable log and trace message support" OFF)
option(STORM_USE_CLN_NUMBERS "Sets whether CLN or GMP numbers should be used" ON)
set(BOOST_ROOT "" CACHE STRING "A hint to the root directory of Boost (optional).")
set(GUROBI_ROOT "" CACHE STRING "A hint to the root directory of Gurobi (optional).")
set(Z3_ROOT "" CACHE STRING "A hint to the root directory of Z3 (optional).")
@ -44,6 +45,8 @@ set(CUDA_ROOT "" CACHE STRING "The hint to the root directory of CUDA (optional)
set(MSAT_ROOT "" CACHE STRING "The hint to the root directory of MathSAT (optional).")
set(ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "Additional directories added to the include directories.")
set(ADDITIONAL_LINK_DIRS "" CACHE STRING "Additional directories added to the link directories.")
set(USE_XERCES ${XML_SUPPORT})
mark_as_advanced(USE_XERCES)
# Set some CMAKE Variables as advanced
mark_as_advanced(CMAKE_OSX_ARCHITECTURES)

1
examples/dtmc/die/die.pm

@ -29,3 +29,4 @@ label "three" = s=7&d=3;
label "four" = s=7&d=4;
label "five" = s=7&d=5;
label "six" = s=7&d=6;
label "end" = s=7;

41034
examples/gspn/HypercubeGrid/hc3k4p4b12.pnml
File diff suppressed because it is too large
View File

87274
examples/gspn/HypercubeGrid/hc4k3p3b12.pnml
File diff suppressed because it is too large
View File

1
examples/gspn/HypercubeGrid/hc5k3p3b15.pnml.REMOVED.git-id

@ -0,0 +1 @@
1dcc3a0045e4d0f9358f9ee04e70c6f0107929be

5554
examples/gspn/ibm319/IBM319.pnml
File diff suppressed because it is too large
View File

14
examples/gspn/pnpro_test1/project01.PNPRO

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- This project file has been saved by the New GreatSPN Editor, v.100 --><project name="project01" version="121">
<gspn name="gspn_1_1" show-color-cmd="false" show-fluid-cmd="false">
<nodes>
<place marking="1" name="P0" x="3.0" y="2.0"/>
<transition name="T0" nservers-x="0.5" type="EXP" x="9.55" y="2.0"/>
<place name="P1" x="14.0" y="2.0"/>
</nodes>
<edges>
<arc head="T0" kind="INPUT" tail="P0"/>
<arc head="P1" kind="OUTPUT" tail="T0"/>
</edges>
</gspn>
</project>

148
examples/gspn/tiny/tiny01.pnml

@ -0,0 +1,148 @@
<pnml>
<net id="tiny1">
<place id="p1">
<initialMarking>
<value>Default,1</value>
</initialMarking>
</place>
<place id="p2">
<initialMarking>
<value>Default,1</value>
</initialMarking>
</place>
<place id="p3">
<initialMarking>
<value>Default,0</value>
</initialMarking>
</place>
<place id="p4">
<initialMarking>
<value>Default,0</value>
</initialMarking>
</place>
<place id="p5">
<initialMarking>
<value>Default,0</value>
</initialMarking>
</place>
<place id="p6">
<initialMarking>
<value>Default,0</value>
</initialMarking>
</place>
<place id="p7">
<initialMarking>
<value>Default,0</value>
</initialMarking>
</place>
<transition id="t1">
<rate>
<value>1</value>
</rate>
<timed>
<value>false</value>
</timed>
</transition>
<transition id="t2">
<rate>
<value>2</value>
</rate>
<timed>
<value>false</value>
</timed>
</transition>
<transition id="t3">
<rate>
<value>3</value>
</rate>
<timed>
<value>false</value>
</timed>
</transition>
<transition id="l1">
<rate>
<value>4</value>
</rate>
<timed>
<value>true</value>
</timed>
</transition>
<transition id="l2">
<rate>
<value>5</value>
</rate>
<timed>
<value>true</value>
</timed>
<priority>
<text>2</text>
</priority>
</transition>
<arc id="arc1" source="p1" target="t1">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc2" source="t1" target="p3">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc3" source="p2" target="t2">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc4" source="t2" target="p5">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc5" source="p2" target="t3">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc6" source="p3" target="t3">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc7" source="t3" target="p4">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc8" source="p4" target="l1">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc9" source="l1" target="p6">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc10" source="p5" target="l2">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
<arc id="arc11" source="l2" target="p7">
<inscription>
<value>Default,1</value>
</inscription>
<type value="normal" />
</arc>
</net>
</pnml>

1236
examples/gspn/workflow_cluster/workflow_cluster.pnml
File diff suppressed because it is too large
View File

2604
examples/jani-examples/beb.jani
File diff suppressed because it is too large
View File

27
examples/jani-examples/beb.jani.txt

@ -1,27 +0,0 @@
Peak memory usage: 38 MB
Analysis results for beb.jani
+ State space exploration
States: 4528
Transitions: 4874
Branches: 6899
Time: 0.0 s
Rate: 92408 states/s
+ LineSeized
Probability: 0.9166259765625
Time: 0.1 s
+ Value iteration
Final error: 0
Iterations: 8
Time: 0.0 s
+ GaveUp
Probability: 0.0833740234375
Time: 0.0 s
+ Value iteration
Final error: 0
Iterations: 9
Time: 0.0 s

64
examples/jani-examples/beb.modest

@ -1,64 +0,0 @@
// Modest MDP model of the bounded exponential backoff procedure (BEB)
// [BFHH11]
action tick, tack, tock;
const int K = 4; // maximum value for backoff
const int N = 3; // number of tries before giving up
const int H = 3; // number of hosts (must correspond to the number of Host() instantiations in the global composition)
int(0..2) cr; // count how many hosts attempt to seize the line in a slot (zero, one, many)
bool line_seized;
bool gave_up;
property LineSeized = Pmax(<> line_seized); // some host managed to seize the line before any other gave up
property GaveUp = Pmax(<> gave_up); // some host gave up before any other managed to seize the line (does not work with POR)
process Clock()
{
tick; tack; tau {= cr = 0 =}; tock; Clock()
}
process Host()
{
int(0..N) na; // nr_attempts 0..N
int(0..K) ev = 2; // exp_val 0..K
int(0..K) wt; // slots_to_wait 0..K
do
{
if(wt > 0)
{
// wait this slot
tick {= wt-- =}
}
else
{
tau {= cr = min(2, cr + 1) =}; // attempt to seize the line
tick;
if(cr == 1)
{
// someone managed to seize the line
tau {= line_seized = true =}; stop
}
else if(na >= N)
{
// maximum number of attempts exceeded
tau {= gave_up = true =}; stop
}
else
{
// backoff
tau {= na++, wt = DiscreteUniform(0, max(0, ev - 1)), ev = min(2 * ev, K) =}
}
};
tack; tock
}
}
par
{
:: Clock()
:: Host()
:: Host()
:: Host()
}

27
examples/jani-examples/beb.modest.txt

@ -1,27 +0,0 @@
Peak memory usage: 39 MB
Analysis results for beb.modest
+ State space exploration
States: 4528
Transitions: 4874
Branches: 6899
Time: 0.0 s
Rate: 94333 states/s
+ LineSeized
Probability: 0.9166259765625
Time: 0.1 s
+ Value iteration
Final error: 0
Iterations: 8
Time: 0.0 s
+ GaveUp
Probability: 0.0833740234375
Time: 0.0 s
+ Value iteration
Final error: 0
Iterations: 9
Time: 0.0 s

2092
examples/jani-examples/brp.jani
File diff suppressed because it is too large
View File

63
examples/jani-examples/brp.jani.txt

@ -1,63 +0,0 @@
Peak memory usage: 39 MB
Analysis results for brp.jani
+ State space exploration
States: 3959
Transitions: 4244
Branches: 4593
Time: 0.1 s
Rate: 74698 states/s
+ P_A
Probability: 0
Time: 0.0 s
+ Value iteration
Final error: 0
Iterations: 1
Time: 0.0 s
+ P_B
Probability: 0
Time: 0.0 s
+ Value iteration
Final error: 0
Iterations: 1
Time: 0.0 s
+ P_1
Probability: 0.000423333443357766
Time: 0.0 s
+ Value iteration
Final error: 2.35005704803786E-07
Iterations: 13
Time: 0.0 s
+ P_2
Probability: 2.64530890961023E-05
Time: 0.0 s
+ Value iteration
Final error: 2.05561452068843E-07
Iterations: 14
Time: 0.0 s
+ P_3
Probability: 0.000185191226393368
Time: 0.0 s
+ Value iteration
Final error: 3.32462409056221E-07
Iterations: 13
Time: 0.0 s
+ P_4
Probability: 8E-06
Time: 0.0 s
+ Value iteration
Final error: 0
Iterations: 2
Time: 0.0 s

213
examples/jani-examples/brp.modest

@ -1,213 +0,0 @@
// Modest PTA model of the bounded retransmission protocol (BRP)
// [HH09], http://www.modestchecker.net/CaseStudies/BRP/
action put, get, put_k, get_k, put_l, get_l;
action new_file;
action s_ok, s_dk, s_nok, s_restart;
action r_ok, r_inc, r_fst, r_nok, r_timeout;
exception error;
const int N = 16; // number of frames per file
const int MAX = 2; // maximum number of retransmissions per frame
const int TD = 1; // transmission delay
const int TS = 2 * TD + 1; // sender timeout
const int TR = 2 * MAX * TS + 3 * TD; // receiver timeout
const int SYNC = TR;
bool ff, lf, ab; // channel data: first/last frame, alternating bit
int(0..N) i; // sender chunk counter
bool inTransitK = false;
bool inTransitL = false;
bool first_file_done = false;
bool get_k_seen, s_ok_seen, s_nok_seen, s_dk_seen, s_restart_seen, r_ok_seen, r_timeout_seen;
// Invariant (timed) properties (from [BrpOnTime], the TA model)
bool premature_timeout, channel_k_overflow, channel_l_overflow;
// "there is at most one message in transit for each channel"
property T_1 = A[] (!(channel_k_overflow || channel_l_overflow));
// "there is at most one message in transit in total"
property T_2 = A[] (!(inTransitK && inTransitL));
// Assumption (A1): "no premature timeouts"
property T_A1 = A[] (!premature_timeout);
// Assumption (A2): "sender starts new file only after receiver reacted to failure"
// Note that receiver can only notice failure if it received at least one chunk, i.e. get_k_seen
property T_A2 = A[] (!s_restart_seen || !get_k_seen || r_timeout_seen);
// Probabilistic reachability properties (from [D'AJJL01], the RAPTURE/PRISM model)
// property A of [D'AJJL01]: "the maximum probability that eventually the sender reports
// a certain unsuccessful transmission but the receiver got the complete file"
property P_A = Pmax(<>(s_nok_seen && r_ok_seen));
// property B of [D'AJJL01]: "the maximum probability that eventually the sender reports
// a certain successful transmission but the receiver did not get the complete file"
property P_B = Pmax(<>(s_ok_seen && !r_ok_seen));
// property 1 of [D'AJJL01]: "the maximum probability that eventually the sender
// does not report a successful transmission"
property P_1 = Pmax(<>(s_nok_seen || s_dk_seen));
// property 2 of [D'AJJL01]: "the maximum probability that eventually the sender
// reports an uncertainty on the success of the transmission"
property P_2 = Pmax(<>(s_dk_seen));
// property 3 of [D'AJJL01]: "the maximum probability that eventually the sender
// reports an unsuccessful transmission after more than 8 chunks have been sent successfully"
property P_3 = Pmax(<>(s_nok_seen && i > 8));
// property 4 of [D'AJJL01]: "the maximum probability that eventually the receiver
// does not receive any chunk and the sender tried to send a chunk"
property P_4 = Pmax(<>((s_ok_seen || s_nok_seen || s_dk_seen) && !get_k_seen));
process Sender()
{
bool bit;
int(0..MAX) rc;
clock c;
try
{
do {
:: when urgent(i < N) {= i++ =};
do
{
// send frame
invariant(c <= 0) put_k {= ff = (i == 1), lf = (i == N), ab = bit, c = 0 =};
invariant(c <= TS) alt {
:: // receive ack
get_l {= bit = !bit, rc = 0, c = 0 =};
urgent break
:: // timeout
when(c >= TS)
if(rc < MAX)
{
// retry
{= rc++, c = 0 =}
}
else if(i < N)
{
// no retries left
s_nok {= rc = 0, c = 0 =};
urgent throw(error)
}
else
{
// no retries left
s_dk {= rc = 0, c = 0 =};
urgent throw(error)
}
}
}
:: when(i == N)
// file transmission successfully completed
invariant(c <= 0) s_ok {= first_file_done = true =};
urgent break
}
}
catch error
{
// File transfer did not succeed: wait, then restart with next file
invariant(c <= SYNC) when(c >= SYNC)
s_restart {= bit = false, first_file_done = true =}
}
}
process Receiver()
{
bool r_ff, r_lf, r_ab;
bool bit;
clock c;
// receive first frame
if(ff) { get_k {= c = 0, bit = ab, r_ff = ff, r_lf = lf, r_ab = ab =} }
else { get_k {= c = 0, premature_timeout = true =}; stop };
do
{
invariant(c <= 0)
{
if(r_ab != bit)
{
// repetition, re-ack
put_l
}
else
{
// report frame
if(r_lf) { r_ok }
else if(r_ff) { r_fst }
else { r_inc };
put_l {= bit = !bit =}
}
};
invariant(c <= TR)
{
alt {
:: // receive next frame
get_k {= c = 0, r_ff = ff, r_lf = lf, r_ab = ab =}
:: // timeout
when(c == TR)
if(r_lf)
{
// we just got the last frame, though
r_timeout; break
}
else
{
r_nok;
// abort transfer
r_timeout; break
}
}
}
};
Receiver()
}
process ChannelK()
{
clock c;
put_k palt
{
:98: {= c = 0, inTransitK = true =};
invariant(c <= TD) alt {
:: get_k {= inTransitK = false =}
:: put_k {= channel_k_overflow = true =}; stop
}
: 2: {==}
};
ChannelK()
}
process ChannelL()
{
clock c;
put_l palt
{
:99: {= c = 0, inTransitL = true =};
invariant(c <= TD) alt {
:: get_l {= inTransitL = false =}
:: put_l {= channel_l_overflow = true =}; stop
}
: 1: {==}
};
ChannelL()
}
process Observer()
{
alt {
:: get_k {= get_k_seen = true =}
:: s_ok {= s_ok_seen = true =}
:: s_nok {= s_nok_seen = true =}
:: s_dk {= s_dk_seen = true =}
:: s_restart {= s_restart_seen = true =}
:: r_ok {= r_ok_seen = true =}
:: r_timeout {= r_timeout_seen = true =}
};
Observer()
}
par {
:: Sender()
:: Receiver()
:: ChannelK()
:: ChannelL()
:: Observer()
}

63
examples/jani-examples/brp.modest.txt

@ -1,63 +0,0 @@
Peak memory usage: 40 MB
Analysis results for brp.modest
+ State space exploration
States: 3959
Transitions: 4244
Branches: 4593
Time: 0.1 s
Rate: 73315 states/s
+ P_A
Probability: 0
Time: 0.1 s
+ Value iteration
Final error: 0
Iterations: 1
Time: 0.0 s
+ P_B
Probability: 0
Time: 0.0 s
+ Value iteration
Final error: 0
Iterations: 1
Time: 0.0 s
+ P_1
Probability: 0.000423333443357766
Time: 0.0 s
+ Value iteration
Final error: 2.35005704803786E-07
Iterations: 13
Time: 0.0 s
+ P_2
Probability: 2.64530890961023E-05
Time: 0.0 s
+ Value iteration
Final error: 2.05561452068843E-07
Iterations: 14
Time: 0.0 s
+ P_3
Probability: 0.000185191226393368
Time: 0.0 s
+ Value iteration
Final error: 3.32462409056221E-07
Iterations: 13
Time: 0.0 s
+ P_4
Probability: 8E-06
Time: 0.0 s
+ Value iteration
Final error: 0
Iterations: 2
Time: 0.0 s

2129
examples/jani-examples/consensus-6.jani
File diff suppressed because it is too large
View File

27
examples/jani-examples/consensus-6.jani.txt

@ -1,27 +0,0 @@
Peak memory usage: 530 MB
Analysis results for consensus-6.jani
+ State space exploration
States: 2345194
Transitions: 9418584
Branches: 13891248
Time: 8.7 s
Rate: 270964 states/s
+ C1
Result: True
Time for min. prob. 0 states: 1.6 s
Time for min. prob. 1 states: 0.1 s
Time: 1.7 s
Min. probability: 1
+ C2
Probability: 0.395776147642961
Time for min. prob. 0 states: 2.0 s
Time for min. prob. 1 states: 0.1 s
Time: 125.8 s
+ Value iteration
Final error: 9.96634356860147E-07
Iterations: 2137
Time: 123.8 s

157
examples/jani-examples/consensus-6.modest

@ -1,157 +0,0 @@
// Modest version of http://www.prismmodelchecker.org/casestudies/consensus_prism.php
// Command line: mcsta.exe consensus-6.modest -S Memory --nochainopt --bounded-alg StateElimination -E "K=2"
action done;
// constants
const int N = 6;
const int K = 4;
const int range = 2 * (K + 1) * N;
const int counter_init = (K + 1) * N;
const int left = N;
const int right = 2 * (K + 1) * N - N;
// shared coin
int(0..range) counter = counter_init;
reward coin_flips;
property C1 = P(<> (fin1 == 1 && fin2 == 1 && fin3 == 1 && fin4 == 1 && fin5 == 1 && fin6 == 1)) >= 1;
property C2 = Pmin(<> (fin1 == 1 && fin2 == 1 && fin3 == 1 && fin4 == 1 && fin5 == 1 && fin6 == 1 && coin1 == 1 && coin2 == 1 && coin3 == 1 && coin4 == 1 && coin5 == 1 && coin6 == 1));
int(0..1) fin1, fin2, fin3, fin4, fin5, fin6;
int(0..1) coin1, coin2, coin3, coin4, coin5, coin6;
process Tourist1()
{
process Flip() { palt { :1: {= coin1 = 0, coin_flips++ =} :1: {= coin1 = 1, coin_flips++ =} }; Write() }
process Write() {
alt {
:: when(coin1 == 0 && counter > 0) {= counter-- =}; Check()
:: when(coin1 == 1 && counter < range) {= counter++, coin1 = 0 =}; Check()
}
}
process Check() {
alt {
:: when(counter <= left) {= coin1 = 0, fin1 = 1 =}; Finished()
:: when(counter >= right) {= coin1 = 1, fin1 = 1 =}; Finished()
:: when(counter > left && counter < right) Tourist1()
}
}
process Finished() { done; Finished() }
Flip()
}
process Tourist2()
{
process Flip() { palt { :1: {= coin2 = 0, coin_flips++ =} :1: {= coin2 = 1, coin_flips++ =} }; Write() }
process Write() {
alt {
:: when(coin2 == 0 && counter > 0) {= counter-- =}; Check()
:: when(coin2 == 1 && counter < range) {= counter++, coin2 = 0 =}; Check()
}
}
process Check() {
alt {
:: when(counter <= left) {= coin2 = 0, fin2 = 1 =}; Finished()
:: when(counter >= right) {= coin2 = 1, fin2 = 1 =}; Finished()
:: when(counter > left && counter < right) Tourist2()
}
}
process Finished() { done; Finished() }
Flip()
}
process Tourist3()
{
process Flip() { palt { :1: {= coin3 = 0, coin_flips++ =} :1: {= coin3 = 1, coin_flips++ =} }; Write() }
process Write() {
alt {
:: when(coin3 == 0 && counter > 0) {= counter-- =}; Check()
:: when(coin3 == 1 && counter < range) {= counter++, coin3 = 0 =}; Check()
}
}
process Check() {
alt {
:: when(counter <= left) {= coin3 = 0, fin3 = 1 =}; Finished()
:: when(counter >= right) {= coin3 = 1, fin3 = 1 =}; Finished()
:: when(counter > left && counter < right) Tourist3()
}
}
process Finished() { done; Finished() }
Flip()
}
process Tourist4()
{
process Flip() { palt { :1: {= coin4 = 0, coin_flips++ =} :1: {= coin4 = 1, coin_flips++ =} }; Write() }
process Write() {
alt {
:: when(coin4 == 0 && counter > 0) {= counter-- =}; Check()
:: when(coin4 == 1 && counter < range) {= counter++, coin4 = 0 =}; Check()
}
}
process Check() {
alt {
:: when(counter <= left) {= coin4 = 0, fin4 = 1 =}; Finished()
:: when(counter >= right) {= coin4 = 1, fin4 = 1 =}; Finished()
:: when(counter > left && counter < right) Tourist4()
}
}
process Finished() { done; Finished() }
Flip()
}
process Tourist5()
{
process Flip() { palt { :1: {= coin5 = 0, coin_flips++ =} :1: {= coin5 = 1, coin_flips++ =} }; Write() }
process Write() {
alt {
:: when(coin5 == 0 && counter > 0) {= counter-- =}; Check()
:: when(coin5 == 1 && counter < range) {= counter++, coin5 = 0 =}; Check()
}
}
process Check() {
alt {
:: when(counter <= left) {= coin5 = 0, fin5 = 1 =}; Finished()
:: when(counter >= right) {= coin5 = 1, fin5 = 1 =}; Finished()
:: when(counter > left && counter < right) Tourist5()
}
}
process Finished() { done; Finished() }
Flip()
}
process Tourist6()
{
process Flip() { palt { :1: {= coin6 = 0, coin_flips++ =} :1: {= coin6 = 1, coin_flips++ =} }; Write() }
process Write() {
alt {
:: when(coin6 == 0 && counter > 0) {= counter-- =}; Check()
:: when(coin6 == 1 && counter < range) {= counter++, coin6 = 0 =}; Check()
}
}
process Check() {
alt {
:: when(counter <= left) {= coin6 = 0, fin6 = 1 =}; Finished()
:: when(counter >= right) {= coin6 = 1, fin6 = 1 =}; Finished()
:: when(counter > left && counter < right) Tourist6()
}
}
process Finished() { done; Finished() }
Flip()
}
par {
:: Tourist1()
:: Tourist2()
:: Tourist3()
:: Tourist4()
:: Tourist5()
:: Tourist6()
}

27
examples/jani-examples/consensus-6.modest.txt

@ -1,27 +0,0 @@
Peak memory usage: 531 MB
Analysis results for consensus-6.modest
+ State space exploration
States: 2345194
Transitions: 9418584
Branches: 13891248
Time: 8.2 s
Rate: 287507 states/s
+ C1
Result: True
Time for min. prob. 0 states: 1.5 s
Time for min. prob. 1 states: 0.2 s
Time: 1.7 s
Min. probability: 1
+ C2
Probability: 0.395776147642961
Time for min. prob. 0 states: 2.0 s
Time for min. prob. 1 states: 0.1 s
Time: 126.8 s
+ Value iteration
Final error: 9.96634356860147E-07
Iterations: 2137
Time: 124.7 s

354
examples/jani-examples/dice.jani

@ -1,354 +0,0 @@
{
"jani-version": 1,
"name": "dice",
"type" : "mdp",
"actions" : [],
"variables" : [
{
"name": "thrownSix",
"type": "bool",
"initial-value": false
},
{
"name": "terminated",
"type": "bool",
"initial-value": false
}
],
"rewards" : [
{
"name" : "step"
}
],
"properties" : [
{
"name" : "ProbThrowSix",
"reach" : "thrownSix",
"type": "probability-max-query"
},
{
"name" : "StepsUntilReach",
"reach" : "terminated",
"reward": "step",
"type": "expected-reachability-reward-max-query"
}
],
"automata" : [
{
"name" : "dice",
"variables" : [
{
"name" : "d",
"type" : {
"kind": "bounded",
"base": "int",
"lower-bound" : 0,
"upper-bound" : 6
},
"initial-value" : 0
}
],
"locations" : [
{
"name" : "s0"
},
{
"name" : "s1"
},
{
"name" : "s2"
},
{
"name" : "s3"
},
{
"name" : "s4"
},
{
"name" : "s5"
},
{
"name" : "s6"
},
{
"name" : "s7"
}
],
"initial-location" : "s0",
"edges" : [
{
"location" : "s0",
"guard" : true,
"destinations" : [
{
"probability" : 0.5,
"location" : "s1",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
},
{
"probability" : 0.5,
"location" : "s2",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
}
]
},
{
"location" : "s1",
"guard" : true,
"destinations" : [
{
"probability" : 0.5,
"location" : "s3",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
},
{
"probability" : 0.5,
"location" : "s4",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
}
]
},
{
"location" : "s2",
"guard" : true,
"destinations" : [
{
"probability" : 0.5,
"location" : "s5",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
},
{
"probability" : 0.5,
"location" : "s6",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
}
]
},
{
"location" : "s3",
"guard" : true,
"destinations" : [
{
"probability" : 0.5,
"location" : "s1",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
},
{
"probability" : 0.5,
"location" : "s7",
"assignments" : [
{
"ref" : "d",
"value" : 1
},
{
"ref" : "terminated",
"value" : true
}
],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
}
]
},
{
"location" : "s4",
"guard" : true,
"destinations" : [
{
"probability" : 0.5,
"location" : "s7",
"assignments" : [
{
"ref" : "d",
"value" : 2
},
{
"ref" : "terminated",
"value" : true
}
],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
},
{
"probability" : 0.5,
"location" : "s7",
"assignments" : [
{
"ref" : "d",
"value" : 3
},
{
"ref" : "terminated",
"value" : true
}
],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
}
]
},
{
"location" : "s5",
"guard" : true,
"destinations" : [
{
"probability" : 0.5,
"location" : "s7",
"assignments" : [
{
"ref" : "d",
"value" : 4
},
{
"ref" : "terminated",
"value" : true
}
],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
},
{
"probability" : 0.5,
"location" : "s7",
"assignments" : [
{
"ref" : "d",
"value" : 5
},
{
"ref" : "terminated",
"value" : true
}
],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
}
]
},
{
"location" : "s6",
"guard" : true,
"destinations" : [
{
"probability" : 0.5,
"location" : "s2",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
},
{
"probability" : 0.5,
"location" : "s7",
"assignments" : [
{
"ref" : "d",
"value" : 6
},
{
"ref" : "thrownSix",
"value" : true
},
{
"ref" : "terminated",
"value" : true
}
],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
}
]
},
{
"location" : "s7",
"guard" : true,
"destinations" : [
{
"probability" : 1,
"location" : "s7",
"assignments" : [],
"rewards" : [
{
"ref" : "step",
"value" : 1
}
]
}
]
}
]
}
],
"system" : "dice"
}

29
examples/jani-examples/dice.jani.txt

@ -1,29 +0,0 @@
Peak memory usage: 36 MB
Analysis results for dice.jani
+ State space exploration
States: 8
Transitions: 8
Branches: 14
Time: 0.0 s
Rate: 190 states/s
+ ProbThrowSix
Probability: 0.166666626930237
Time: 0.0 s
+ Value iteration
Final error: 7.15255907834985E-07
Iterations: 11
Time: 0.0 s
+ StepsUntilReach
Value: 3.66666650772095
Time for min. prob. 0 states: 0.0 s
Time for min. prob. 1 states: 0.0 s
Time: 0.0 s
+ Value iteration
Final error: 4.08717619857464E-07
Iterations: 12
Time: 0.0 s

87
examples/pctmc/polling6.sm

@ -0,0 +1,87 @@
// polling example [IT90]
// gxn/dxp 26/01/00
ctmc
const int N=6;
const double mu;
const double gamma;
//const double mu= 1;
//const double gamma= 200;
//const double lambda= mu/N;
module server
s : [1..6]; // station
a : [0..1]; // action: 0=polling, 1=serving
[loop1a] (s=1)&(a=0) -> gamma : (s'=s+1);
[loop1b] (s=1)&(a=0) -> gamma : (a'=1);
[serve1] (s=1)&(a=1) -> mu : (s'=s+1)&(a'=0);
[loop2a] (s=2)&(a=0) -> gamma : (s'=s+1);
[loop2b] (s=2)&(a=0) -> gamma : (a'=1);
[serve2] (s=2)&(a=1) -> mu : (s'=s+1)&(a'=0);
[loop3a] (s=3)&(a=0) -> gamma : (s'=s+1);
[loop3b] (s=3)&(a=0) -> gamma : (a'=1);
[serve3] (s=3)&(a=1) -> mu : (s'=s+1)&(a'=0);
[loop4a] (s=4)&(a=0) -> gamma : (s'=s+1);
[loop4b] (s=4)&(a=0) -> gamma : (a'=1);
[serve4] (s=4)&(a=1) -> mu : (s'=s+1)&(a'=0);
[loop5a] (s=5)&(a=0) -> gamma : (s'=s+1);
[loop5b] (s=5)&(a=0) -> gamma : (a'=1);
[serve5] (s=5)&(a=1) -> mu : (s'=s+1)&(a'=0);
[loop6a] (s=6)&(a=0) -> gamma : (s'=1);
[loop6b] (s=6)&(a=0) -> gamma : (a'=1);
[serve6] (s=6)&(a=1) -> mu : (s'=1)&(a'=0);
endmodule
module station1
s1 : [0..1];
[loop1a] (s1=0) -> 1 : (s1'=0);
[] (s1=0) -> mu/N : (s1'=1);
[loop1b] (s1=1) -> 1 : (s1'=1);
[serve1] (s1=1) -> 1 : (s1'=0);
endmodule
// construct further stations through renaming
module station2 = station1 [s1=s2, loop1a=loop2a, loop1b=loop2b, serve1=serve2] endmodule
module station3 = station1 [s1=s3, loop1a=loop3a, loop1b=loop3b, serve1=serve3] endmodule
module station4 = station1 [s1=s4, loop1a=loop4a, loop1b=loop4b, serve1=serve4] endmodule
module station5 = station1 [s1=s5, loop1a=loop5a, loop1b=loop5b, serve1=serve5] endmodule
module station6 = station1 [s1=s6, loop1a=loop6a, loop1b=loop6b, serve1=serve6] endmodule
// cumulative rewards
rewards "waiting" // expected time the station 1 is waiting to be served
s1=1 & !(s=1 & a=1) : 1;
endrewards
rewards "served" // expected number of times station1 is served
[serve1] true : 1;
endrewards
label "server1serving" = s=1 & a=1;
label "server5polling" = s=5 & a=0;
label "server5serving" = s=5 & a=1;
init
s = 1 &
a = 0 &
s1 = 0 &
s2 = 0 &
s3 = 0 &
s4 = 0 &
s5 = 0 &
s6 = 0
endinit

3
examples/pdtmc/brp/brp.pm

@ -133,3 +133,6 @@ module channelL
[TO_Ack] (l=2) -> (l'=0);
endmodule
label "fatal" = s=5 & T;
label "false_neg" = srep=1 & rrep=3 & recv;

2
examples/pdtmc/brp/brp16_2.pm

@ -133,3 +133,5 @@ module channelL
[TO_Ack] (l=2) -> (l'=0);
endmodule
label "error" = s=5;

2
examples/pdtmc/brp_rewards2/brp_rewards16_2.pm

@ -144,3 +144,5 @@ rewards
endrewards
label "target" = s=5;

3
examples/pdtmc/brp_rewards2/brp_rewards2.pm

@ -143,4 +143,5 @@ rewards
[TO_Ack] true : TOAck;
endrewards
label "fatal" = s=5 & T;
label "false_neg" = srep=1 & rrep=3 & recv;

2
examples/pdtmc/brp_rewards4/brp_rewards16_2.pm

@ -144,3 +144,5 @@ rewards
endrewards
label "target" = s=5;

3
examples/pdtmc/brp_rewards4/brp_rewards4.pm

@ -144,3 +144,6 @@ rewards
endrewards
label "fatal" = s=5 & T;
label "false_neg" = srep=1 & rrep=3 & recv;

35
examples/pdtmc/die.pm

@ -0,0 +1,35 @@
// Knuth's model of a fair die using only fair coins
dtmc
const double p;
const double q;
module die
// local state
s : [0..7] init 0;
// value of the dice
d : [0..6] init 0;
[] s=0 -> p : (s'=1) + 1-p : (s'=2);
[] s=1 -> q : (s'=3) + 1-q : (s'=4);
[] s=2 -> q : (s'=5) + 1-q : (s'=6);
[] s=3 -> p : (s'=1) + 1-p : (s'=7) & (d'=1);
[] s=4 -> p : (s'=7) & (d'=3) + 1-p : (s'=7) & (d'=2);
[] s=5 -> p : (s'=2) + 1-p : (s'=7) & (d'=4);
[] s=6 -> p : (s'=7) & (d'=6) + 1-p : (s'=7) & (d'=5);
[] s=7 -> 1: (s'=7);
endmodule
rewards "coin_flips"
[] s<7 : 1;
endrewards
label "one" = s=7&d=1;
label "two" = s=7&d=2;
label "three" = s=7&d=3;
label "four" = s=7&d=4;
label "five" = s=7&d=5;
label "six" = s=7&d=6;
label "end" = s=7;

44
examples/pdtmc/twodie.pm

@ -0,0 +1,44 @@
// Knuth's model of a fair die using only fair coins
dtmc
const double p;
const double q;
module die1
// local state
s1 : [0..7] init 0;
// value of the dice
d1 : [0..6] init 0;
[] s1=0 -> p : (s1'=1) + 1-p : (s1'=2);
[] s1=1 -> q : (s1'=3) + 1-q : (s1'=4);
[] s1=2 -> q : (s1'=5) + 1-q : (s1'=6);
[] s1=3 -> p : (s1'=1) + 1-p : (s1'=7) & (d1'=1);
[] s1=4 -> p : (s1'=7) & (d1'=3) + 1-p : (s1'=7) & (d1'=2);
[] s1=5 -> p : (s1'=2) + 1-p : (s1'=7) & (d1'=4);
[] s1=6 -> p : (s1'=7) & (d1'=6) + 1-p : (s1'=7) & (d1'=5);
[] s1=7 -> 1: (s1'=7);
endmodule
module die2 = die1 [ s1=s2, s2=s1, d1=d2 ] endmodule
rewards "coin_flips"
[] s1<7 | s2<7 : 1;
endrewards
label "two" = s1=7 & s2=7 & d1+d2=2;
label "three" = s1=7 & s2=7 & d1+d2=3;
label "four" = s1=7 & s2=7 & d1+d2=4;
label "five" = s1=7 & s2=7 & d1+d2=5;
label "six" = s1=7 & s2=7 & d1+d2=6;
label "seven" = s1=7 & s2=7 & d1+d2=7;
label "eight" = s1=7 & s2=7 & d1+d2=8;
label "nine" = s1=7 & s2=7 & d1+d2=9;
label "ten" = s1=7 & s2=7 & d1+d2=10;
label "eleven" = s1=7 & s2=7 & d1+d2=11;
label "twelve" = s1=7 & s2=7 & d1+d2=12;
label "same" = s1=7 & s2=7 & d1=d2;
label "end" = s1=7 & s2=7;

58
examples/pgcl/coupon/coupon10-classic.pgcl

@ -0,0 +1,58 @@
function coupon10() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int coup5 := 0;
int coup6 := 0;
int coup7 := 0;
int coup8 := 0;
int coup9 := 0;
int coup10 := 0;
int draw := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1) | !(coup7 = 1) | !(coup8 = 1) | !(coup9 = 1) | !(coup10 = 1)) {
draw := unif(0,10);
draw2 := unif(0,10);
draw3 := unif(0,10);
numberDraws := numberDraws + 1;
if(draw = 0) {
coup0 := 1;
}
if(draw = 1) {
coup1 := 1;
}
if(draw = 2) {
coup2 := 1;
}
if(draw = 3) {
coup3 := 1;
}
if(draw = 4) {
coup4 := 1;
}
if(draw = 5) {
coup5 := 1;
}
if(draw = 6) {
coup6 := 1;
}
if(draw = 7) {
coup7 := 1;
}
if(draw = 8) {
coup8 := 1;
}
if(draw = 9) {
coup9 := 1;
}
if(draw = 10) {
coup10 := 1;
}
}
}

60
examples/pgcl/coupon/coupon10-cost.pgcl

@ -0,0 +1,60 @@
function coupon10() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int coup5 := 0;
int coup6 := 0;
int coup7 := 0;
int coup8 := 0;
int coup9 := 0;
int coup10 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int cost := 1;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1) | !(coup7 = 1) | !(coup8 = 1) | !(coup9 = 1) | !(coup10 = 1)) {
draw1 := unif(0,10);
draw2 := unif(0,10);
draw3 := unif(0,10);
cost := ceil(1.02 * cost);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
if (draw1 = 5 | draw2 = 5 | draw3 = 5) {
coup5 := 1;
}
if (draw1 = 6 | draw2 = 6 | draw3 = 6) {
coup6 := 1;
}
if (draw1 = 7 | draw2 = 7 | draw3 = 7) {
coup7 := 1;
}
if (draw1 = 8 | draw2 = 8 | draw3 = 8) {
coup8 := 1;
}
if (draw1 = 9 | draw2 = 9 | draw3 = 9) {
coup9 := 1;
}
if (draw1 = 10 | draw2 = 10 | draw3 = 10) {
coup10 := 1;
}
}
}

62
examples/pgcl/coupon/coupon10-observe.pgcl

@ -0,0 +1,62 @@
function coupon10() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int coup5 := 0;
int coup6 := 0;
int coup7 := 0;
int coup8 := 0;
int coup9 := 0;
int coup10 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1) | !(coup7 = 1) | !(coup8 = 1) | !(coup9 = 1) | !(coup10 = 1)) {
draw1 := unif(0,10);
draw2 := unif(0,10);
draw3 := unif(0,10);
numberDraws := numberDraws + 1;
observe (draw1 != draw2 & draw1 != draw3 & draw2 != draw3);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
if (draw1 = 5 | draw2 = 5 | draw3 = 5) {
coup5 := 1;
}
if (draw1 = 6 | draw2 = 6 | draw3 = 6) {
coup6 := 1;
}
if (draw1 = 7 | draw2 = 7 | draw3 = 7) {
coup7 := 1;
}
if (draw1 = 8 | draw2 = 8 | draw3 = 8) {
coup8 := 1;
}
if (draw1 = 9 | draw2 = 9 | draw3 = 9) {
coup9 := 1;
}
if (draw1 = 10 | draw2 = 10 | draw3 = 10) {
coup10 := 1;
}
}
}

60
examples/pgcl/coupon/coupon10.pgcl

@ -0,0 +1,60 @@
function coupon10() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int coup5 := 0;
int coup6 := 0;
int coup7 := 0;
int coup8 := 0;
int coup9 := 0;
int coup10 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1) | !(coup7 = 1) | !(coup8 = 1) | !(coup9 = 1) | !(coup10 = 1)) {
draw1 := unif(0,10);
draw2 := unif(0,10);
draw3 := unif(0,10);
numberDraws := numberDraws + 1;
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
if (draw1 = 5 | draw2 = 5 | draw3 = 5) {
coup5 := 1;
}
if (draw1 = 6 | draw2 = 6 | draw3 = 6) {
coup6 := 1;
}
if (draw1 = 7 | draw2 = 7 | draw3 = 7) {
coup7 := 1;
}
if (draw1 = 8 | draw2 = 8 | draw3 = 8) {
coup8 := 1;
}
if (draw1 = 9 | draw2 = 9 | draw3 = 9) {
coup9 := 1;
}
if (draw1 = 10 | draw2 = 10 | draw3 = 10) {
coup10 := 1;
}
}
}

24
examples/pgcl/coupon/coupon3-classic.pgcl

@ -0,0 +1,24 @@
function coupon3() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int draw := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1)) {
draw := unif(0,2);
numberDraws := numberDraws + 1;
if(draw = 0) {
coup0 := 1;
}
if(draw = 1) {
coup1 := 1;
}
if(draw = 2) {
coup2 := 1;
}
}
}

28
examples/pgcl/coupon/coupon3-cost.pgcl

@ -0,0 +1,28 @@
function coupon3() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int cost := 1;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1)) {
draw1 := unif(0,2);
draw2 := unif(0,2);
draw3 := unif(0,2);
cost := ceil(1.02 * cost);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
}
}

30
examples/pgcl/coupon/coupon3-observe.pgcl

@ -0,0 +1,30 @@
function coupon3() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1)) {
draw1 := unif(0,2);
draw2 := unif(0,2);
draw3 := unif(0,2);
numberDraws := numberDraws + 1;
observe (draw1 != draw2 & draw1 != draw3 & draw2 != draw3);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
}
}

28
examples/pgcl/coupon/coupon3.pgcl

@ -0,0 +1,28 @@
function coupon3() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1)) {
draw1 := unif(0,2);
draw2 := unif(0,2);
draw3 := unif(0,2);
numberDraws := numberDraws + 1;
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
}
}

34
examples/pgcl/coupon/coupon4-observe.pgcl

@ -0,0 +1,34 @@
function coupon4() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1)) {
draw1 := unif(0,4);
draw2 := unif(0,4);
draw3 := unif(0,4);
numberDraws := numberDraws + 1;
observe (draw1 != draw2 & draw1 != draw3 & draw2 != draw3);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
}
}

32
examples/pgcl/coupon/coupon5-classic.pgcl

@ -0,0 +1,32 @@
function coupon5() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int draw := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1)) {
draw := unif(0,4);
numberDraws := numberDraws + 1;
if(draw = 0) {
coup0 := 1;
}
if(draw = 1) {
coup1 := 1;
}
if(draw = 2) {
coup2 := 1;
}
if(draw = 3) {
coup3 := 1;
}
if(draw = 4) {
coup4 := 1;
}
}
}

36
examples/pgcl/coupon/coupon5-cost.pgcl

@ -0,0 +1,36 @@
function coupon5() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int cost := 1;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1)) {
draw1 := unif(0,4);
draw2 := unif(0,4);
draw3 := unif(0,4);
cost := ceil(1.02 * cost);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
}
}

38
examples/pgcl/coupon/coupon5-observe.pgcl

@ -0,0 +1,38 @@
function coupon5() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1)) {
draw1 := unif(0,4);
draw2 := unif(0,4);
draw3 := unif(0,4);
numberDraws := numberDraws + 1;
observe (draw1 != draw2 & draw1 != draw3 & draw2 != draw3);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
}
}

36
examples/pgcl/coupon/coupon5.pgcl

@ -0,0 +1,36 @@
function coupon5() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1)) {
draw1 := unif(0,4);
draw2 := unif(0,4);
draw3 := unif(0,4);
numberDraws := numberDraws + 1;
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
}
}

40
examples/pgcl/coupon/coupon7-classic.pgcl

@ -0,0 +1,40 @@
function coupon7() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int coup5 := 0;
int coup6 := 0;
int draw := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1)) {
draw := unif(0,6);
numberDraws := numberDraws + 1;
if(draw = 0) {
coup0 := 1;
}
if(draw = 1) {
coup1 := 1;
}
if(draw = 2) {
coup2 := 1;
}
if(draw = 3) {
coup3 := 1;
}
if(draw = 4) {
coup4 := 1;
}
if(draw = 5) {
coup5 := 1;
}
if(draw = 6) {
coup6 := 1;
}
}
}

44
examples/pgcl/coupon/coupon7-cost.pgcl

@ -0,0 +1,44 @@
function coupon7() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int coup5 := 0;
int coup6 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int cost := 1;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1)) {
draw1 := unif(0,6);
draw2 := unif(0,6);
draw3 := unif(0,6);
cost := ceil(1.02 * cost);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
if (draw1 = 5 | draw2 = 5 | draw3 = 5) {
coup5 := 1;
}
if (draw1 = 6 | draw2 = 6 | draw3 = 6) {
coup6 := 1;
}
}
}

46
examples/pgcl/coupon/coupon7-observe.pgcl

@ -0,0 +1,46 @@
function coupon7() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int coup5 := 0;
int coup6 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1)) {
draw1 := unif(0,6);
draw2 := unif(0,6);
draw3 := unif(0,6);
numberDraws := numberDraws + 1;
observe (draw1 != draw2 & draw1 != draw3 & draw2 != draw3);
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
if (draw1 = 5 | draw2 = 5 | draw3 = 5) {
coup5 := 1;
}
if (draw1 = 6 | draw2 = 6 | draw3 = 6) {
coup6 := 1;
}
}
}

44
examples/pgcl/coupon/coupon7.pgcl

@ -0,0 +1,44 @@
function coupon7() {
int coup0 := 0;
int coup1 := 0;
int coup2 := 0;
int coup3 := 0;
int coup4 := 0;
int coup5 := 0;
int coup6 := 0;
int draw1 := 0;
int draw2 := 0;
int draw3 := 0;
int numberDraws := 0;
while (!(coup0 = 1) | !(coup1 = 1) | !(coup2 = 1) | !(coup3 = 1) | !(coup4 = 1) | !(coup5= 1) | !(coup6 = 1)) {
draw1 := unif(0,6);
draw2 := unif(0,6);
draw3 := unif(0,6);
numberDraws := numberDraws + 1;
if(draw1 = 0 | draw2 = 0 | draw3 = 0) {
coup0 := 1;
}
if(draw1 = 1 | draw2 = 1 | draw3 = 1) {
coup1 := 1;
}
if(draw1 = 2 | draw2 = 2 | draw3 = 2) {
coup2 := 1;
}
if (draw1 = 3 | draw2 = 3 | draw3 = 3) {
coup3 := 1;
}
if (draw1 = 4 | draw2 = 4 | draw3 = 4) {
coup4 := 1;
}
if (draw1 = 5 | draw2 = 5 | draw3 = 5) {
coup5 := 1;
}
if (draw1 = 6 | draw2 = 6 | draw3 = 6) {
coup6 := 1;
}
}
}

35
examples/pgcl/crowds/crowds100-100-observeOther.pgcl

@ -0,0 +1,35 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 100;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
{ lastSender:=0; } [1/100] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
observe(observeOther > 25);
}

34
examples/pgcl/crowds/crowds100-100.pgcl

@ -0,0 +1,34 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 100;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
{ lastSender:=0; } [1/100] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

35
examples/pgcl/crowds/crowds100-60-observeOther.pgcl

@ -0,0 +1,35 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 60;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
{ lastSender:=0; } [1/100] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
observe(observeOther > 15);
}

34
examples/pgcl/crowds/crowds100-60-param.pgcl

@ -0,0 +1,34 @@
function crowds(double PF, double bad) {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 60;
int observeSender := 0; // in [0, TotalRuns]
int observeOther := 0; // in [0, TotalRuns]
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [bad] {
{
{ lastSender:=0; } [1/100] { lastSender := 1; }
}
[PF]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

34
examples/pgcl/crowds/crowds100-60.pgcl

@ -0,0 +1,34 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 60;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
{ lastSender:=0; } [1/100] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

36
examples/pgcl/crowds/crowds100-80-observeOther.pgcl

@ -0,0 +1,36 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 80;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
// lastSender := unif(0, 24);
{ lastSender:=0; } [1/100] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
observe(observeOther > 20);
}

34
examples/pgcl/crowds/crowds100-80.pgcl

@ -0,0 +1,34 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 80;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
{ lastSender:=0; } [1/100] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

34
examples/pgcl/crowds/crowds3-3-param.pgcl

@ -0,0 +1,34 @@
function crowds(double PF, double bad) {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 3;
int observeSender := 0; // in [0, TotalRuns]
int observeOther := 0; // in [0, TotalRuns]
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [bad] {
{
{ lastSender:=0; } [1/3] { lastSender := 1; }
}
[PF]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

34
examples/pgcl/crowds/crowds3-3.pgcl

@ -0,0 +1,34 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 3;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
{ lastSender:=0; } [1/3] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

33
examples/pgcl/crowds/crowds3-5-param.pgcl

@ -0,0 +1,33 @@
function crowds(double PF, double bad) {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 5;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [bad] {
{ lastSender:=0; } [1/3] { lastSender := 1; }
}
[PF]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

34
examples/pgcl/crowds/crowds3-5.pgcl

@ -0,0 +1,34 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 5;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
{ lastSender:=0; } [1/3] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

34
examples/pgcl/crowds/crowds5-20-param.pgcl

@ -0,0 +1,34 @@
function crowds(double PF, double bad) {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 20;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [bad] {
{
{ lastSender:=0; } [1/5] { lastSender := 1; }
}
[PF]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
// Set up new run.
delivered := 0;
remainingRuns := remainingRuns - 1;
}
}

34
examples/pgcl/crowds/crowds5-20.pgcl

@ -0,0 +1,34 @@
function crowds() {
int delivered := 0;
int lastSender := 0;
int remainingRuns := 20;
int observeSender := 0;
int observeOther := 0;
while(remainingRuns > 0) {
while(delivered = 0) {
{
if(lastSender = 0) {
observeSender := observeSender + 1;
} else {
observeOther := observeOther + 1;
}
lastSender := 0;
delivered := 1;
} [0.091] {
{
{ lastSender:=0; } [1/5] { lastSender := 1; }
}
[0.8]
{
lastSender := 0;
// When not forwarding, the message is delivered here.
delivered := 1;
}
}
}
delivered := 0;
// Set up new run.
remainingRuns := remainingRuns - 1;
}
}

108
examples/pgcl/herman/herman10-det.pgcl

@ -0,0 +1,108 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int x8 := 0;
int x9 := 0;
int x10 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
int oldx8 := 0;
int oldx9 := 0;
int oldx10 := 0;
// determine starting token setup on the ring.
{x1 := 0;} [0.5] {x1 := 1;}
{x2 := 0;} [0.5] {x2 := 1;}
{x3 := 0;} [0.5] {x3 := 1;}
{x4 := 0;} [0.5] {x4 := 1;}
{x5 := 0;} [0.5] {x5 := 1;}
{x6 := 0;} [0.5] {x6 := 1;}
{x7 := 0;} [0.5] {x7 := 1;}
{x8 := 0;} [0.5] {x8 := 1;}
{x9 := 0;} [0.5] {x9 := 1;}
{x10 := 0;} [0.5] {x10 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
oldx8 := x8;
oldx9 := x9;
oldx10 := x10;
if(x1 = oldx10) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx10;
}
oldx10 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
if(x8 = oldx7) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x8 := oldx7;
}
oldx7 := 0;
if(x9 = oldx8) {
{x9 := 0;} [0.5] {x9 := 1;}
} else {
x9 := oldx8;
}
oldx8 := 0;
if(x10 = oldx9) {
{x10 := 0;} [0.5] {x10 := 1;}
} else {
x10 := oldx9;
}
oldx9 := 0;
}
}

108
examples/pgcl/herman/herman10.pgcl

@ -0,0 +1,108 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int x8 := 0;
int x9 := 0;
int x10 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
int oldx8 := 0;
int oldx9 := 0;
int oldx10 := 0;
// determine starting token setup on the ring.
{x1 := 0;} [] {x1 := 1;}
{x2 := 0;} [] {x2 := 1;}
{x3 := 0;} [] {x3 := 1;}
{x4 := 0;} [] {x4 := 1;}
{x5 := 0;} [] {x5 := 1;}
{x6 := 0;} [] {x6 := 1;}
{x7 := 0;} [] {x7 := 1;}
{x8 := 0;} [] {x8 := 1;}
{x9 := 0;} [] {x9 := 1;}
{x10 := 0;} [] {x10 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
oldx8 := x8;
oldx9 := x9;
oldx10 := x10;
if(x1 = oldx10) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx10;
}
oldx10 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
if(x8 = oldx7) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x8 := oldx7;
}
oldx7 := 0;
if(x9 = oldx8) {
{x9 := 0;} [0.5] {x9 := 1;}
} else {
x9 := oldx8;
}
oldx8 := 0;
if(x10 = oldx9) {
{x10 := 0;} [0.5] {x10 := 1;}
} else {
x10 := oldx9;
}
oldx9 := 0;
}
}

138
examples/pgcl/herman/herman13-det.pgcl

@ -0,0 +1,138 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int x8 := 0;
int x9 := 0;
int x10 := 0;
int x11 := 0;
int x12 := 0;
int x13 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
int oldx8 := 0;
int oldx9 := 0;
int oldx10 := 0;
int oldx11 := 0;
int oldx12 := 0;
int oldx13 := 0;
// determine starting token setup on the ring.
{x1 := 0;} [0.5] {x1 := 1;}
{x2 := 0;} [0.5] {x2 := 1;}
{x3 := 0;} [0.5] {x3 := 1;}
{x4 := 0;} [0.5] {x4 := 1;}
{x5 := 0;} [0.5] {x5 := 1;}
{x6 := 0;} [0.5] {x6 := 1;}
{x7 := 0;} [0.5] {x7 := 1;}
{x8 := 0;} [0.5] {x8 := 1;}
{x9 := 0;} [0.5] {x9 := 1;}
{x10 := 0;} [0.5] {x10 := 1;}
{x11 := 0;} [0.5] {x11 := 1;}
{x12 := 0;} [0.5] {x12 := 1;}
{x13 := 0;} [0.5] {x13 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
oldx8 := x8;
oldx9 := x9;
oldx10 := x10;
oldx11 := x11;
oldx12 := x12;
oldx13 := x13;
if(x1 = oldx13) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx13;
}
oldx13 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
if(x8 = oldx7) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x8 := oldx7;
}
oldx7 := 0;
if(x9 = oldx8) {
{x9 := 0;} [0.5] {x9 := 1;}
} else {
x9 := oldx8;
}
oldx8 := 0;
if(x10 = oldx9) {
{x10 := 0;} [0.5] {x10 := 1;}
} else {
x10 := oldx9;
}
oldx9 := 0;
if(x11 = oldx10) {
{x11 := 0;} [0.5] {x11 := 1;}
} else {
x11 := oldx10;
}
oldx10 := 0;
if(x12 = oldx11) {
{x12 := 0;} [0.5] {x12 := 1;}
} else {
x12 := oldx11;
}
oldx11 := 0;
if(x13 = oldx12) {
{x13 := 0;} [0.5] {x13 := 1;}
} else {
x13 := oldx12;
}
oldx12 := 0;
}
}

138
examples/pgcl/herman/herman13.pgcl

@ -0,0 +1,138 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int x8 := 0;
int x9 := 0;
int x10 := 0;
int x11 := 0;
int x12 := 0;
int x13 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
int oldx8 := 0;
int oldx9 := 0;
int oldx10 := 0;
int oldx11 := 0;
int oldx12 := 0;
int oldx13 := 0;
// determine starting token setup on the ring.
{x1 := 0;} [] {x1 := 1;}
{x2 := 0;} [] {x2 := 1;}
{x3 := 0;} [] {x3 := 1;}
{x4 := 0;} [] {x4 := 1;}
{x5 := 0;} [] {x5 := 1;}
{x6 := 0;} [] {x6 := 1;}
{x7 := 0;} [] {x7 := 1;}
{x8 := 0;} [] {x8 := 1;}
{x9 := 0;} [] {x9 := 1;}
{x10 := 0;} [] {x10 := 1;}
{x11 := 0;} [] {x11 := 1;}
{x12 := 0;} [] {x12 := 1;}
{x13 := 0;} [] {x13 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
oldx8 := x8;
oldx9 := x9;
oldx10 := x10;
oldx11 := x11;
oldx12 := x12;
oldx13 := x13;
if(x1 = oldx13) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx13;
}
oldx13 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
if(x8 = oldx7) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x8 := oldx7;
}
oldx7 := 0;
if(x9 = oldx8) {
{x9 := 0;} [0.5] {x9 := 1;}
} else {
x9 := oldx8;
}
oldx8 := 0;
if(x10 = oldx9) {
{x10 := 0;} [0.5] {x10 := 1;}
} else {
x10 := oldx9;
}
oldx9 := 0;
if(x11 = oldx10) {
{x11 := 0;} [0.5] {x11 := 1;}
} else {
x11 := oldx10;
}
oldx10 := 0;
if(x12 = oldx11) {
{x12 := 0;} [0.5] {x12 := 1;}
} else {
x12 := oldx11;
}
oldx11 := 0;
if(x13 = oldx12) {
{x13 := 0;} [0.5] {x13 := 1;}
} else {
x13 := oldx12;
}
oldx12 := 0;
}
}

178
examples/pgcl/herman/herman17-det.pgcl

@ -0,0 +1,178 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int x8 := 0;
int x9 := 0;
int x10 := 0;
int x11 := 0;
int x12 := 0;
int x13 := 0;
int x14 := 0;
int x15 := 0;
int x16 := 0;
int x17 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
int oldx8 := 0;
int oldx9 := 0;
int oldx10 := 0;
int oldx11 := 0;
int oldx12 := 0;
int oldx13 := 0;
int oldx14 := 0;
int oldx15 := 0;
int oldx16 := 0;
int oldx17 := 0;
// determine starting token setup on the ring.
{x1 := 0;} [0.5] {x1 := 1;}
{x2 := 0;} [0.5] {x2 := 1;}
{x3 := 0;} [0.5] {x3 := 1;}
{x4 := 0;} [0.5] {x4 := 1;}
{x5 := 0;} [0.5] {x5 := 1;}
{x6 := 0;} [0.5] {x6 := 1;}
{x7 := 0;} [0.5] {x7 := 1;}
{x8 := 0;} [0.5] {x8 := 1;}
{x9 := 0;} [0.5] {x9 := 1;}
{x10 := 0;} [0.5] {x10 := 1;}
{x11 := 0;} [0.5] {x11 := 1;}
{x12 := 0;} [0.5] {x12 := 1;}
{x13 := 0;} [0.5] {x13 := 1;}
{x14 := 0;} [0.5] {x14 := 1;}
{x15 := 0;} [0.5] {x15 := 1;}
{x16 := 0;} [0.5] {x16 := 1;}
{x17 := 0;} [0.5] {x17 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
oldx8 := x8;
oldx9 := x9;
oldx10 := x10;
oldx11 := x11;
oldx12 := x12;
oldx13 := x13;
oldx14 := x14;
oldx15 := x15;
oldx16 := x16;
oldx17 := x17;
if(x1 = oldx17) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx17;
}
oldx17 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
if(x8 = oldx7) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x8 := oldx7;
}
oldx7 := 0;
if(x9 = oldx8) {
{x9 := 0;} [0.5] {x9 := 1;}
} else {
x9 := oldx8;
}
oldx8 := 0;
if(x10 = oldx9) {
{x10 := 0;} [0.5] {x10 := 1;}
} else {
x10 := oldx9;
}
oldx9 := 0;
if(x11 = oldx10) {
{x11 := 0;} [0.5] {x11 := 1;}
} else {
x11 := oldx10;
}
oldx10 := 0;
if(x12 = oldx11) {
{x12 := 0;} [0.5] {x12 := 1;}
} else {
x12 := oldx11;
}
oldx11 := 0;
if(x13 = oldx12) {
{x13 := 0;} [0.5] {x13 := 1;}
} else {
x13 := oldx12;
}
oldx12 := 0;
if(x14 = oldx13) {
{x14 := 0;} [0.5] {x14 := 1;}
} else {
x14 := oldx13;
}
oldx13 := 0;
if(x15 = oldx14) {
{x15 := 0;} [0.5] {x15 := 1;}
} else {
x15 := oldx14;
}
oldx14 := 0;
if(x16 = oldx15) {
{x16 := 0;} [0.5] {x16 := 1;}
} else {
x16 := oldx15;
}
oldx15 := 0;
if(x17 = oldx16) {
{x17 := 0;} [0.5] {x17 := 1;}
} else {
x17 := oldx16;
}
oldx16 := 0;
}
}

178
examples/pgcl/herman/herman17.pgcl

@ -0,0 +1,178 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int x8 := 0;
int x9 := 0;
int x10 := 0;
int x11 := 0;
int x12 := 0;
int x13 := 0;
int x14 := 0;
int x15 := 0;
int x16 := 0;
int x17 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
int oldx8 := 0;
int oldx9 := 0;
int oldx10 := 0;
int oldx11 := 0;
int oldx12 := 0;
int oldx13 := 0;
int oldx14 := 0;
int oldx15 := 0;
int oldx16 := 0;
int oldx17 := 0;
// determine starting token setup on the ring.
{x1 := 0;} [] {x1 := 1;}
{x2 := 0;} [] {x2 := 1;}
{x3 := 0;} [] {x3 := 1;}
{x4 := 0;} [] {x4 := 1;}
{x5 := 0;} [] {x5 := 1;}
{x6 := 0;} [] {x6 := 1;}
{x7 := 0;} [] {x7 := 1;}
{x8 := 0;} [] {x8 := 1;}
{x9 := 0;} [] {x9 := 1;}
{x10 := 0;} [] {x10 := 1;}
{x11 := 0;} [] {x11 := 1;}
{x12 := 0;} [] {x12 := 1;}
{x13 := 0;} [] {x13 := 1;}
{x14 := 0;} [] {x14 := 1;}
{x15 := 0;} [] {x15 := 1;}
{x16 := 0;} [] {x16 := 1;}
{x17 := 0;} [] {x17 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
oldx8 := x8;
oldx9 := x9;
oldx10 := x10;
oldx11 := x11;
oldx12 := x12;
oldx13 := x13;
oldx14 := x14;
oldx15 := x15;
oldx16 := x16;
oldx17 := x17;
if(x1 = oldx17) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx17;
}
oldx17 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
if(x8 = oldx7) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x8 := oldx7;
}
oldx7 := 0;
if(x9 = oldx8) {
{x9 := 0;} [0.5] {x9 := 1;}
} else {
x9 := oldx8;
}
oldx8 := 0;
if(x10 = oldx9) {
{x10 := 0;} [0.5] {x10 := 1;}
} else {
x10 := oldx9;
}
oldx9 := 0;
if(x11 = oldx10) {
{x11 := 0;} [0.5] {x11 := 1;}
} else {
x11 := oldx10;
}
oldx10 := 0;
if(x12 = oldx11) {
{x12 := 0;} [0.5] {x12 := 1;}
} else {
x12 := oldx11;
}
oldx11 := 0;
if(x13 = oldx12) {
{x13 := 0;} [0.5] {x13 := 1;}
} else {
x13 := oldx12;
}
oldx12 := 0;
if(x14 = oldx13) {
{x14 := 0;} [0.5] {x14 := 1;}
} else {
x14 := oldx13;
}
oldx13 := 0;
if(x15 = oldx14) {
{x15 := 0;} [0.5] {x15 := 1;}
} else {
x15 := oldx14;
}
oldx14 := 0;
if(x16 = oldx15) {
{x16 := 0;} [0.5] {x16 := 1;}
} else {
x16 := oldx15;
}
oldx15 := 0;
if(x17 = oldx16) {
{x17 := 0;} [0.5] {x17 := 1;}
} else {
x17 := oldx16;
}
oldx16 := 0;
}
}

218
examples/pgcl/herman/herman21-det.pgcl

@ -0,0 +1,218 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int x8 := 0;
int x9 := 0;
int x10 := 0;
int x11 := 0;
int x12 := 0;
int x13 := 0;
int x14 := 0;
int x15 := 0;
int x16 := 0;
int x17 := 0;
int x18 := 0;
int x19 := 0;
int x20 := 0;
int x21 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
int oldx8 := 0;
int oldx9 := 0;
int oldx10 := 0;
int oldx11 := 0;
int oldx12 := 0;
int oldx13 := 0;
int oldx14 := 0;
int oldx15 := 0;
int oldx16 := 0;
int oldx17 := 0;
int oldx18 := 0;
int oldx19 := 0;
int oldx20 := 0;
int oldx21 := 0;
// determine starting token setup on the ring.
{x1 := 0;} [0.5] {x1 := 1;}
{x2 := 0;} [0.5] {x2 := 1;}
{x3 := 0;} [0.5] {x3 := 1;}
{x4 := 0;} [0.5] {x4 := 1;}
{x5 := 0;} [0.5] {x5 := 1;}
{x6 := 0;} [0.5] {x6 := 1;}
{x7 := 0;} [0.5] {x7 := 1;}
{x8 := 0;} [0.5] {x8 := 1;}
{x9 := 0;} [0.5] {x9 := 1;}
{x10 := 0;} [0.5] {x10 := 1;}
{x11 := 0;} [0.5] {x11 := 1;}
{x12 := 0;} [0.5] {x12 := 1;}
{x13 := 0;} [0.5] {x13 := 1;}
{x14 := 0;} [0.5] {x14 := 1;}
{x15 := 0;} [0.5] {x15 := 1;}
{x16 := 0;} [0.5] {x16 := 1;}
{x17 := 0;} [0.5] {x17 := 1;}
{x18 := 0;} [0.5] {x18 := 1;}
{x19 := 0;} [0.5] {x19 := 1;}
{x20 := 0;} [0.5] {x20 := 1;}
{x21 := 0;} [0.5] {x21 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
oldx8 := x8;
oldx9 := x9;
oldx10 := x10;
oldx11 := x11;
oldx12 := x12;
oldx13 := x13;
oldx14 := x14;
oldx15 := x15;
oldx16 := x16;
oldx17 := x17;
oldx18 := x18;
oldx19 := x19;
oldx20 := x20;
oldx21 := x21;
if(x1 = oldx21) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx21;
}
oldx21 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
if(x8 = oldx7) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x8 := oldx7;
}
oldx7 := 0;
if(x9 = oldx8) {
{x9 := 0;} [0.5] {x9 := 1;}
} else {
x9 := oldx8;
}
oldx8 := 0;
if(x10 = oldx9) {
{x10 := 0;} [0.5] {x10 := 1;}
} else {
x10 := oldx9;
}
oldx9 := 0;
if(x11 = oldx10) {
{x11 := 0;} [0.5] {x11 := 1;}
} else {
x11 := oldx10;
}
oldx10 := 0;
if(x12 = oldx11) {
{x12 := 0;} [0.5] {x12 := 1;}
} else {
x12 := oldx11;
}
oldx11 := 0;
if(x13 = oldx12) {
{x13 := 0;} [0.5] {x13 := 1;}
} else {
x13 := oldx12;
}
oldx12 := 0;
if(x14 = oldx13) {
{x14 := 0;} [0.5] {x14 := 1;}
} else {
x14 := oldx13;
}
oldx13 := 0;
if(x15 = oldx14) {
{x15 := 0;} [0.5] {x15 := 1;}
} else {
x15 := oldx14;
}
oldx14 := 0;
if(x16 = oldx15) {
{x16 := 0;} [0.5] {x16 := 1;}
} else {
x16 := oldx15;
}
oldx15 := 0;
if(x17 = oldx16) {
{x17 := 0;} [0.5] {x17 := 1;}
} else {
x17 := oldx16;
}
oldx16 := 0;
if(x18 = oldx17) {
{x18 := 0;} [0.5] {x18 := 1;}
} else {
x18 := oldx17;
}
oldx17 := 0;
if(x19 = oldx18) {
{x19 := 0;} [0.5] {x19 := 1;}
} else {
x19 := oldx18;
}
oldx18 := 0;
if(x20 = oldx19) {
{x20 := 0;} [0.5] {x20 := 1;}
} else {
x20 := oldx19;
}
oldx19 := 0;
if(x21 = oldx20) {
{x21 := 0;} [0.5] {x21 := 1;}
} else {
x21 := oldx20;
}
oldx20 := 0;
}
}

218
examples/pgcl/herman/herman21.pgcl

@ -0,0 +1,218 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int x8 := 0;
int x9 := 0;
int x10 := 0;
int x11 := 0;
int x12 := 0;
int x13 := 0;
int x14 := 0;
int x15 := 0;
int x16 := 0;
int x17 := 0;
int x18 := 0;
int x19 := 0;
int x20 := 0;
int x21 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
int oldx8 := 0;
int oldx9 := 0;
int oldx10 := 0;
int oldx11 := 0;
int oldx12 := 0;
int oldx13 := 0;
int oldx14 := 0;
int oldx15 := 0;
int oldx16 := 0;
int oldx17 := 0;
int oldx18 := 0;
int oldx19 := 0;
int oldx20 := 0;
int oldx21 := 0;
// determine starting token setup on the ring.
{x1 := 0;} [] {x1 := 1;}
{x2 := 0;} [] {x2 := 1;}
{x3 := 0;} [] {x3 := 1;}
{x4 := 0;} [] {x4 := 1;}
{x5 := 0;} [] {x5 := 1;}
{x6 := 0;} [] {x6 := 1;}
{x7 := 0;} [] {x7 := 1;}
{x8 := 0;} [] {x8 := 1;}
{x9 := 0;} [] {x9 := 1;}
{x10 := 0;} [] {x10 := 1;}
{x11 := 0;} [] {x11 := 1;}
{x12 := 0;} [] {x12 := 1;}
{x13 := 0;} [] {x13 := 1;}
{x14 := 0;} [] {x14 := 1;}
{x15 := 0;} [] {x15 := 1;}
{x16 := 0;} [] {x16 := 1;}
{x17 := 0;} [] {x17 := 1;}
{x18 := 0;} [] {x18 := 1;}
{x19 := 0;} [] {x19 := 1;}
{x20 := 0;} [] {x20 := 1;}
{x21 := 0;} [] {x21 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
oldx8 := x8;
oldx9 := x9;
oldx10 := x10;
oldx11 := x11;
oldx12 := x12;
oldx13 := x13;
oldx14 := x14;
oldx15 := x15;
oldx16 := x16;
oldx17 := x17;
oldx18 := x18;
oldx19 := x19;
oldx20 := x20;
oldx21 := x21;
if(x1 = oldx21) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx21;
}
oldx21 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
if(x8 = oldx7) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x8 := oldx7;
}
oldx7 := 0;
if(x9 = oldx8) {
{x9 := 0;} [0.5] {x9 := 1;}
} else {
x9 := oldx8;
}
oldx8 := 0;
if(x10 = oldx9) {
{x10 := 0;} [0.5] {x10 := 1;}
} else {
x10 := oldx9;
}
oldx9 := 0;
if(x11 = oldx10) {
{x11 := 0;} [0.5] {x11 := 1;}
} else {
x11 := oldx10;
}
oldx10 := 0;
if(x12 = oldx11) {
{x12 := 0;} [0.5] {x12 := 1;}
} else {
x12 := oldx11;
}
oldx11 := 0;
if(x13 = oldx12) {
{x13 := 0;} [0.5] {x13 := 1;}
} else {
x13 := oldx12;
}
oldx12 := 0;
if(x14 = oldx13) {
{x14 := 0;} [0.5] {x14 := 1;}
} else {
x14 := oldx13;
}
oldx13 := 0;
if(x15 = oldx14) {
{x15 := 0;} [0.5] {x15 := 1;}
} else {
x15 := oldx14;
}
oldx14 := 0;
if(x16 = oldx15) {
{x16 := 0;} [0.5] {x16 := 1;}
} else {
x16 := oldx15;
}
oldx15 := 0;
if(x17 = oldx16) {
{x17 := 0;} [0.5] {x17 := 1;}
} else {
x17 := oldx16;
}
oldx16 := 0;
if(x18 = oldx17) {
{x18 := 0;} [0.5] {x18 := 1;}
} else {
x18 := oldx17;
}
oldx17 := 0;
if(x19 = oldx18) {
{x19 := 0;} [0.5] {x19 := 1;}
} else {
x19 := oldx18;
}
oldx18 := 0;
if(x20 = oldx19) {
{x20 := 0;} [0.5] {x20 := 1;}
} else {
x20 := oldx19;
}
oldx19 := 0;
if(x21 = oldx19) {
{x21 := 0;} [0.5] {x21 := 1;}
} else {
x21 := oldx20;
}
oldx20 := 0;
}
}

77
examples/pgcl/herman/herman7-det.pgcl

@ -0,0 +1,77 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
{x1 := 0;} [0.5] {x1 := 1;}
{x2 := 0;} [0.5] {x2 := 1;}
{x3 := 0;} [0.5] {x3 := 1;}
{x4 := 0;} [0.5] {x4 := 1;}
{x5 := 0;} [0.5] {x5 := 1;}
{x6 := 0;} [0.5] {x6 := 1;}
{x7 := 0;} [0.5] {x7 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
if(x1 = oldx7) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx7;
}
oldx7 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
}
}

77
examples/pgcl/herman/herman7.pgcl

@ -0,0 +1,77 @@
function herman() {
int x1 := 0;
int x2 := 0;
int x3 := 0;
int x4 := 0;
int x5 := 0;
int x6 := 0;
int x7 := 0;
int oldx1 := 0;
int oldx2 := 0;
int oldx3 := 0;
int oldx4 := 0;
int oldx5 := 0;
int oldx6 := 0;
int oldx7 := 0;
{x1 := 0;} [] {x1 := 1;}
{x2 := 0;} [] {x2 := 1;}
{x3 := 0;} [] {x3 := 1;}
{x4 := 0;} [] {x4 := 1;}
{x5 := 0;} [] {x5 := 1;}
{x6 := 0;} [] {x6 := 1;}
{x7 := 0;} [] {x7 := 1;}
// finds a ring configuration with exactly one token in the ring.
while((x1 + x2 + x3 + x4 + x5 + x6 + x7) != 1) {
oldx1 := x1;
oldx2 := x2;
oldx3 := x3;
oldx4 := x4;
oldx5 := x5;
oldx6 := x6;
oldx7 := x7;
if(x1 = oldx7) {
{x1 := 0;} [0.5] {x1 := 1;}
} else {
x1 := oldx7;
}
oldx7 := 0;
if(x2 = oldx1) {
{x2 := 0;} [0.5] {x2 := 1;}
} else {
x2 := oldx1;
}
oldx1 := 0;
if(x3 = oldx2) {
{x3 := 0;} [0.5] {x3 := 1;}
} else {
x3 := oldx2;
}
oldx2 := 0;
if(x4 = oldx3) {
{x4 := 0;} [0.5] {x4 := 1;}
} else {
x4 := oldx3;
}
oldx3 := 0;
if(x5 = oldx4) {
{x5 := 0;} [0.5] {x5 := 1;}
} else {
x5 := oldx4;
}
oldx4 := 0;
if(x6 = oldx5) {
{x6 := 0;} [0.5] {x6 := 1;}
} else {
x6 := oldx5;
}
oldx5 := 0;
if(x7 = oldx6) {
{x7 := 0;} [0.5] {x7 := 1;}
} else {
x7 := oldx6;
}
oldx6 := 0;
}
}

49
examples/pgcl/lotkavolterra.pgcl

@ -0,0 +1,49 @@
function lotkavolterra() {
int goats := 100;
int tigers := 4;
int dwellTime := 0;
int curTime := 0;
int b := 0;
while(tigers > 0 & goats > 0) {
dwellTime := 0;
b := 1;
if(goats > 0 & tigers > 0) {
// geometric distribution with p = 0.5
while (b >= 1) {
{b := 1;} [0.5] {b := 0;}
dwellTime := dwellTime + 1;
}
curTime := curTime + dwellTime;
{tigers := tigers + 1;} [0.2] {{goats := goats - 1;} [0.1] {tigers := tigers - 1;}}
} else { if(goats > 0) {
// geometric distribution with p = 0.5
while (b >= 1) {
{b := 1;} [0.5] {b := 0;}
dwellTime := dwellTime + 1;
}
curTime := curTime + dwellTime;
goats := goats + 1;
} else { if(tigers > 0) {
// geometric distribution with p = 0.5
while (b >= 1) {
{b := 1;} [0.5] {b := 0;}
dwellTime := dwellTime + 1;
}
curTime := curTime + dwellTime;
tigers := tigers - 1;
} } }
}
}

26
examples/pgcl/robot.pgcl

@ -0,0 +1,26 @@
function robotOnGrid() {
// robot starts in the lower left corner
int robotX := 1; int robotY := 20;
// janitor starts in the grid middle
int janitorX := ceil(20 / 2); int janitorY := ceil(20 / 2);
// iterates as long as the robot is not in the upper right corner
while(!(robotX = 20 & robotY = 1)) {
// robot perfoms one step at max each iteration
// checks whether we can go to the right and the janitor is not there
if(robotX < 20 & !((janitorX = robotX + 1) & (janitorY = robotY))) {
robotX := robotX + 1;
}
// checks whether we can go up and the janitor is not there
if(robotX = 20 & !((janitorX = robotX) & (janitorY = robotY - 1))) {
robotY := robotY - 1;
}
// moves the janitor randomly in one direction, not limited by any borders
{janitorX := janitorX + 1;}[0.25]{{janitorX := janitorX - 1;}[1/3]{{janitorY := janitorY + 1;}[0.375]{janitorY := janitorY - 1;}}}
}
}

2
examples/pmdp/brp/brp.pm

@ -136,4 +136,6 @@ module channelL
endmodule
label "error" = s=5;
label "fatal" = s=5 & T;

5
examples/pmdp/coin2/coin2.pm

@ -47,7 +47,10 @@ endmodule
module process2 = process1[pc1=pc2,coin1=coin2,p1=p2] endmodule
label "finished" = pc1=3 &pc2=3 ;
label "all_coins_equal_1" = coin1=1 &coin2=1 ;
label "all_coins_equal_0" = coin1=0 & coin2=0;
label "all_coins_equal_1" = coin1=1 & coin2=1;
label "agree" = coin1 = coin2;
rewards "steps"
true : 1;
endrewards

3
examples/pmdp/coin4/coin4.pm

@ -53,6 +53,9 @@ module process4 = process1[pc1=pc4,coin1=coin4,p1=p4] endmodule
label "finished" = pc1=3 &pc2=3 &pc3=3 &pc4=3;
label "all_coins_equal_1" = coin1=1 &coin2=1 &coin3=1 &coin4=1 ;
label "all_coins_equal_0" = coin1=0 & coin2=0 & coin3 = 0 & coin4 = 0;
label "agree" = coin1=coin2 & coin2=coin3 & coin3 = coin4;
rewards "steps"
true : 1;
endrewards

11
examples/pmdp/zeroconf/zeroconf.pm

@ -256,3 +256,14 @@ module host0
[] l=4 -> 1 : true;
endmodule
// reward structure
const double err; // cost associated with using a IP address already in use
rewards
[time] true : 1;
[send] l=3 & mess=0 & y=CONSEC & probes=1 & ip=1 : err;
endrewards
label "selected_ip" = l = 4;
label "selected_ip_in_use" = l = 4 & ip = 1;

6
resources/3rdparty/CMakeLists.txt

@ -329,9 +329,9 @@ add_dependencies(resources sylvan)
if(${OPERATING_SYSTEM} MATCHES "Linux")
find_package(Hwloc QUIET REQUIRED)
if(Hwloc_FOUND)
message(STATUS "StoRM - Linking with hwloc ${Hwloc_VERSION}")
list(APPEND STORM_LINK_LIBRARIES ${Hwloc_LIBRARIES})
if(HWLOC_FOUND)
message(STATUS "StoRM - Linking with hwloc ${HWLOC_VERSION}")
list(APPEND STORM_LINK_LIBRARIES ${HWLOC_LIBRARIES})
else()
message(FATAL_ERROR "HWLOC is required but was not found.")
endif()

9
resources/3rdparty/include_xerces.cmake

@ -19,8 +19,11 @@ if(USE_XERCES)
set(XERCES_ROOT ${STORM_3RDPARTY_BINARY_DIR}/xercesc-3.1.2)
set(XERCESC_INCLUDE ${XERCES_ROOT}/include)
set(XERCES_LIBRARY_PATH ${XERCES_ROOT}/lib)
set(XERCESC_LIBRARIES ${XERCES_LIBRARY_PATH}/libxerces-c.a)
if(BUILD_STATIC)
set(XERCESC_LIBRARIES ${XERCES_LIBRARY_PATH}/libxerces-c.a)
else()
set(XERCESC_LIBRARIES ${XERCES_LIBRARY_PATH}/libxerces-c${DYNAMIC_EXT})
endif()
add_dependencies(resources xercesc)
endif()
@ -33,4 +36,6 @@ if(USE_XERCES)
endif()
find_package(CURL)
list(APPEND STORM_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${COREFOUNDATION_LIBRARY} ${CORESERVICES_LIBRARY} ${CURL_LIBRARIES})
else()
message (WARNING "StoRM - Building without Xerces disables parsing XML formats (for GSPNs)")
endif(USE_XERCES)

4
resources/3rdparty/modernjson/CMakeLists.txt

@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.0)
# define the project
project(nlohmann_json VERSION 2.0.0 LANGUAGES CXX)
project(nlohmann_json VERSION 2.0.5 LANGUAGES CXX)
enable_testing()
option(BuildTests "Build the unit tests" ON)

59
resources/3rdparty/modernjson/ChangeLog.md

@ -1,10 +1,54 @@
# Change Log
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased](https://github.com/nlohmann/json/tree/HEAD)
## [v2.0.5](https://github.com/nlohmann/json/releases/tag/v2.0.5) (2016-09-14)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.4...v2.0.5)
[Full Changelog](https://github.com/nlohmann/json/compare/v1.1.0...HEAD)
- make json\_benchmarks no longer working in 2.0.4 [\#310](https://github.com/nlohmann/json/issues/310)
- \[feature request\]: schema validator and comments [\#311](https://github.com/nlohmann/json/issues/311)
## [v2.0.4](https://github.com/nlohmann/json/releases/tag/v2.0.4) (2016-09-11)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.3...v2.0.4)
- Parsing fails without space at end of file [\#306](https://github.com/nlohmann/json/issues/306)
- Unused variable warning [\#304](https://github.com/nlohmann/json/issues/304)
## [v2.0.3](https://github.com/nlohmann/json/releases/tag/v2.0.3) (2016-08-31)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.2...v2.0.3)
- Support for iterator-range parsing [\#290](https://github.com/nlohmann/json/issues/290)
- warning C4706: assignment within conditional expression [\#295](https://github.com/nlohmann/json/issues/295)
- Horribly inconsistent behavior between const/non-const reference in operator \[\] \(\) [\#289](https://github.com/nlohmann/json/issues/289)
- unit-constructor1.cpp: Fix floating point truncation warning [\#300](https://github.com/nlohmann/json/pull/300) ([t-b](https://github.com/t-b))
## [v2.0.2](https://github.com/nlohmann/json/releases/tag/v2.0.2) (2016-07-31)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.1...v2.0.2)
- value\(\) does not work with \_json\_pointer types [\#283](https://github.com/nlohmann/json/issues/283)
- Easy serialization of classes [\#280](https://github.com/nlohmann/json/issues/280)
- Build error for std::int64 [\#282](https://github.com/nlohmann/json/issues/282)
- hexify\(\) function emits conversion warning [\#270](https://github.com/nlohmann/json/issues/270)
- let the makefile choose the correct sed [\#279](https://github.com/nlohmann/json/pull/279) ([murinicanor](https://github.com/murinicanor))
- Update hexify to use array lookup instead of ternary \(\#270\) [\#275](https://github.com/nlohmann/json/pull/275) ([dtoma](https://github.com/dtoma))
## [v2.0.1](https://github.com/nlohmann/json/releases/tag/v2.0.1) (2016-06-28)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.0...v2.0.1)
- dump\(\) performance degradation in v2 [\#272](https://github.com/nlohmann/json/issues/272)
- fixed a tiny typo [\#271](https://github.com/nlohmann/json/pull/271) ([thelostt](https://github.com/thelostt))
## [v2.0.0](https://github.com/nlohmann/json/releases/tag/v2.0.0) (2016-06-23)
[Full Changelog](https://github.com/nlohmann/json/compare/v1.1.0...v2.0.0)
- concatenate objects [\#252](https://github.com/nlohmann/json/issues/252)
- Unit test fails when doing a CMake out-of-tree build [\#241](https://github.com/nlohmann/json/issues/241)
- Additional integration options [\#237](https://github.com/nlohmann/json/issues/237)
- Can't use basic\_json::iterator as a base iterator for std::move\_iterator [\#233](https://github.com/nlohmann/json/issues/233)
@ -14,8 +58,12 @@ All notable changes to this project will be documented in this file. This projec
- Add support for afl-fuzz testing [\#207](https://github.com/nlohmann/json/pull/207) ([mykter](https://github.com/mykter))
- Issue \#178 - Extending support to full uint64\_t/int64\_t range and unsigned type \(updated\) [\#193](https://github.com/nlohmann/json/pull/193) ([twelsby](https://github.com/twelsby))
- json::diff generates incorrect patch when removing multiple array elements. [\#269](https://github.com/nlohmann/json/issues/269)
- -Wconversion warning [\#259](https://github.com/nlohmann/json/issues/259)
- Maybe a bug [\#258](https://github.com/nlohmann/json/issues/258)
- -Wconversion warnings [\#239](https://github.com/nlohmann/json/issues/239)
- ambiguous overload for 'push\_back' and 'operator+=' [\#235](https://github.com/nlohmann/json/issues/235)
- Incorrect dumping of parsed numbers with exponents, but without decimal places [\#230](https://github.com/nlohmann/json/issues/230)
- double values are serialized with commas as decimal points [\#228](https://github.com/nlohmann/json/issues/228)
- Move semantics with std::initializer\_list [\#225](https://github.com/nlohmann/json/issues/225)
- abort during getline in yyfill [\#223](https://github.com/nlohmann/json/issues/223)
@ -26,11 +74,18 @@ All notable changes to this project will be documented in this file. This projec
- Floating point exceptions [\#181](https://github.com/nlohmann/json/issues/181)
- In basic\_json::basic\_json\(const CompatibleArrayType& val\), the requirement of CompatibleArrayType is not strict enough. [\#174](https://github.com/nlohmann/json/issues/174)
- Implicit assignment to std::string fails [\#144](https://github.com/nlohmann/json/issues/144)
- Fix Issue \#265 [\#266](https://github.com/nlohmann/json/pull/266) ([06needhamt](https://github.com/06needhamt))
- Issue \#195 - update Travis to Trusty due to gcc/clang strtod\(\) bug [\#196](https://github.com/nlohmann/json/pull/196) ([twelsby](https://github.com/twelsby))
- Compiler Errors With JSON.hpp [\#265](https://github.com/nlohmann/json/issues/265)
- VS2015 compile fail [\#260](https://github.com/nlohmann/json/issues/260)
- Error when using json in g++ [\#254](https://github.com/nlohmann/json/issues/254)
- Update long-term goals [\#246](https://github.com/nlohmann/json/issues/246)
- Error compile Android NDK error: 'strtof' is not a member of 'std' [\#219](https://github.com/nlohmann/json/issues/219)
- Conflicting typedef of ssize\_t on Windows 32 bit when using Boost.Python [\#204](https://github.com/nlohmann/json/issues/204)
- Integer conversion to unsigned [\#178](https://github.com/nlohmann/json/issues/178)
- Define CMake/CTest tests [\#247](https://github.com/nlohmann/json/pull/247) ([robertmrk](https://github.com/robertmrk))
- Out of tree builds and a few other miscellaneous CMake cleanups. [\#242](https://github.com/nlohmann/json/pull/242) ([ChrisKitching](https://github.com/ChrisKitching))
- Implement additional integration options [\#238](https://github.com/nlohmann/json/pull/238) ([robertmrk](https://github.com/robertmrk))
- make serialization locale-independent [\#232](https://github.com/nlohmann/json/pull/232) ([nlohmann](https://github.com/nlohmann))

35
resources/3rdparty/modernjson/Makefile

@ -10,18 +10,25 @@ all: json_unit
# clean up
clean:
rm -fr json_unit json_benchmarks fuzz fuzz-testing *.dSYM
rm -fr benchmarks/files/numbers/*.json
$(MAKE) clean -Cdoc
$(MAKE) clean -Ctest
##########################################################################
# unit tests
##########################################################################
# additional flags
FLAGS = -Wall -Wextra -pedantic -Weffc++ -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch -Wundef -Wno-unused -Wnon-virtual-dtor -Wreorder -Wdeprecated -Wfloat-equal
# build unit tests
json_unit:
@$(MAKE) -C test
# build unit tests (TODO: Does this want its own makefile?)
json_unit: test/src/unit.cpp src/json.hpp test/src/catch.hpp
$(CXX) -std=c++11 $(CXXFLAGS) $(FLAGS) $(CPPFLAGS) -I src -I test $< $(LDFLAGS) -o $@
# run unit tests
check: json_unit
test/json_unit "*"
check-fast: json_unit
test/json_unit
##########################################################################
@ -30,7 +37,7 @@ json_unit: test/src/unit.cpp src/json.hpp test/src/catch.hpp
# compile example files and check output
doctest:
make check_output -C doc
$(MAKE) check_output -C doc
##########################################################################
@ -57,8 +64,10 @@ fuzz: test/src/fuzz.cpp src/json.hpp
# call cppcheck on the main header file
cppcheck:
cppcheck --enable=all --inconclusive --std=c++11 src/json.hpp
cppcheck --enable=warning --inconclusive --force --std=c++11 src/json.hpp --error-exitcode=1
clang_sanitize: clean
CXX=clang++ CXXFLAGS="-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" $(MAKE)
##########################################################################
# maintainer targets
@ -66,7 +75,7 @@ cppcheck:
# create scanner with re2c
re2c: src/json.hpp.re2c
$(RE2C) --bit-vectors --nested-ifs --no-debug-info $< | $(SED) '1d' > src/json.hpp
$(RE2C) -W --bit-vectors --nested-ifs --no-debug-info $< | $(SED) '1d' > src/json.hpp
# pretty printer
pretty:
@ -75,7 +84,8 @@ pretty:
--indent-col1-comments --pad-oper --pad-header --align-pointer=type \
--align-reference=type --add-brackets --convert-tabs --close-templates \
--lineend=linux --preserve-date --suffix=none --formatted \
src/json.hpp src/json.hpp.re2c test/src/unit.cpp test/src/fuzz.cpp benchmarks/benchmarks.cpp doc/examples/*.cpp
src/json.hpp src/json.hpp.re2c test/src/*.cpp \
benchmarks/benchmarks.cpp doc/examples/*.cpp
##########################################################################
@ -84,7 +94,8 @@ pretty:
# benchmarks
json_benchmarks: benchmarks/benchmarks.cpp benchmarks/benchpress.hpp benchmarks/cxxopts.hpp src/json.hpp
$(CXX) -std=c++11 $(CXXFLAGS) -O3 -flto -I src -I benchmarks $< $(LDFLAGS) -o $@
cd benchmarks/files/numbers ; python generate.py
$(CXX) -std=c++11 $(CXXFLAGS) -DNDEBUG -O3 -flto -I src -I benchmarks $< $(LDFLAGS) -o $@
./json_benchmarks
@ -92,7 +103,9 @@ json_benchmarks: benchmarks/benchmarks.cpp benchmarks/benchpress.hpp benchmarks/
# changelog
##########################################################################
NEXT_VERSION ?= "unreleased"
ChangeLog.md:
github_changelog_generator -o ChangeLog.md --simple-list --release-url https://github.com/nlohmann/json/releases/tag/%s
github_changelog_generator -o ChangeLog.md --simple-list --release-url https://github.com/nlohmann/json/releases/tag/%s --future-release $(NEXT_VERSION)
gsed -i 's|https://github.com/nlohmann/json/releases/tag/HEAD|https://github.com/nlohmann/json/tree/HEAD|' ChangeLog.md
gsed -i '2i All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).' ChangeLog.md

178
resources/3rdparty/modernjson/README.md

@ -1,13 +1,14 @@
![JSON for Modern C++](https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif)
[![JSON for Modern C++](https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif)](https://github.com/nlohmann/json/releases)
[![Build Status](https://travis-ci.org/nlohmann/json.svg?branch=master)](https://travis-ci.org/nlohmann/json)
[![Build Status](https://ci.appveyor.com/api/projects/status/1acb366xfyg3qybk?svg=true)](https://ci.appveyor.com/project/nlohmann/json)
[![Build Status](https://ci.appveyor.com/api/projects/status/1acb366xfyg3qybk/branch/develop?svg=true)](https://ci.appveyor.com/project/nlohmann/json)
[![Coverage Status](https://img.shields.io/coveralls/nlohmann/json.svg)](https://coveralls.io/r/nlohmann/json)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](http://melpon.org/wandbox/permlink/wuiuqYiYqRTdI3rG)
[![Documentation Status](https://img.shields.io/badge/docs-doxygen-blue.svg)](http://nlohmann.github.io/json)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](http://melpon.org/wandbox/permlink/r3wa3rI5yxgQQcrm)
[![Documentation](https://img.shields.io/badge/docs-doxygen-blue.svg)](http://nlohmann.github.io/json)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT)
[![Github Releases](https://img.shields.io/github/release/nlohmann/json.svg)](https://github.com/nlohmann/json/releases)
[![Github Issues](https://img.shields.io/github/issues/nlohmann/json.svg)](http://github.com/nlohmann/json/issues)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/289/badge)](https://bestpractices.coreinfrastructure.org/projects/289)
## Design goals
@ -15,18 +16,19 @@ There are myriads of [JSON](http://json.org) libraries out there, and each may e
- **Intuitive syntax**. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. Check out the [examples below](#examples) and you know, what I mean.
- **Trivial integration**. Our whole code consists of a single header file `json.hpp`. That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.
- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/src/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.
- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/blob/master/test/src/unit.cpp) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](http://valgrind.org) that there are no memory leaks.
- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/blob/master/test/src/unit.cpp) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](http://valgrind.org) that there are no memory leaks. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289).
Other aspects were not so important to us:
- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t`, `uint64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs.
- **Speed**. We currently implement the parser as naive [recursive descent parser](http://en.wikipedia.org/wiki/Recursive_descent_parser) with hand coded string handling. It is fast enough, but a [LALR-parser](http://en.wikipedia.org/wiki/LALR_parser) with a decent regular expression processor should be even faster (but would consist of more files which makes the integration harder).
- **Speed**. We currently implement the parser as naive [recursive descent parser](http://en.wikipedia.org/wiki/Recursive_descent_parser) with hand coded string handling. It is fast enough, but a [LALR-parser](http://en.wikipedia.org/wiki/LALR_parser) may be even faster (but would consist of more files which makes the integration harder).
See the [contribution guidelines](https://github.com/nlohmann/json/blob/master/.github/CONTRIBUTING.md#please-dont) for more information.
## Integration
The single required source, file `json.hpp` is in the `src` directory or [released here](https://github.com/nlohmann/json/releases). All you need to do is add
@ -40,49 +42,8 @@ using json = nlohmann::json;
to the files you want to use JSON objects. That's it. Do not forget to set the necessary switches to enable C++11 (e.g., `-std=c++11` for GCC and Clang).
## Supported compilers
Though it's 2016 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
- GCC 4.9 - 6.0 (and possibly later)
- Clang 3.4 - 3.9 (and possibly later)
- Microsoft Visual C++ 14.0 RC (and possibly later)
The code is currently checked with Travis for GCC 4.9, GCC
I would be happy to learn about other compilers/versions.
:beer: If you are using OS X and [Homebrew](http://brew.sh), just type `brew tap nlohmann/json` and `brew install nlohmann_json` and you're set. If you want the bleeding edge rather than the latest release, use `brew install nlohmann_json --HEAD`.
Please note:
- GCC 4.8 does not work because of two bugs ([55817](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55817) and [57824](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824)) in the C++11 support. Note there is a [pull request](https://github.com/nlohmann/json/pull/212) to fix some of the issues.
- Android defaults to using very old compilers and C++ libraries. To fix this, add the following to your `Application.mk`. This will switch to the LLVM C++ library, the Clang compiler, and enable C++11 and other features disabled by default.
```
APP_STL := c++_shared
NDK_TOOLCHAIN_VERSION := clang3.6
APP_CPPFLAGS += -frtti -fexceptions
```
- For GCC running on MinGW or Android SDK, the error `'to_string' is not a member of 'std'` (or similarly, for `strtod`) may occur. Note this is not an issue with the code, but rather with the compiler itself. On Android, see above to build with a newer environment. For MinGW, please refer to [this site](http://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug.
The following compilers are currently used in [continuous integration](https://travis-ci.org/nlohmann/json):
| Compiler | Operating System | Version String |
|-----------------|------------------------------|----------------|
| GCC 4.9.3 | Ubuntu 14.04.3 LTS | g++-4.9 (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3 |
| GCC 5.3.0 | Ubuntu 14.04.3 LTS | g++-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204 |
| Clang 3.6.2 | Ubuntu 14.04.3 LTS | Ubuntu clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2) |
| Clang 3.7.1 | Ubuntu 14.04.3 LTS | Ubuntu clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1) |
| Clang 3.8.1 | Ubuntu 14.04.3 LTS | clang version 3.8.1-svn265380-1~exp1 (branches/release_38) |
| Clang 3.9.0 | Ubuntu 14.04.3 LTS | clang version 3.9.0-svn267478-1~exp1 (trunk) |
| Clang Xcode 6.1 | Darwin Kernel Version 13.4.0 | Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) |
| Clang Xcode 6.2 | Darwin Kernel Version 13.4.0 | Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) |
| Clang Xcode 6.3 | Darwin Kernel Version 14.3.0 | Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) |
| Clang Xcode 6.4 | Darwin Kernel Version 14.3.0 | Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) |
| Clang Xcode 7.1 | Darwin Kernel Version 14.5.0 | Apple LLVM version 7.0.0 (clang-700.1.76) |
| Clang Xcode 7.2 | Darwin Kernel Version 15.0.0 | Apple LLVM version 7.0.2 (clang-700.1.81) |
| Clang Xcode 7.3 | Darwin Kernel Version 14.5.0 | Apple LLVM version 7.3.0 (clang-703.0.29) |
| Visual Studio 14 2015 | Windows Server 2012 R2 (x64) | Microsoft (R) Build Engine version 14.0.25123.0 |
## Examples
@ -165,6 +126,7 @@ json empty_object_explicit = json::object();
json array_not_object = { json::array({"currency", "USD"}), json::array({"value", 42.99}) };
```
### Serialization / Deserialization
You can create an object (deserialization) by appending `_json` to a string literal:
@ -173,7 +135,7 @@ You can create an object (deserialization) by appending `_json` to a string lite
// create object from string literal
json j = "{ \"happy\": true, \"pi\": 3.141 }"_json;
// or even nicer (thanks http://isocpp.org/blog/2015/01/json-for-modern-cpp)
// or even nicer with a raw string literal
auto j2 = R"(
{
"happy": true,
@ -218,6 +180,7 @@ These operators work for any subclasses of `std::istream` or `std::ostream`.
Please note that setting the exception bit for `failbit` is inappropriate for this use case. It will result in program termination due to the `noexcept` specifier in use.
### STL-like access
We designed the JSON class to behave just like an STL container. In fact, it satisfies the [**ReversibleContainer**](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) requirement.
@ -285,6 +248,7 @@ int fob_present = o.count("fob"); // 0
o.erase("foo");
```
### Conversion from STL containers
Any sequence container (`std::array`, `std::vector`, `std::deque`, `std::forward_list`, `std::list`) whose values can be used to construct JSON types (e.g., integers, floating point numbers, Booleans, string types, or again STL containers described in this section) can be used to create a JSON array. The same holds for similar associative containers (`std::set`, `std::multiset`, `std::unordered_set`, `std::unordered_multiset`), but in these cases the order of the elements of the array depends how the elements are ordered in the respective STL container.
@ -327,7 +291,7 @@ json j_umset(c_umset); // both entries for "one" are used
// maybe ["one", "two", "one", "four"]
```
Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys are can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
```cpp
std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} };
@ -347,12 +311,51 @@ json j_ummap(c_ummap); // only one entry for key "three" is used
// maybe {"one": true, "two": true, "three": true}
```
### JSON Pointer and JSON Patch
The library supports **JSON Pointer** ([RFC 6901](https://tools.ietf.org/html/rfc6901)) as alternative means to address structured values. On top of this, **JSON Patch** ([RFC 6902](https://tools.ietf.org/html/rfc6902)) allows to describe differences between two JSON values - effectively allowing patch and diff operations known from Unix.
```cpp
// a JSON value
json j_original = R"({
"baz": ["one", "two", "three"],
"foo": "bar"
})"_json;
// access members with a JSON pointer (RFC 6901)
j_original["/baz/1"_json_pointer];
// "two"
// a JSON patch (RFC 6902)
json j_patch = R"([
{ "op": "replace", "path": "/baz", "value": "boo" },
{ "op": "add", "path": "/hello", "value": ["world"] },
{ "op": "remove", "path": "/foo"}
])"_json;
// apply the patch
json j_result = j_original.patch(j_patch);
// {
// "baz": "boo",
// "hello": ["world"]
// }
// calculate a JSON patch from two JSON values
json::diff(j_result, j_original);
// [
// { "op":" replace", "path": "/baz", "value": ["one", "two", "three"] },
// { "op": "remove","path": "/hello" },
// { "op": "add", "path": "/foo", "value": "bar" }
// ]
```
### Implicit conversions
The type of the JSON object is determined automatically by the expression to store. Likewise, the stored value is implicitly converted.
```cpp
/// strings
// strings
std::string s1 = "Hello, world!";
json js = s1;
std::string s2 = js;
@ -380,6 +383,57 @@ int vi = jn.get<int>();
// etc.
```
## Supported compilers
Though it's 2016 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
- GCC 4.9 - 6.0 (and possibly later)
- Clang 3.4 - 3.9 (and possibly later)
- Microsoft Visual C++ 2015 / Build Tools 14.0.25123.0 (and possibly later)
I would be happy to learn about other compilers/versions.
Please note:
- GCC 4.8 does not work because of two bugs ([55817](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55817) and [57824](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57824)) in the C++11 support. Note there is a [pull request](https://github.com/nlohmann/json/pull/212) to fix some of the issues.
- Android defaults to using very old compilers and C++ libraries. To fix this, add the following to your `Application.mk`. This will switch to the LLVM C++ library, the Clang compiler, and enable C++11 and other features disabled by default.
```
APP_STL := c++_shared
NDK_TOOLCHAIN_VERSION := clang3.6
APP_CPPFLAGS += -frtti -fexceptions
```
The code compiles successfully with [Android NDK](https://developer.android.com/ndk/index.html?hl=ml), Revision 9 - 11 (and possibly later) and [CrystaX's Android NDK](https://www.crystax.net/en/android/ndk) version 10.
- For GCC running on MinGW or Android SDK, the error `'to_string' is not a member of 'std'` (or similarly, for `strtod`) may occur. Note this is not an issue with the code, but rather with the compiler itself. On Android, see above to build with a newer environment. For MinGW, please refer to [this site](http://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug. For Android NDK using `APP_STL := gnustl_static`, please refer to [this discussion](https://github.com/nlohmann/json/issues/219).
The following compilers are currently used in continuous integration at [Travis](https://travis-ci.org/nlohmann/json) and [AppVeyor](https://ci.appveyor.com/project/nlohmann/json):
| Compiler | Operating System | Version String |
|-----------------|------------------------------|----------------|
| GCC 4.9.3 | Ubuntu 14.04.4 LTS | g++-4.9 (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3 |
| GCC 5.3.0 | Ubuntu 14.04.4 LTS | g++-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204 |
| GCC 6.1.1 | Ubuntu 14.04.4 LTS | g++-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511 |
| Clang 3.6.0 | Ubuntu 14.04.4 LTS | clang version 3.6.0 (tags/RELEASE_360/final) |
| Clang 3.6.1 | Ubuntu 14.04.4 LTS | clang version 3.6.1 (tags/RELEASE_361/final) |
| Clang 3.6.2 | Ubuntu 14.04.4 LTS | clang version 3.6.2 (tags/RELEASE_362/final) |
| Clang 3.7.0 | Ubuntu 14.04.4 LTS | clang version 3.7.0 (tags/RELEASE_370/final) |
| Clang 3.7.1 | Ubuntu 14.04.4 LTS | clang version 3.7.1 (tags/RELEASE_371/final) |
| Clang 3.8.0 | Ubuntu 14.04.4 LTS | clang version 3.8.0 (tags/RELEASE_380/final) |
| Clang 3.8.1 | Ubuntu 14.04.4 LTS | clang version 3.8.1 (tags/RELEASE_381/final) |
| Clang Xcode 6.1 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) |
| Clang Xcode 6.2 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) |
| Clang Xcode 6.3 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) |
| Clang Xcode 6.4 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) |
| Clang Xcode 7.1 | Darwin Kernel Version 14.5.0 (OSX 10.10.5) | Apple LLVM version 7.0.0 (clang-700.1.76) |
| Clang Xcode 7.2 | Darwin Kernel Version 15.0.0 (OSX 10.10.5) | Apple LLVM version 7.0.2 (clang-700.1.81) |
| Clang Xcode 7.3 | Darwin Kernel Version 15.0.0 (OSX 10.10.5) | Apple LLVM version 7.3.0 (clang-703.0.29) |
| Clang Xcode 8.0 | Darwin Kernel Version 15.6.0 (OSX 10.11.6) | Apple LLVM version 8.0.0 (clang-800.0.38) |
| Visual Studio 14 2015 | Windows Server 2012 R2 (x64) | Microsoft (R) Build Engine version 14.0.25123.0 |
## License
<img align="right" src="http://opensource.org/trademarks/opensource/OSI-Approved-License-100x137.png">
@ -388,11 +442,12 @@ The class is licensed under the [MIT License](http://opensource.org/licenses/MIT
Copyright &copy; 2013-2016 [Niels Lohmann](http://nlohmann.me)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Thanks
@ -433,24 +488,31 @@ I deeply appreciate the help of the following people.
- [zewt](https://github.com/zewt) added useful notes to the README file about Android.
- [Róbert Márki](https://github.com/robertmrk) added a fix to use move iterators and improved the integration via CMake.
- [Chris Kitching](https://github.com/ChrisKitching) cleaned up the CMake files.
- [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal).
- [Mário Feroldi](https://github.com/thelostt) fixed a small typo.
- [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release.
- [Damien](https://github.com/dtoma) fixed one of the last conversion warnings.
- [Thomas Braun](https://github.com/t-b) fixed a warning in a test case.
- [Théo DELRIEU](https://github.com/theodelrieu) patiently and constructively oversaw the long way toward [iterator-range parsing](https://github.com/nlohmann/json/issues/290).
Thanks a lot for helping out!
## Notes
- The code contains numerous debug **assertions** which can be switched off by defining the preprocessor macro `NDEBUG`, see the [documentation of `assert`](http://en.cppreference.com/w/cpp/error/assert).
- The code contains numerous debug **assertions** which can be switched off by defining the preprocessor macro `NDEBUG`, see the [documentation of `assert`](http://en.cppreference.com/w/cpp/error/assert). In particular, note [`operator[]`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a2e26bd0b0168abb61f67ad5bcd5b9fa1.html#a2e26bd0b0168abb61f67ad5bcd5b9fa1) implements **unchecked access** for const objects: If the given key is not present, the behavior is undefined (think of a dereferenced null pointer) and yields an [assertion failure](https://github.com/nlohmann/json/issues/289) if assertions are switched on. If you are not sure whether an element in an object exists, use checked access with the [`at()` function](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a674de1ee73e6bf4843fc5dc1351fb726.html#a674de1ee73e6bf4843fc5dc1351fb726).
- As the exact type of a number is not defined in the [JSON specification](http://rfc7159.net/rfc7159), this library tries to choose the best fitting C++ number type automatically. As a result, the type `double` may be used to store numbers which may yield [**floating-point exceptions**](https://github.com/nlohmann/json/issues/181) in certain rare situations if floating-point exceptions have been unmasked in the calling code. These exceptions are not caused by the library and need to be fixed in the calling code, such as by re-masking the exceptions prior to calling library functions.
## Execute unit tests
To compile and run the tests, you need to execute
```sh
$ make
$ ./json_unit "*"
$ make check
===============================================================================
All tests passed (5568705 assertions in 31 test cases)
All tests passed (8905161 assertions in 35 test cases)
```
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).

3
resources/3rdparty/modernjson/appveyor.yml

@ -7,5 +7,4 @@ build_script:
- cmake . -G "Visual Studio 14 2015"
- cmake --build . --config Release
test_script:
- test\Release\json_unit.exe
- test\Release\json_unit.exe "*"
- ctest -C Release -V

77
resources/3rdparty/modernjson/benchmarks/benchmarks.cpp

@ -1,77 +0,0 @@
#define BENCHPRESS_CONFIG_MAIN
#include <fstream>
#include <benchpress.hpp>
#include <json.hpp>
BENCHMARK("parse jeopardy.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/jeopardy/jeopardy.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse canada.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/nativejson-benchmark/canada.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse citm_catalog.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/nativejson-benchmark/citm_catalog.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse twitter.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/nativejson-benchmark/twitter.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("dump jeopardy.json", [](benchpress::context* ctx)
{
std::ifstream input_file("benchmarks/files/jeopardy/jeopardy.json");
nlohmann::json j;
j << input_file;
std::ofstream output_file("jeopardy.dump.json");
ctx->reset_timer();
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
output_file << j;
}
std::remove("jeopardy.dump.json");
})
BENCHMARK("dump jeopardy.json with indent", [](benchpress::context* ctx)
{
std::ifstream input_file("benchmarks/files/jeopardy/jeopardy.json");
nlohmann::json j;
j << input_file;
std::ofstream output_file("jeopardy.dump.json");
ctx->reset_timer();
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
output_file << std::setw(4) << j;
}
std::remove("jeopardy.dump.json");
})

401
resources/3rdparty/modernjson/benchmarks/benchpress.hpp

@ -1,401 +0,0 @@
/*
* Copyright (C) 2015 Christopher Gilbert.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef BENCHPRESS_HPP
#define BENCHPRESS_HPP
#include <algorithm> // max, min
#include <atomic> // atomic_intmax_t
#include <chrono> // high_resolution_timer, duration
#include <functional> // function
#include <iomanip> // setw
#include <iostream> // cout
#include <regex> // regex, regex_match
#include <sstream> // stringstream
#include <string> // string
#include <thread> // thread
#include <vector> // vector
namespace benchpress {
/*
* The options class encapsulates all options for running benchmarks.
*
* When including benchpress, a main function can be emitted which includes a command-line parser for building an
* options object. However from time-to-time it may be necessary for the developer to have to build their own main
* stub and construct the options object manually.
*
* options opts;
* opts
* .bench(".*")
* .benchtime(1)
* .cpu(4);
*/
class options {
std::string d_bench;
size_t d_benchtime;
size_t d_cpu;
public:
options()
: d_bench(".*")
, d_benchtime(1)
, d_cpu(std::thread::hardware_concurrency())
{}
options& bench(const std::string& bench) {
d_bench = bench;
return *this;
}
options& benchtime(size_t benchtime) {
d_benchtime = benchtime;
return *this;
}
options& cpu(size_t cpu) {
d_cpu = cpu;
return *this;
}
std::string get_bench() const {
return d_bench;
}
size_t get_benchtime() const {
return d_benchtime;
}
size_t get_cpu() const {
return d_cpu;
}
};
class context;
/*
* The benchmark_info class is used to store a function name / pointer pair.
*
* benchmark_info bi("example", [](benchpress::context* b) {
* // benchmark function
* });
*/
class benchmark_info {
std::string d_name;
std::function<void(context*)> d_func;
public:
benchmark_info(std::string name, std::function<void(context*)> func)
: d_name(name)
, d_func(func)
{}
std::string get_name() const { return d_name; }
std::function<void(context*)> get_func() const { return d_func; }
};
/*
* The registration class is responsible for providing a single global point of reference for registering
* benchmark functions.
*
* registration::get_ptr()->register_benchmark(info);
*/
class registration {
static registration* d_this;
std::vector<benchmark_info> d_benchmarks;
public:
static registration* get_ptr() {
if (nullptr == d_this) {
d_this = new registration();
}
return d_this;
}
void register_benchmark(benchmark_info& info) {
d_benchmarks.push_back(info);
}
std::vector<benchmark_info> get_benchmarks() { return d_benchmarks; }
};
/*
* The auto_register class is a helper used to register benchmarks.
*/
class auto_register {
public:
auto_register(const std::string& name, std::function<void(context*)> func) {
benchmark_info info(name, func);
registration::get_ptr()->register_benchmark(info);
}
};
#define CONCAT(x, y) x ## y
#define CONCAT2(x, y) CONCAT(x, y)
// The BENCHMARK macro is a helper for creating benchmark functions and automatically registering them with the
// registration class.
#define BENCHMARK(x, f) benchpress::auto_register CONCAT2(register_, __LINE__)((x), (f));
// This macro will prevent the compiler from removing a redundant code path which has no side-effects.
#define DISABLE_REDUNDANT_CODE_OPT() { asm(""); }
/*
* The result class is responsible for producing a printable string representation of a benchmark run.
*/
class result {
size_t d_num_iterations;
std::chrono::nanoseconds d_duration;
size_t d_num_bytes;
public:
result(size_t num_iterations, std::chrono::nanoseconds duration, size_t num_bytes)
: d_num_iterations(num_iterations)
, d_duration(duration)
, d_num_bytes(num_bytes)
{}
size_t get_ns_per_op() const {
if (d_num_iterations <= 0) {
return 0;
}
return d_duration.count() / d_num_iterations;
}
double get_mb_per_s() const {
if (d_num_iterations <= 0 || d_duration.count() <= 0 || d_num_bytes <= 0) {
return 0;
}
return ((double(d_num_bytes) * double(d_num_iterations) / double(1e6)) /
double(std::chrono::duration_cast<std::chrono::seconds>(d_duration).count()));
}
std::string to_string() const {
std::stringstream tmp;
tmp << std::setw(12) << std::right << d_num_iterations;
size_t npo = get_ns_per_op();
tmp << std::setw(12) << std::right << npo << std::setw(0) << " ns/op";
double mbs = get_mb_per_s();
if (mbs > 0.0) {
tmp << std::setw(12) << std::right << mbs << std::setw(0) << " MB/s";
}
return std::string(tmp.str());
}
};
/*
* The parallel_context class is responsible for providing a thread-safe context for parallel benchmark code.
*/
class parallel_context {
std::atomic_intmax_t d_num_iterations;
public:
parallel_context(size_t num_iterations)
: d_num_iterations(num_iterations)
{}
bool next() {
return (d_num_iterations.fetch_sub(1) > 0);
}
};
/*
* The context class is responsible for providing an interface for capturing benchmark metrics to benchmark functions.
*/
class context {
bool d_timer_on;
std::chrono::high_resolution_clock::time_point d_start;
std::chrono::nanoseconds d_duration;
std::chrono::seconds d_benchtime;
size_t d_num_iterations;
size_t d_num_threads;
size_t d_num_bytes;
benchmark_info d_benchmark;
public:
context(const benchmark_info& info, const options& opts)
: d_timer_on(false)
, d_start()
, d_duration()
, d_benchtime(std::chrono::seconds(opts.get_benchtime()))
, d_num_iterations(1)
, d_num_threads(opts.get_cpu())
, d_num_bytes(0)
, d_benchmark(info)
{}
size_t num_iterations() const { return d_num_iterations; }
void set_num_threads(size_t n) { d_num_threads = n; }
size_t num_threads() const { return d_num_threads; }
void start_timer() {
if (!d_timer_on) {
d_start = std::chrono::high_resolution_clock::now();
d_timer_on = true;
}
}
void stop_timer() {
if (d_timer_on) {
d_duration += std::chrono::high_resolution_clock::now() - d_start;
d_timer_on = false;
}
}
void reset_timer() {
if (d_timer_on) {
d_start = std::chrono::high_resolution_clock::now();
}
d_duration = std::chrono::nanoseconds::zero();
}
void set_bytes(int64_t bytes) { d_num_bytes = bytes; }
size_t get_ns_per_op() {
if (d_num_iterations <= 0) {
return 0;
}
return d_duration.count() / d_num_iterations;
}
void run_n(size_t n) {
d_num_iterations = n;
reset_timer();
start_timer();
d_benchmark.get_func()(this);
stop_timer();
}
void run_parallel(std::function<void(parallel_context*)> f) {
parallel_context pc(d_num_iterations);
std::vector<std::thread> threads;
for (size_t i = 0; i < d_num_threads; ++i) {
threads.push_back(std::thread([&pc,&f]() -> void {
f(&pc);
}));
}
for(auto& thread : threads){
thread.join();
}
}
result run() {
size_t n = 1;
run_n(n);
while (d_duration < d_benchtime && n < 1e9) {
size_t last = n;
if (get_ns_per_op() == 0) {
n = 1e9;
} else {
n = d_duration.count() / get_ns_per_op();
}
n = std::max(std::min(n+n/2, 100*last), last+1);
n = round_up(n);
run_n(n);
}
return result(n, d_duration, d_num_bytes);
}
private:
template<typename T>
T round_down_10(T n) {
int tens = 0;
while (n > 10) {
n /= 10;
tens++;
}
int result = 1;
for (int i = 0; i < tens; ++i) {
result *= 10;
}
return result;
}
template<typename T>
T round_up(T n) {
T base = round_down_10(n);
if (n < (2 * base)) {
return 2 * base;
}
if (n < (5 * base)) {
return 5 * base;
}
return 10 * base;
}
};
/*
* The run_benchmarks function will run the registered benchmarks.
*/
void run_benchmarks(const options& opts) {
std::regex match_r(opts.get_bench());
auto benchmarks = registration::get_ptr()->get_benchmarks();
for (auto& info : benchmarks) {
if (std::regex_match(info.get_name(), match_r)) {
context c(info, opts);
auto r = c.run();
std::cout << std::setw(35) << std::left << info.get_name() << r.to_string() << std::endl;
}
}
}
} // namespace benchpress
/*
* If BENCHPRESS_CONFIG_MAIN is defined when the file is included then a main function will be emitted which provides a
* command-line parser and then executes run_benchmarks.
*/
#ifdef BENCHPRESS_CONFIG_MAIN
#include "cxxopts.hpp"
benchpress::registration* benchpress::registration::d_this;
int main(int argc, char** argv) {
std::chrono::high_resolution_clock::time_point bp_start = std::chrono::high_resolution_clock::now();
benchpress::options bench_opts;
try {
cxxopts::Options cmd_opts(argv[0], " - command line options");
cmd_opts.add_options()
("bench", "run benchmarks matching the regular expression", cxxopts::value<std::string>()
->default_value(".*"))
("benchtime", "run enough iterations of each benchmark to take t seconds", cxxopts::value<size_t>()
->default_value("1"))
("cpu", "specify the number of threads to use for parallel benchmarks", cxxopts::value<size_t>()
->default_value(std::to_string(std::thread::hardware_concurrency())))
("help", "print help")
;
cmd_opts.parse(argc, argv);
if (cmd_opts.count("help")) {
std::cout << cmd_opts.help({""}) << std::endl;
exit(0);
}
if (cmd_opts.count("bench")) {
bench_opts.bench(cmd_opts["bench"].as<std::string>());
}
if (cmd_opts.count("benchtime")) {
bench_opts.benchtime(cmd_opts["benchtime"].as<size_t>());
}
if (cmd_opts.count("cpu")) {
bench_opts.cpu(cmd_opts["cpu"].as<size_t>());
}
} catch (const cxxopts::OptionException& e) {
std::cout << "error parsing options: " << e.what() << std::endl;
exit(1);
}
benchpress::run_benchmarks(bench_opts);
float duration = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::high_resolution_clock::now() - bp_start
).count() / 1000.f;
std::cout << argv[0] << " " << duration << "s" << std::endl;
return 0;
}
#endif
#endif // BENCHPRESS_HPP

1312
resources/3rdparty/modernjson/benchmarks/cxxopts.hpp
File diff suppressed because it is too large
View File

1
resources/3rdparty/modernjson/benchmarks/files/jeopardy/jeopardy.json.REMOVED.git-id

@ -1 +0,0 @@
a533fde78ce50a11f6189907f9e0392095222fe2

9
resources/3rdparty/modernjson/benchmarks/files/nativejson-benchmark/canada.json
File diff suppressed because it is too large
View File

50469
resources/3rdparty/modernjson/benchmarks/files/nativejson-benchmark/citm_catalog.json
File diff suppressed because it is too large
View File

15482
resources/3rdparty/modernjson/benchmarks/files/nativejson-benchmark/twitter.json
File diff suppressed because it is too large
View File

317
resources/3rdparty/modernjson/doc/Doxyfile

@ -1,317 +0,0 @@
# Doxyfile 1.8.9.1
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "JSON for Modern C++"
PROJECT_NUMBER = 2.0.0
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = NO
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = YES
TAB_SIZE = 4
ALIASES = "complexity=@par Complexity\n"
ALIASES += liveexample{2}="@par Example\n \1 \n @includelineno \2.cpp \n Output (play with this example @htmlinclude \2.link):\n @verbinclude \2.output \n The example code above can be translated with @verbatim g++ -std=c++11 -Isrc doc/examples/\2.cpp -o \2 @endverbatim"
ALIASES += requirement="@par Requirements\n"
ALIASES += exceptionsafety="@par Exception safety\n"
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
AUTOLINK_SUPPORT = NO
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_PACKAGE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = YES
SORT_MEMBERS_CTORS_1ST = YES
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
SHOW_FILES = NO
SHOW_NAMESPACES = NO
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/json.hpp index.md
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS = nlohmann::anonymous_namespace
EXAMPLE_PATH = examples
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = images
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE = index.md
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = NO
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET = css/mylayout.css
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = YES
HTML_DYNAMIC_SECTIONS = YES
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = YES
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = me.nlohmann.json
DOCSET_PUBLISHER_ID = me.nlohmann
DOCSET_PUBLISHER_NAME = Niels Lohmann
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# Configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = NO
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = YES
UML_LOOK = YES
UML_LIMIT_NUM_FIELDS = 10
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = NO
DIRECTORY_GRAPH = NO
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES

82
resources/3rdparty/modernjson/doc/Makefile

@ -1,82 +0,0 @@
SRCDIR = ../src
all: doxygen
clean:
rm -fr me.nlohmann.json.docset html
##########################################################################
# example files
##########################################################################
# where are the example cpp files
EXAMPLES = $(wildcard examples/*.cpp)
# create output from a stand-alone example file
%.output: %.cpp
make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11"
./$(<:.cpp=) > $@
rm $(<:.cpp=)
# compare created output with current output of the example files
%.test: %.cpp
make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11"
./$(<:.cpp=) > $@
diff $@ $(<:.cpp=.output)
rm $(<:.cpp=) $@
# create links to try the code online
%.link: %.cpp
rm -fr tmp
mkdir tmp
cp $(SRCDIR)/json.hpp tmp
scripts/send_to_wandbox.py tmp $< > $@.tmp
/bin/echo -n "<a target=\"_blank\" href=\"`cat $@.tmp`\"><b>online</b></a>" > $@
rm -fr tmp $@.tmp
# create output from all stand-alone example files
create_output: $(EXAMPLES:.cpp=.output)
create_links: $(EXAMPLES:.cpp=.link)
# check output of all stand-alone example files
check_output: $(EXAMPLES:.cpp=.test)
##########################################################################
# Doxygen HTML documentation
##########################################################################
# create Doxygen documentation
doxygen: create_output create_links
doxygen
gsed -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType &gt;@@g' html/*.html
gsed -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberFloatType,&#160;AllocatorType&#160;&gt;@@g' html/*.html
gsed -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType &gt;@@g' html/*.html
gsed -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType >@@g' html/*.html
upload: clean doxygen check_output
cd html ; ../scripts/git-update-ghpages nlohmann/json
rm -fr html
open http://nlohmann.github.io/json/
##########################################################################
# docset
##########################################################################
# create docset for Dash
docset: create_output
cp Doxyfile Doxyfile_docset
gsed -i 's/DISABLE_INDEX = NO/DISABLE_INDEX = YES/' Doxyfile_docset
gsed -i 's/SEARCHENGINE = YES/SEARCHENGINE = NO/' Doxyfile_docset
gsed -i 's@HTML_EXTRA_STYLESHEET = css/mylayout.css@HTML_EXTRA_STYLESHEET = css/mylayout_docset.css@' Doxyfile_docset
rm -fr html *.docset
doxygen Doxyfile_docset
gsed -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType &gt;@@g' html/*.html
gsed -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberFloatType,&#160;AllocatorType&#160;&gt;@@g' html/*.html
make -C html
mv html/*.docset .
gsed -i 's@<string>doxygen</string>@<string>json</string>@' me.nlohmann.json.docset/Contents/Info.plist
rm -fr Doxyfile_docset html

26
resources/3rdparty/modernjson/doc/css/mylayout.css

@ -1,26 +0,0 @@
/* hide lengthy template information */
.memtemplate, .memTemplParams {
display: none;
}
/* allow compiler information to wrap */
/* https://css-tricks.com/snippets/css/make-pre-text-wrap/ */
pre.fragment {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
td.paramname {
vertical-align: top;
}
.ok_green {
background-color: #89C35C;
}
.nok_throws {
background-color: #ffa500;
}

27
resources/3rdparty/modernjson/doc/css/mylayout_docset.css

@ -1,27 +0,0 @@
.memtemplate {
display: none;
}
.memTemplParams {
display: none;
}
.navtab {
display: none;
}
#top, .footer {
display: none;
}
td.paramname {
vertical-align: top;
}
.ok_green {
background-color: #89C35C;
}
.nok_throws {
background-color: #ffa500;
}

36
resources/3rdparty/modernjson/doc/examples/README.cpp

@ -1,36 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON object
json j =
{
{"pi", 3.141},
{"happy", true},
{"name", "Niels"},
{"nothing", nullptr},
{
"answer", {
{"everything", 42}
}
},
{"list", {1, 0, 2}},
{
"object", {
{"currency", "USD"},
{"value", 42.99}
}
}
};
// add new values
j["new"]["key"]["value"] = {"another", "list"};
// count elements
j["size"] = j.size();
// pretty print with indent of 4 spaces
std::cout << std::setw(4) << j << '\n';
}

1
resources/3rdparty/modernjson/doc/examples/README.link

@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/fYyscqrsQFtgUePA"><b>online</b></a>

27
resources/3rdparty/modernjson/doc/examples/README.output

@ -1,27 +0,0 @@
{
"answer": {
"everything": 42
},
"happy": true,
"list": [
1,
0,
2
],
"name": "Niels",
"new": {
"key": {
"value": [
"another",
"list"
]
}
},
"nothing": null,
"object": {
"currency": "USD",
"value": 42.99
},
"pi": 3.141,
"size": 9
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save