├── .gitignore
├── LICENSE
├── NOTICE
├── README.md
├── README.txt
├── doc
├── allclasses-index.html
├── allpackages-index.html
├── constant-values.html
├── deprecated-list.html
├── deprecated
│ ├── HeavyTailPointProcess.html
│ ├── class-use
│ │ └── HeavyTailPointProcess.html
│ ├── package-summary.html
│ ├── package-tree.html
│ └── package-use.html
├── element-list
├── fractalRabbitGenerator
│ ├── MainClassFR.html
│ ├── class-use
│ │ └── MainClassFR.html
│ ├── package-summary.html
│ ├── package-tree.html
│ └── package-use.html
├── help-doc.html
├── index-files
│ ├── index-1.html
│ ├── index-10.html
│ ├── index-11.html
│ ├── index-12.html
│ ├── index-13.html
│ ├── index-14.html
│ ├── index-15.html
│ ├── index-16.html
│ ├── index-17.html
│ ├── index-18.html
│ ├── index-19.html
│ ├── index-2.html
│ ├── index-20.html
│ ├── index-21.html
│ ├── index-22.html
│ ├── index-23.html
│ ├── index-3.html
│ ├── index-4.html
│ ├── index-5.html
│ ├── index-6.html
│ ├── index-7.html
│ ├── index-8.html
│ └── index-9.html
├── index.html
├── jquery-ui.overrides.css
├── legal
│ ├── ADDITIONAL_LICENSE_INFO
│ ├── ASSEMBLY_EXCEPTION
│ ├── LICENSE
│ ├── jquery.md
│ └── jqueryUI.md
├── member-search-index.js
├── module-search-index.js
├── overview-summary.html
├── overview-tree.html
├── package-search-index.js
├── resources
│ ├── glass.png
│ └── x.png
├── script-dir
│ ├── images
│ │ ├── ui-bg_glass_55_fbf9ee_1x400.png
│ │ ├── ui-bg_glass_65_dadada_1x400.png
│ │ ├── ui-bg_glass_75_dadada_1x400.png
│ │ ├── ui-bg_glass_75_e6e6e6_1x400.png
│ │ ├── ui-bg_glass_95_fef1ec_1x400.png
│ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png
│ │ ├── ui-icons_222222_256x240.png
│ │ ├── ui-icons_2e83ff_256x240.png
│ │ ├── ui-icons_454545_256x240.png
│ │ ├── ui-icons_888888_256x240.png
│ │ └── ui-icons_cd0a0a_256x240.png
│ ├── jquery-3.5.1.min.js
│ ├── jquery-ui.min.css
│ ├── jquery-ui.min.js
│ └── jquery-ui.structure.min.css
├── script.js
├── search.js
├── simulatorTests
│ ├── AgoraphobicPointsTest.html
│ ├── AgoraphobicPointsWriter.html
│ ├── class-use
│ │ ├── AgoraphobicPointsTest.html
│ │ └── AgoraphobicPointsWriter.html
│ ├── package-summary.html
│ ├── package-tree.html
│ └── package-use.html
├── simulators
│ ├── AgoraphobicPoints.html
│ ├── Retropreferential.html
│ ├── SporadicReporter.html
│ ├── class-use
│ │ ├── AgoraphobicPoints.html
│ │ ├── Retropreferential.html
│ │ └── SporadicReporter.html
│ ├── package-summary.html
│ ├── package-tree.html
│ └── package-use.html
├── stylesheet.css
├── tag-search-index.js
├── type-search-index.js
├── utilities
│ ├── CensoredMultinomialTrial.html
│ ├── EuclideanPoint.html
│ ├── HeavyTailPointProcess.html
│ ├── HeavyTailedPartialSums.html
│ ├── IrregularBinAssignment.html
│ ├── Metrizable.html
│ ├── ParameterCSVReader.html
│ ├── PoissonVariate.html
│ ├── ReweightedMultinomialTrial.html
│ ├── ScatterPlotInputData.html
│ ├── SpacePointGenerator.html
│ ├── class-use
│ │ ├── CensoredMultinomialTrial.html
│ │ ├── EuclideanPoint.html
│ │ ├── HeavyTailPointProcess.html
│ │ ├── HeavyTailedPartialSums.html
│ │ ├── IrregularBinAssignment.html
│ │ ├── Metrizable.html
│ │ ├── ParameterCSVReader.html
│ │ ├── PoissonVariate.html
│ │ ├── ReweightedMultinomialTrial.html
│ │ ├── ScatterPlotInputData.html
│ │ └── SpacePointGenerator.html
│ ├── package-summary.html
│ ├── package-tree.html
│ └── package-use.html
└── utilityTests
│ ├── BetaInverseCDFTest.html
│ ├── CensoredMultinomialTest.html
│ ├── EuclideanPointTest.html
│ ├── HeavyTailPointProcessTest.html
│ ├── HeavyTailedPartialSumsTest.html
│ ├── IrregularBinTest.html
│ ├── ParameterCSVReader.html
│ ├── PoissonVariateTest.html
│ ├── ReweightedMultinomialTest.html
│ ├── SpacePointTest.html
│ ├── class-use
│ ├── BetaInverseCDFTest.html
│ ├── CensoredMultinomialTest.html
│ ├── EuclideanPointTest.html
│ ├── HeavyTailPointProcessTest.html
│ ├── HeavyTailedPartialSumsTest.html
│ ├── IrregularBinTest.html
│ ├── ParameterCSVReader.html
│ ├── PoissonVariateTest.html
│ ├── ReweightedMultinomialTest.html
│ └── SpacePointTest.html
│ ├── package-summary.html
│ ├── package-tree.html
│ └── package-use.html
├── pom.xml
├── resources
├── Rabbit-CreativeCommonsImage..jpg
└── parameters.csv
├── src
├── main
│ └── java
│ │ ├── fractalRabbitGenerator
│ │ ├── MainClassFR.java
│ │ └── package-info.java
│ │ ├── simulators
│ │ ├── AgoraphobicPoints.java
│ │ ├── Retropreferential.java
│ │ ├── SporadicReporter.java
│ │ └── package-info.java
│ │ └── utilities
│ │ ├── CensoredMultinomialTrial.java
│ │ ├── EuclideanPoint.java
│ │ ├── HeavyTailPointProcess.java
│ │ ├── HeavyTailedPartialSums.java
│ │ ├── IrregularBinAssignment.java
│ │ ├── Metrizable.java
│ │ ├── PoissonVariate.java
│ │ ├── ReweightedMultinomialTrial.java
│ │ ├── ScatterPlotInputData.java
│ │ ├── SpacePointGenerator.java
│ │ └── package-info.java
└── test
│ └── java
│ ├── simulatorTests
│ ├── AgoraphobicPointsTest.java
│ ├── AgoraphobicPointsWriter.java
│ └── package-info.java
│ └── utilityTests
│ ├── BetaInverseCDFTest.java
│ ├── CensoredMultinomialTest.java
│ ├── EuclideanPointTest.java
│ ├── HeavyTailPointProcessTest.java
│ ├── HeavyTailedPartialSumsTest.java
│ ├── IrregularBinTest.java
│ ├── ParameterCSVReader.java
│ ├── PoissonVariateTest.java
│ ├── ReweightedMultinomialTest.java
│ ├── SpacePointTest.java
│ └── package-info.java
└── target
├── classes
├── simulators
│ └── SporadicReporter.class
└── utilities
│ ├── HeavyTailedPartialSums.class
│ └── IrregularBinAssignment.class
└── test-classes
└── utilityTests
├── HeavyTailPointProcessTest.class
└── IrregularBinTest.class
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | target
3 | *.class
4 | .project
5 | .settings
6 | .classpath
7 | *.swp
8 | *.iml
9 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Portions of this software are not subject to copyright protections
2 | under U.S. copyright law, and are considered "Public Domain".
3 |
4 | Please see
5 | https://en.wikipedia.org/wiki/Copyright_status_of_works_by_the_federal_government_of_the_United_States
6 |
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
8 | In modelling a sequence of adaptive choices by an intelligent agent (e.g. places visited, web sites browsed), memory-less random walks are unsuitable, because of the formation of agent habits and preferences.
9 |
10 |
11 |
12 | Often these choices are only partially observed, and report times are sporadic and bursty, in contrast to regular or exponentially spaced times in classical models.
13 |
14 |
15 |
16 | The FRACTALRABBIT stochastic mobility simulator creates realistic synthetic sporadic waypoint data sets. It consist of three tiers, each based on new stochastic models:
17 |
18 |
19 | (1) An Agoraphobic Point Process generates a set V of space points, whose limit is a random fractal, representing sites that could be visited.
20 |
21 | (2) A Retro-preferential Process generates a trajectory X through V , with strategic homing and self-reinforcing site fidelity as observed in human/animal behavior.
22 |
23 | (3) A Sporadic Reporting Process models time points T at which the trajectory X is observed, with bursts of reports and heavy tailed inter-event times.
24 |
25 |
26 |
27 | FRACTALRABBIT can be used to test algorithms applicable to sporadic waypoint data, such as (1) co-travel mining, (2) anomaly detection, and (3) extraction of maximal self-consistent subsets of corrupted data.
28 |
30 | Reference: R. W. R. Darling, "Retro-preferential Stochastic Mobility Models on Random Fractals Under Sporadic Observations",
31 | DOI: 10.13140/RG.2.2.15267.40489 , 2018
32 |
52 | An example of the parameters.csv file is provided in the resources folder.
53 | Change it to suit your modelling needs.
54 | It permits multiple travellers to follow the same trajectory asynchronously.
55 |
56 |
57 | ## Bugs and feature requests
58 | - Have a bug or a feature request? Contact Github user bbux-atg
59 |
60 | ## Documentation
61 | - See version 2
7 | only ("GPL2"), with the following clarification and special exception.
8 |
9 | Linking this OpenJDK Code statically or dynamically with other code
10 | is making a combined work based on this library. Thus, the terms
11 | and conditions of GPL2 cover the whole combination.
12 |
13 | As a special exception, Oracle gives you permission to link this
14 | OpenJDK Code with certain code licensed by Oracle as indicated at
15 | http://openjdk.java.net/legal/exception-modules-2007-05-08.html
16 | ("Designated Exception Modules") to produce an executable,
17 | regardless of the license terms of the Designated Exception Modules,
18 | and to copy and distribute the resulting executable under GPL2,
19 | provided that the Designated Exception Modules continue to be
20 | governed by the licenses under which they were offered by Oracle.
21 |
22 | As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
23 | to build an executable that includes those portions of necessary code that
24 | Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
25 | with the Classpath exception). If you modify or add to the OpenJDK code,
26 | that new GPL2 code may still be combined with Designated Exception Modules
27 | if the new code is made subject to this exception by its copyright holder.
28 |
--------------------------------------------------------------------------------
/doc/legal/jquery.md:
--------------------------------------------------------------------------------
1 | ## jQuery v3.5.1
2 |
3 | ### jQuery License
4 | ```
5 | jQuery v 3.5.1
6 | Copyright JS Foundation and other contributors, https://js.foundation/
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining
9 | a copy of this software and associated documentation files (the
10 | "Software"), to deal in the Software without restriction, including
11 | without limitation the rights to use, copy, modify, merge, publish,
12 | distribute, sublicense, and/or sell copies of the Software, and to
13 | permit persons to whom the Software is furnished to do so, subject to
14 | the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be
17 | included in all copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 |
27 | ******************************************
28 |
29 | The jQuery JavaScript Library v3.5.1 also includes Sizzle.js
30 |
31 | Sizzle.js includes the following license:
32 |
33 | Copyright JS Foundation and other contributors, https://js.foundation/
34 |
35 | This software consists of voluntary contributions made by many
36 | individuals. For exact contribution history, see the revision history
37 | available at https://github.com/jquery/sizzle
38 |
39 | The following license applies to all parts of this software except as
40 | documented below:
41 |
42 | ====
43 |
44 | Permission is hereby granted, free of charge, to any person obtaining
45 | a copy of this software and associated documentation files (the
46 | "Software"), to deal in the Software without restriction, including
47 | without limitation the rights to use, copy, modify, merge, publish,
48 | distribute, sublicense, and/or sell copies of the Software, and to
49 | permit persons to whom the Software is furnished to do so, subject to
50 | the following conditions:
51 |
52 | The above copyright notice and this permission notice shall be
53 | included in all copies or substantial portions of the Software.
54 |
55 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
56 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
57 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
58 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
59 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
60 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
61 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
62 |
63 | ====
64 |
65 | All files located in the node_modules and external directories are
66 | externally maintained libraries used by this software which have their
67 | own licenses; we recommend you read them, as their terms may differ from
68 | the terms above.
69 |
70 | *********************
71 |
72 | ```
73 |
--------------------------------------------------------------------------------
/doc/legal/jqueryUI.md:
--------------------------------------------------------------------------------
1 | ## jQuery UI v1.12.1
2 |
3 | ### jQuery UI License
4 | ```
5 | Copyright jQuery Foundation and other contributors, https://jquery.org/
6 |
7 | This software consists of voluntary contributions made by many
8 | individuals. For exact contribution history, see the revision history
9 | available at https://github.com/jquery/jquery-ui
10 |
11 | The following license applies to all parts of this software except as
12 | documented below:
13 |
14 | ====
15 |
16 | Permission is hereby granted, free of charge, to any person obtaining
17 | a copy of this software and associated documentation files (the
18 | "Software"), to deal in the Software without restriction, including
19 | without limitation the rights to use, copy, modify, merge, publish,
20 | distribute, sublicense, and/or sell copies of the Software, and to
21 | permit persons to whom the Software is furnished to do so, subject to
22 | the following conditions:
23 |
24 | The above copyright notice and this permission notice shall be
25 | included in all copies or substantial portions of the Software.
26 |
27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 |
35 | ====
36 |
37 | Copyright and related rights for sample code are waived via CC0. Sample
38 | code is defined as all source code contained within the demos directory.
39 |
40 | CC0: http://creativecommons.org/publicdomain/zero/1.0/
41 |
42 | ====
43 |
44 | All files located in the node_modules and external directories are
45 | externally maintained libraries used by this software which have their
46 | own licenses; we recommend you read them, as their terms may differ from
47 | the terms above.
48 |
49 | ```
50 |
--------------------------------------------------------------------------------
/doc/module-search-index.js:
--------------------------------------------------------------------------------
1 | moduleSearchIndex = [];updateSearchResults();
--------------------------------------------------------------------------------
/doc/overview-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Generated Documentation (Untitled)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | JavaScript is disabled on your browser.
22 |
23 | index.html
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/doc/package-search-index.js:
--------------------------------------------------------------------------------
1 | packageSearchIndex = [{"l":"All Packages","u":"allpackages-index.html"},{"l":"fractalRabbitGenerator"},{"l":"simulators"},{"l":"simulatorTests"},{"l":"utilities"},{"l":"utilityTests"}];updateSearchResults();
--------------------------------------------------------------------------------
/doc/resources/glass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/resources/glass.png
--------------------------------------------------------------------------------
/doc/resources/x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/resources/x.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-bg_glass_65_dadada_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-bg_glass_65_dadada_1x400.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-bg_glass_75_dadada_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-bg_glass_75_dadada_1x400.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-icons_222222_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-icons_222222_256x240.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-icons_2e83ff_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-icons_2e83ff_256x240.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-icons_454545_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-icons_454545_256x240.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-icons_888888_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-icons_888888_256x240.png
--------------------------------------------------------------------------------
/doc/script-dir/images/ui-icons_cd0a0a_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/doc/script-dir/images/ui-icons_cd0a0a_256x240.png
--------------------------------------------------------------------------------
/doc/script-dir/jquery-ui.structure.min.css:
--------------------------------------------------------------------------------
1 | /*! jQuery UI - v1.12.1 - 2018-12-06
2 | * http://jqueryui.com
3 | * Copyright jQuery Foundation and other contributors; Licensed MIT */
4 |
5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}
--------------------------------------------------------------------------------
/doc/simulatorTests/class-use/AgoraphobicPointsTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class simulatorTests.AgoraphobicPointsTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of simulatorTests.AgoraphobicPointsTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/simulatorTests/class-use/AgoraphobicPointsWriter.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class simulatorTests.AgoraphobicPointsWriter
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of simulatorTests.AgoraphobicPointsWriter
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/simulatorTests/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | simulatorTests
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
57 |
58 |
59 |
62 |
63 | package simulatorTests
64 |
65 |
66 |
67 |
68 |
Classes
69 |
70 |
71 |
72 |
73 |
74 |
Used only for development
75 |
76 |
77 |
78 |
Used only for development
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/doc/simulatorTests/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | simulatorTests Class Hierarchy
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
58 |
59 | Class Hierarchy
60 |
61 | java.lang.Object
62 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/doc/simulatorTests/package-use.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Package simulatorTests
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of simulatorTests
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/simulators/class-use/AgoraphobicPoints.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class simulators.AgoraphobicPoints
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of simulators.AgoraphobicPoints
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/simulators/class-use/Retropreferential.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class simulators.Retropreferential
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of simulators.Retropreferential
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/simulators/class-use/SporadicReporter.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class simulators.SporadicReporter
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of simulators.SporadicReporter
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/simulators/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | simulators
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
57 |
58 |
59 |
62 |
63 | package simulators
64 |
65 |
66 |
67 |
68 |
Classes
69 |
70 |
71 |
72 |
73 |
74 |
Simulates the Agoraphobic Point Process using the Hard Threshold method.
75 |
76 |
77 |
78 |
79 |
80 |
Stochastic embedding of visit sequence in continuous time, followed by
81 | generation of report times, with daily seasonality.
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/doc/simulators/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | simulators Class Hierarchy
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
58 |
59 | Class Hierarchy
60 |
61 | java.lang.Object
62 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/doc/simulators/package-use.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Package simulators
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of simulators
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/tag-search-index.js:
--------------------------------------------------------------------------------
1 | tagSearchIndex = [{"l":"Constant Field Values","h":"","u":"constant-values.html"}];updateSearchResults();
--------------------------------------------------------------------------------
/doc/type-search-index.js:
--------------------------------------------------------------------------------
1 | typeSearchIndex = [{"p":"simulators","l":"AgoraphobicPoints"},{"p":"simulatorTests","l":"AgoraphobicPointsTest"},{"p":"simulatorTests","l":"AgoraphobicPointsWriter"},{"l":"All Classes and Interfaces","u":"allclasses-index.html"},{"p":"utilityTests","l":"BetaInverseCDFTest"},{"p":"utilityTests","l":"CensoredMultinomialTest"},{"p":"utilities","l":"CensoredMultinomialTrial"},{"p":"utilities","l":"EuclideanPoint"},{"p":"utilityTests","l":"EuclideanPointTest"},{"p":"utilities","l":"HeavyTailedPartialSums"},{"p":"utilityTests","l":"HeavyTailedPartialSumsTest"},{"p":"utilities","l":"HeavyTailPointProcess"},{"p":"utilityTests","l":"HeavyTailPointProcessTest"},{"p":"utilities","l":"IrregularBinAssignment"},{"p":"utilityTests","l":"IrregularBinTest"},{"p":"fractalRabbitGenerator","l":"MainClassFR"},{"p":"utilities","l":"Metrizable"},{"p":"utilityTests","l":"ParameterCSVReader"},{"p":"utilities","l":"PoissonVariate"},{"p":"utilityTests","l":"PoissonVariateTest"},{"p":"simulators","l":"Retropreferential"},{"p":"utilityTests","l":"ReweightedMultinomialTest"},{"p":"utilities","l":"ReweightedMultinomialTrial"},{"p":"utilities","l":"ScatterPlotInputData"},{"p":"utilities","l":"SpacePointGenerator"},{"p":"utilityTests","l":"SpacePointTest"},{"p":"simulators","l":"SporadicReporter"}];updateSearchResults();
--------------------------------------------------------------------------------
/doc/utilities/class-use/CensoredMultinomialTrial.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.CensoredMultinomialTrial
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilities.CensoredMultinomialTrial
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilities/class-use/EuclideanPoint.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.EuclideanPoint
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilities.EuclideanPoint
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilities/class-use/HeavyTailPointProcess.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.HeavyTailPointProcess
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilities.HeavyTailPointProcess
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilities/class-use/HeavyTailedPartialSums.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.HeavyTailedPartialSums
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilities.HeavyTailedPartialSums
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilities/class-use/IrregularBinAssignment.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.IrregularBinAssignment
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilities.IrregularBinAssignment
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilities/class-use/ParameterCSVReader.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.ParameterCSVReader
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilities.ParameterCSVReader
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilities/class-use/PoissonVariate.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.PoissonVariate
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilities.PoissonVariate
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilities/class-use/ScatterPlotInputData.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.ScatterPlotInputData
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilities.ScatterPlotInputData
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilities/class-use/SpacePointGenerator.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilities.SpacePointGenerator
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 |
55 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/BetaInverseCDFTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.BetaInverseCDFTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.BetaInverseCDFTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/CensoredMultinomialTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.CensoredMultinomialTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.CensoredMultinomialTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/EuclideanPointTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.EuclideanPointTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.EuclideanPointTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/HeavyTailPointProcessTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.HeavyTailPointProcessTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.HeavyTailPointProcessTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/HeavyTailedPartialSumsTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.HeavyTailedPartialSumsTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.HeavyTailedPartialSumsTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/IrregularBinTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.IrregularBinTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.IrregularBinTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/ParameterCSVReader.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.ParameterCSVReader
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.ParameterCSVReader
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/PoissonVariateTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.PoissonVariateTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.PoissonVariateTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/ReweightedMultinomialTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.ReweightedMultinomialTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.ReweightedMultinomialTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/class-use/SpacePointTest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Class utilityTests.SpacePointTest
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests.SpacePointTest
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/doc/utilityTests/package-use.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Uses of Package utilityTests
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 | JavaScript is disabled on your browser.
23 |
24 |
25 |
49 |
50 |
51 |
54 | No usage of utilityTests
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 | gov.nsa
6 | fractalrabbit
7 | 1.0
8 | mobility data generator
9 |
10 |
11 | UTF-8
12 |
13 |
14 |
15 |
16 | org.apache.commons
17 | commons-math3
18 | 3.6.1
19 |
20 |
21 |
22 |
23 | com.google.guava
24 | guava
25 | 33.1.0-jre
26 |
27 |
28 | org.apache.commons
29 | commons-csv
30 | 1.9.0
31 |
32 |
33 | org.knowm.xchart
34 | xchart
35 | 3.8.1
36 |
37 |
38 | org.knowm.xchart
39 | xchart-demo
40 | 3.8.1
41 |
42 |
43 | org.apache.maven.plugins
44 | maven-compiler-plugin
45 | 3.8.1
46 |
47 |
48 | org.apache.maven.plugins
49 | maven-resources-plugin
50 | 3.1.0
51 |
52 |
53 |
54 |
55 |
56 |
57 | org.apache.maven.plugins
58 | maven-jar-plugin
59 | 3.3.0
60 |
61 |
62 |
63 | true
64 | lib/
65 | main.MainClassFR
66 |
67 |
68 |
69 |
74 |
75 |
76 | org.apache.maven.plugins
77 | maven-compiler-plugin
78 | 3.11.0
79 |
80 | 21
81 | 21
82 |
83 |
84 |
85 |
86 | org.apache.maven.plugins
87 | maven-assembly-plugin
88 | 3.6.0
89 |
90 |
91 | package
92 |
93 | single
94 |
95 |
96 |
97 |
98 |
99 | main.MainClassFR
100 |
101 |
102 |
103 |
104 | jar-with-dependencies
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/resources/Rabbit-CreativeCommonsImage..jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/resources/Rabbit-CreativeCommonsImage..jpg
--------------------------------------------------------------------------------
/resources/parameters.csv:
--------------------------------------------------------------------------------
1 | space dimension, 2
2 | fractal dimension, 1.33
3 | number of points, 5000
4 | number of travellers, 3000
5 | number of co-travellers, 1
6 | number of days, 14.0
7 | number of reports, 200.0
8 |
--------------------------------------------------------------------------------
/src/main/java/fractalRabbitGenerator/package-info.java:
--------------------------------------------------------------------------------
1 | package fractalRabbitGenerator;
--------------------------------------------------------------------------------
/src/main/java/simulators/package-info.java:
--------------------------------------------------------------------------------
1 | package simulators;
--------------------------------------------------------------------------------
/src/main/java/utilities/CensoredMultinomialTrial.java:
--------------------------------------------------------------------------------
1 |
2 | package utilities;
3 |
4 | import java.util.Arrays;
5 | import java.util.Random;
6 |
7 | /**
8 | * Sample one of the categories: {0,1,2,... n-1}. Two vectors are used:
9 | *
10 | * (1) rates r[0], r[1], ..., r[n-1], all non-negative doubles,
11 | *
12 | * (2) boolean vector showing which states are allowed.
13 | *
14 | * In application, allowed states will be UNVISITED states.
15 | *
16 | * @author rwdarli
17 | *
18 | */
19 | public class CensoredMultinomialTrial {
20 |
21 | private Random g;
22 | private final int dimension;
23 | /*
24 | * unnormalized probability vector of given dimension, different each time
25 | * sampling occurs
26 | */
27 | private double[] q;
28 |
29 | /**
30 | *
31 | * @param n number of outcomes of a multinomial trial
32 | */
33 | public CensoredMultinomialTrial(int n) {
34 | g = new Random();
35 | this.dimension = n;
36 | this.q = new double[this.dimension];
37 | }
38 |
39 | /**
40 | *
41 | * @param r vector of unnormalized rates
42 | * @param u boolean array, where u[j] true means j has been visited, hence
43 | * unavailable for sampling
44 | * @return an index from 0 to n-1. The index i is returned when
45 | *
46 | *
47 | * q[0] + ... + q[i-1] ≤ threshold ≨ q[0] + ... + q[i]
48 | *
49 | *
50 | * @throws IllegalArgumentException
51 | */
52 | public int sample(double[] r, boolean[] u) throws IllegalArgumentException {
53 | if (!(r.length == this.dimension) | !(u.length == this.dimension)) {
54 | throw new IllegalArgumentException(" Dimensions do not match");
55 | } else {
56 | Arrays.setAll(this.q, i -> u[i] ? 0.0 : r[i]); // rate is zero if u[i] is true
57 | // Multinomial sampling: generate threshold uniformly in (0, rateSum)
58 | double rateSum = Arrays.stream(this.q).sum();
59 | double threshold = rateSum * this.g.nextDouble();
60 | int index = 0;
61 | double rateAdder = this.q[0];
62 | //
63 | while (rateAdder < threshold) {
64 | index++;
65 | rateAdder += this.q[index];
66 | }
67 | return index;
68 | }
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/utilities/EuclideanPoint.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Point in a Euclidean metric space.
3 | * Passed tests 8.9.18
4 | */
5 | package utilities;
6 |
7 | /**
8 | * @author rwdarli
9 | *
10 | */
11 | public class EuclideanPoint implements Metrizable {
12 |
13 | double[] point;
14 | int dimension;
15 | public EuclideanPoint(double[] p) {
16 | this.point = p;
17 | this.dimension = p.length;
18 | }
19 |
20 | /* (non-Javadoc)
21 | * @see utilities.Metrizable#distanceTo(utilities.Metrizable)
22 | */
23 | @Override
24 | public double distanceTo(Metrizable o) {
25 | if(o.getClass()==this.getClass()) {
26 | EuclideanPoint q = (EuclideanPoint)o;
27 | double sumdiff2 = 0.0;
28 | double z;
29 | for (int i = 0; i < this.dimension; i++) {
30 | z = this.point[i] - q.point[i];
31 | sumdiff2 += z * z;
32 | }
33 | return (Math.sqrt(sumdiff2));
34 | } else {
35 | return Double.NaN;
36 | }
37 |
38 | }
39 | @Override
40 | /*
41 | * (non-Javadoc)
42 | * @see utilities.Metrizable#equals(utilities.Metrizable)
43 | * equality means distance is zero up to machine precision
44 | */
45 | public boolean equals(Metrizable o) {
46 | if(this.distanceTo(o) < Math.ulp(1.0)) {
47 | return true;
48 | }
49 | else return false;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/utilities/HeavyTailPointProcess.java:
--------------------------------------------------------------------------------
1 |
2 | package utilities;
3 |
4 | import java.util.ArrayList;
5 | import java.util.Arrays;
6 | import java.util.List;
7 | import java.util.Random;
8 |
9 | /**
10 | * Generates truncated Pareto random variables, X:=U^alpha, U~Uniform(u0,
11 | * u1), where alpha < -1 Cumulative sums give a Point Process with
12 | * heavy-tailed inter-arrival times.
13 | *
14 | * @author rwdarli
15 | *
16 | */
17 | public class HeavyTailPointProcess {
18 |
19 | private Random g;
20 | public HeavyTailPointProcess() {
21 | g = new Random();
22 | }
23 |
24 | /**
25 | *
26 | * @param duration upper bound for last arrival
27 | * @param lo least time between distinct events
28 | * @param hi maximum time between distinct events
29 | * @param alpha less than minus 1.0; t^alpha is tail probability, up to
30 | * cut-off
31 | * @return time series whose inter-event times are truncated Pareto random
32 | * variables
33 | */
34 | public double[] generate(double duration, double lo, double hi, double alpha) {
35 | /*
36 | * Set upper and lower bounds for uniform sampling
37 | */
38 | double u0 = Math.pow(hi, 1.0 / alpha); // hi gives LOWER bound on U
39 | double u1 = Math.pow(lo, 1.0 / alpha); // lo gives UPPER bound on U
40 | List timeSeries = new ArrayList<>();
41 | double lastTime = 0.0;
42 | double eta; // increment
43 | while (lastTime < duration) {
44 | eta = Math.pow(u0 + (u1 - u0) * g.nextDouble(), alpha); // truncated Pareto
45 | lastTime += eta;
46 | timeSeries.add(lastTime);
47 | }
48 | double[] x = new double[timeSeries.size() - 1]; // skip last time, which exceeds bound
49 | Arrays.setAll(x, j -> timeSeries.get(j));
50 | return x;
51 | }
52 |
53 | /**
54 | *
55 | * paretoMean: (Math.pow(u0, c) - Math.pow(u1, c)) / ((-1.0 - alpha) *(u1 -
56 | * u0)); with c = 1.0 + alpha; Expect 1.0 / paretoMean events per day.
57 | *
58 | * @param lo least time between distinct events
59 | * @param hi maximum time between distinct events
60 | * @param alpha less than minus 1.0; t^alpha is tail probability, up to cut-off
61 | * @return mean rate
62 | */
63 | public double meanRate(double lo, double hi, double alpha) {
64 | double u0 = Math.pow(hi, 1.0 / alpha); // hi gives LOWER bound on U
65 | double u1 = Math.pow(lo, 1.0 / alpha);
66 | double c = 1.0 + alpha;
67 | double paretoMean = (Math.pow(u0, c) - Math.pow(u1, c)) / ((-1.0 - alpha) * (u1 - u0));
68 | return paretoMean;
69 | }
70 |
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/utilities/HeavyTailedPartialSums.java:
--------------------------------------------------------------------------------
1 |
2 | package utilities;
3 |
4 | import java.util.Arrays;
5 | import java.util.List;
6 | import java.util.Random;
7 | import java.util.function.DoubleBinaryOperator;
8 | import java.util.stream.Collectors;
9 |
10 | /**
11 | *
12 | * Generates partial sums (Y_1 + ... + Y_r)/S, where S = Y_1 + ... + Y_m and the
13 | * Y_i are i.i.d. truncated Pareto in the range (delta, 1]. Tail exponent of
14 | * Pareto is alpha.
15 | *
16 | * Suggested parameters: delta = 0.001; alpha = -1.5
17 | *
18 | * This class replaces HeavyTailPointProcess
19 | *
20 | * @author rwdarli
21 | *
22 | */
23 | public class HeavyTailedPartialSums {
24 | private Random g;
25 |
26 | public HeavyTailedPartialSums() {
27 | g = new Random();
28 | }
29 |
30 | /**
31 | *
32 | * @param size dimension of vector to be returned
33 | * @param delta least time between distinct events, greater than zero
34 | * @param alpha tail exponent for (truncated) Pareto law, less than minus 1
35 | *
36 | * Maximum time between distinct events can be taken as 1.0.
37 | * @return increasing sequence of partial sums of Pareto random random
38 | * variables, divided by total sum.
39 | */
40 | public List generate(int size, double delta, double alpha) {
41 | /*
42 | * Set upper bound for uniform sampling
43 | */
44 | double u1 = Math.pow(delta, 1.0 / alpha); // u1 > 1 since alpha < 0
45 | // Simulate truncated Pareto random variables
46 | double[] y = g.doubles(size + 1).boxed().mapToDouble(x -> Math.pow(1.0 + (u1 - 1.0) * x, alpha)).toArray();
47 | // Partial sums
48 | DoubleBinaryOperator partialSum = (y1, y2) -> y1 + y2;
49 | Arrays.parallelPrefix(y, partialSum);
50 | double sum = y[size]; // this index exists!
51 | // drop last value which must be 1.0
52 | return Arrays.stream(y).limit(size).boxed().map(z -> z / sum).collect(Collectors.toList());
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/utilities/IrregularBinAssignment.java:
--------------------------------------------------------------------------------
1 | package utilities;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | *
8 | * Suppose a[0] < a[1] < ... < a[n] are stored in a sorted list a ("bin boundaries")
9 | * Suppose b[0] ≤ b[1] ≤ ... ≤ b[m-1] are such that a[0] ≤ b[0] and
10 | * b[m-1] < a[n] Refer to the interval [a[i-1], a[i]) as bin i-1. Consider the
11 | * b[j] as "observations" to be placed in "bins". Construct an int array c of
12 | * length m so that c[j] = k means that b[j] falls in bin k.
13 | *
14 | * @author rwdarli
15 | *
16 | */
17 | public class IrregularBinAssignment {
18 |
19 | private List placements;
20 |
21 | /**
22 | * Constructor
23 | */
24 | public IrregularBinAssignment() {
25 | this.placements = new ArrayList();
26 | }
27 |
28 | /**
29 | * Assigns each observation to the correct bin.
30 | * @param bins list of bins, in ascending order with respect to T.compare()
31 | * @param obs list of observations to be placed in bins
32 | */
33 | public void assign(List bins, List obs) {
34 | this.placements.clear();
35 |
36 | int k = 1; // bin counter
37 | T topBoundary = bins.get(k); // top of first bin
38 | for (T y : obs) {
39 | while (!(y.compareTo(topBoundary) < 0)) {
40 | k++; // possibly some bins may have no observations
41 | topBoundary = bins.get(k);
42 | }
43 | this.placements.add(k - 1);
44 | }
45 |
46 | }
47 |
48 | /**
49 | * @return the list of bin counts, invoking assign()
50 | */
51 | public List getPlacements() {
52 | return placements;
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/utilities/Metrizable.java:
--------------------------------------------------------------------------------
1 |
2 | package utilities;
3 |
4 | /**
5 | *
6 | * @see simulators.Retropreferential
7 | *
8 | * @author rwdarli
9 | *
10 | */
11 | public interface Metrizable {
12 | public double distanceTo(Metrizable o);
13 |
14 | public boolean equals(Metrizable o);
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/utilities/PoissonVariate.java:
--------------------------------------------------------------------------------
1 |
2 | package utilities;
3 |
4 | import java.util.Random;
5 |
6 | /**
7 | * Generator of Poisson random variates
8 | *
9 | * @author rwdarli
10 | *
11 | */
12 | public class PoissonVariate {
13 |
14 | private double lambda;
15 | private Random g;
16 |
17 | /**
18 | *
19 | * @param lam parameter for a Poisson distribution (mean and variance)
20 | */
21 | public PoissonVariate(double lam) {
22 | this.lambda = lam;
23 | this.g = new Random();
24 | }
25 |
26 | /**
27 | *
28 | * @return random variable with specified Poisson distribution
29 | */
30 | public int generate() {
31 | int count = 0;
32 | double sum = 0.0;
33 | while (sum < this.lambda) {
34 | sum -= Math.log(g.nextDouble());
35 | count++;
36 | }
37 | return count;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/utilities/ReweightedMultinomialTrial.java:
--------------------------------------------------------------------------------
1 |
2 | package utilities;
3 |
4 | import java.util.HashMap;
5 | import java.util.Map;
6 | import java.util.Random;
7 | import java.util.Set;
8 |
9 | /**
10 | * Sample from a (small) set of states, weighted according to rate times
11 | * frequency
12 | *
13 | * @see simulators.Retropreferential
14 | *
15 | * @author rwdarli
16 | *
17 | */
18 | public class ReweightedMultinomialTrial {
19 |
20 | private Random g;
21 | // For integer k < n, g.get(k) will be an unnormalized rate of transition to k
22 | private Map q;
23 |
24 | /**
25 | * Constructor
26 | */
27 | public ReweightedMultinomialTrial() {
28 | g = new Random();
29 | this.q = new HashMap();
30 | }
31 |
32 | /**
33 | *
34 | * @param places subset of {0, 1, ..., n-1}
35 | * @param r vector of unnormalized rates, indices from 0 to n-1
36 | * @param f vector of visit frequencies, indices from 0 to n-1
37 | * @return Integer sampled from places, weighted according to rate times
38 | * frequency
39 | * @throws IllegalArgumentException
40 | */
41 | public Integer sample(Set places, double[] r, double[] f) throws IllegalArgumentException {
42 | if (!(r.length == f.length)) {
43 | throw new IllegalArgumentException(" Dimensions do not match");
44 | } else {
45 | this.q.clear();
46 | for (Integer k : places) {
47 | this.q.put(k, f[k] * r[k]); // weighting of rates by visit frequencies
48 | }
49 | // Multinomial sampling: generate threshold uniformly in (0, rateSum)
50 | double rateSum = this.q.values().stream().reduce(0.0, Double::sum);
51 | double threshold = rateSum * this.g.nextDouble();
52 | double rateAdder = 0.0;
53 | Integer index = Integer.MIN_VALUE;
54 | /*
55 | * Main point of this class is that this loop covers O(sqrt(n)) steps, not O(n),
56 | * for the classic retro-preferential process, since places.size() is
57 | * O(sqrt(n)).
58 | */
59 | for (Integer k : this.q.keySet()) {
60 | rateAdder += this.q.get(k);
61 | if (rateAdder > threshold) {
62 | index = k;
63 | break;
64 | }
65 | }
66 | return index;
67 | }
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/java/utilities/ScatterPlotInputData.java:
--------------------------------------------------------------------------------
1 | package utilities;
2 |
3 | import java.util.Arrays;
4 | import java.util.Random;
5 |
6 | import org.knowm.xchart.SwingWrapper;
7 | import org.knowm.xchart.XYChart;
8 | import org.knowm.xchart.XYChartBuilder;
9 | import org.knowm.xchart.XYSeries.XYSeriesRenderStyle;
10 | import org.knowm.xchart.demo.charts.ExampleChart;
11 | import org.knowm.xchart.style.Styler.LegendPosition;
12 |
13 | /**
14 | * Visualization of fractal point clouds, tested on random data.
15 | * @see org.knowm.xchart.XYChart
16 | * @see simulators.AgoraphobicPoints
17 | * @author rwdarli
18 | *
19 | */
20 | public class ScatterPlotInputData implements ExampleChart {
21 | private double[] x, y;
22 | private String legend;
23 |
24 | public ScatterPlotInputData(String title, double[] xData, double[] yData) {
25 | this.x = xData;
26 | this.y = yData;
27 | this.legend = title;
28 | }
29 |
30 | @Override
31 | public XYChart getChart() {
32 |
33 | // Create Chart
34 | XYChart chart = new XYChartBuilder().width(800).height(600).build();
35 |
36 | // Customize Chart
37 | chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter);
38 | chart.getStyler().setChartTitleVisible(true);
39 | chart.getStyler().setLegendPosition(LegendPosition.InsideSW);
40 | chart.getStyler().setMarkerSize(4);
41 | chart.addSeries(this.legend, this.x, this.y);
42 | return chart;
43 | }
44 |
45 | public String getExampleChartName() {
46 | return "Scatter Plot";
47 | }
48 | /**
49 | *
50 | * @param args args[0] is number of random points to generate in a scatter plot.
51 | */
52 | public static void main(String[] args) {
53 | Random h = new Random();
54 | double[] x = new double[Integer.parseInt(args[0])];
55 | Arrays.setAll(x, (i) -> h.nextDouble());
56 | double[] y = new double[Integer.parseInt(args[0])];
57 | Arrays.setAll(y, (i) -> h.nextDouble());
58 | ScatterPlotInputData scatter = new ScatterPlotInputData("test", x, y);
59 | // ExampleChart exampleChart = new ScatterChart01();
60 | XYChart chart = scatter.getChart();
61 | new SwingWrapper(chart).displayChart();
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/utilities/SpacePointGenerator.java:
--------------------------------------------------------------------------------
1 |
2 | package utilities;
3 |
4 | import java.util.Arrays;
5 | import java.util.Random;
6 | import java.util.function.BiPredicate;
7 | import java.util.function.ToDoubleBiFunction;
8 |
9 | /**
10 | * Utility class for vectors in Euclidean space. Generates a random point in the
11 | * unit disk, and tests equality of two vectors to machine precision.
12 | *
13 | * @author rwdarli
14 | */
15 | public class SpacePointGenerator {
16 | private int d;
17 | private final double[] zerovec;
18 | private Random g;
19 |
20 | /**
21 | * @param dimension of ambient space
22 | */
23 | public SpacePointGenerator(int dimension) {
24 | this.d = dimension;
25 | this.zerovec = new double[this.d]; // all zeros
26 | this.g = new Random();
27 | }
28 |
29 | public double[] zeroVector() {
30 | return this.zerovec;
31 | }
32 |
33 | /**
34 | * Generates uniformly at random a d-dimensional vector in
35 | *
36 | *
37 | * (-1, 1)^d
38 | *
39 | *
40 | * . Repeat until one is found which lies inside unit sphere.
41 | *
42 | * @return random point in unit sphere in dimension d.
43 | */
44 | public double[] samplePointUnitDisk() {
45 | boolean tooBig = true;
46 | double[] y = new double[this.d];
47 | while (tooBig) {
48 | Arrays.setAll(y, (i) -> -1.0 + 2.0 * g.nextDouble());
49 | tooBig = (this.sumSquares(y) > 1.0);
50 | }
51 | return y;
52 | }
53 |
54 | /**
55 | * Given a center point, sample uniformly a point within given radius of center
56 | *
57 | * @param radius radial distance
58 | * @param center center point in dimension d
59 | * @return random point within given radius of center in dimension d.
60 | */
61 | public double[] sampleNearbyPoint(double radius, double[] center) {
62 | double[] y = new double[this.d];
63 | double[] z = this.samplePointUnitDisk();
64 | Arrays.setAll(y, (i) -> center[i] + radius * z[i]);
65 | return y;
66 | }
67 |
68 | /**
69 | *
70 | * @param vector point in dimension d
71 | * @return norm squared
72 | */
73 | public double sumSquares(double[] vector) {
74 | double sum = 0.0;
75 | for (double y : vector) {
76 | sum += y * y;
77 | }
78 | return sum;
79 | }
80 |
81 | /**
82 | *
83 | * @param vector1 point in dimension d
84 | * @param vector2 point in dimension d
85 | * @return distance
86 | */
87 | public static double distance(double[] vector1, double[] vector2) {
88 | if (!(vector1.length == vector2.length)) {
89 | return Double.NaN;
90 | } else {
91 | double sumdiff2 = 0.0;
92 | double z;
93 | for (int i = 0; i < vector1.length; i++) {
94 | z = vector1[i] - vector2[i];
95 | sumdiff2 += z * z;
96 | }
97 | return (Math.sqrt(sumdiff2));
98 | }
99 | }
100 |
101 | /*
102 | * Lambda version of the latter
103 | */
104 | public ToDoubleBiFunction distance = ((v1, v2) -> this.distance(v1, v2));
105 |
106 | /**
107 | *
108 | * @param vector1 point in dimension d
109 | * @param vector2 point in dimension d
110 | * @return Are they equal?
111 | */
112 | public static boolean equalPoints(double[] vector1, double[] vector2) {
113 | /*
114 | * False if dimensions differ, or if the points are a positive distance apart
115 | */
116 | if (!(vector1.length == vector2.length)) {
117 | return false;
118 | } else if (distance(vector1, vector2) > Math.ulp(1.0)) {
119 | return false;
120 | } else {
121 | return true;
122 | }
123 | }
124 |
125 | /*
126 | * Lambda version of
127 | *
128 | * @see equalPoints
129 | */
130 | public BiPredicate equalPoints = ((v1, v2) -> this.equalPoints(v1, v2));
131 | }
132 |
--------------------------------------------------------------------------------
/src/main/java/utilities/package-info.java:
--------------------------------------------------------------------------------
1 | package utilities;
--------------------------------------------------------------------------------
/src/test/java/simulatorTests/AgoraphobicPointsTest.java:
--------------------------------------------------------------------------------
1 | package simulatorTests;
2 | /*
3 | * Tests AgoraphobicPoints and displays 2-d graphic of Agoraphobic Point Process
4 | * Passed April 4, 2018.
5 | */
6 |
7 | import java.util.Arrays;
8 | import org.knowm.xchart.SwingWrapper;
9 | import org.knowm.xchart.XYChart;
10 |
11 | import simulators.AgoraphobicPoints;
12 | import utilities.ScatterPlotInputData;
13 |
14 | /**
15 | * Used only for development
16 | *
17 | * @see simulators.AgoraphobicPoints
18 | */
19 | public class AgoraphobicPointsTest {
20 |
21 | private final int dimension;
22 |
23 | public AgoraphobicPointsTest(int dim) {
24 | this.dimension = dim;
25 | }
26 |
27 | /*
28 | * Graphics
29 | */
30 | public static void main(String[] args) {
31 | int n = 100;
32 | int dim = 2;
33 | double h = 1.33;
34 | double theta = 0.75;
35 | AgoraphobicPointsTest apt = new AgoraphobicPointsTest(dim);
36 | AgoraphobicPoints app = new AgoraphobicPoints(n, apt.dimension, h, theta);
37 | app.generatePoints();
38 | double[] x = new double[n];
39 | Arrays.setAll(x, j -> app.getPoints().get(j)[0]);
40 | double[] y = new double[n];
41 | Arrays.setAll(y, j -> app.getPoints().get(j)[1]);
42 | // Create Scatter Plot
43 | ScatterPlotInputData scatter = new ScatterPlotInputData("Agoraphobic " + h, x, y);
44 | XYChart chartAPP = scatter.getChart();
45 | new SwingWrapper(chartAPP).displayChart();
46 | System.out.println("Sampling efficiency = " + app.getSamplingEfficiency() + " after " + n + " points.");
47 |
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/test/java/simulatorTests/AgoraphobicPointsWriter.java:
--------------------------------------------------------------------------------
1 | package simulatorTests;
2 | /*
3 | * Write CSV file of Agoraphobic Point Process in any dimension
4 | * June 12, 2019.
5 | */
6 |
7 | import java.io.BufferedWriter;
8 | import java.io.IOException;
9 | import java.nio.file.Files;
10 | import java.nio.file.Paths;
11 | import org.apache.commons.csv.CSVFormat;
12 | import org.apache.commons.csv.CSVPrinter;
13 | import simulators.AgoraphobicPoints;
14 |
15 | /**
16 | * Used only for development
17 | *
18 | * @see simulators.AgoraphobicPoints
19 | *
20 | */
21 | public class AgoraphobicPointsWriter {
22 |
23 | final int dimension;
24 |
25 | public AgoraphobicPointsWriter(int dim) {
26 | this.dimension = dim;
27 | }
28 |
29 | public static void main(String[] args) throws IOException {
30 | try {
31 | int n = 100;
32 | int dim = 2;
33 | double h = 1.33;
34 | double theta = 0.75;
35 | String csvOutputFile = "fractaldim-" + h + "-ambient-" + dim + "-size-" + n + ".csv";
36 | AgoraphobicPointsWriter apt = new AgoraphobicPointsWriter(dim);
37 | AgoraphobicPoints app = new AgoraphobicPoints(n, apt.dimension, h, theta);
38 | app.generatePoints();
39 | System.out.println("Sampling efficiency = " + app.getSamplingEfficiency() + " after " + n + " points.");
40 | /*
41 | * Need only format the data as (traveler ID, time, x in km, y in km), and write
42 | * to csv using Apache Commons CSV
43 | */
44 | BufferedWriter writer = Files.newBufferedWriter(Paths.get(csvOutputFile));
45 | CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT.withDelimiter(','));
46 |
47 | int lines = 0;
48 | // Write to file ERROR - repetitions of one report set!
49 |
50 | for (double[] point : app.getPoints()) {
51 | csvPrinter.printRecords(point);
52 | lines++;
53 |
54 | }
55 |
56 | System.out.println("CSV file created with " + lines + " lines, called " + csvOutputFile + ".csv");
57 | csvPrinter.flush();
58 | writer.flush();
59 | csvPrinter.close();
60 | writer.close();
61 |
62 | } catch (IOException ex) {
63 | System.out.println(ex.toString());
64 | System.out.println("Could not find parameter file.");
65 | }
66 |
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/test/java/simulatorTests/package-info.java:
--------------------------------------------------------------------------------
1 | package simulatorTests;
--------------------------------------------------------------------------------
/src/test/java/utilityTests/BetaInverseCDFTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 |
3 | import java.util.Arrays;
4 | import java.util.Random;
5 | import java.util.function.DoubleUnaryOperator;
6 |
7 | import org.apache.commons.math3.distribution.BetaDistribution;
8 |
9 | /**
10 | * Used only for development
11 | * @author rwdarli
12 | * @see simulators.SporadicReporter
13 | */
14 | public class BetaInverseCDFTest {
15 |
16 | private BetaDistribution dist;
17 |
18 | /**
19 | *
20 | * @param alpha parameter of Beta distribution
21 | * @param beta parameter of Beta distribution
22 | */
23 | public BetaInverseCDFTest(double alpha, double beta) {
24 | this.dist = new BetaDistribution(alpha, beta);
25 | }
26 |
27 | /**
28 | * @param args
29 | */
30 | public static void main(String[] args) {
31 | double alpha = 4.17;
32 | double beta = 2.98;
33 | BetaInverseCDFTest test = new BetaInverseCDFTest(alpha, beta);
34 | Random g = new Random();
35 | DoubleUnaryOperator adjust = x -> Math.floor(x) + test.dist.inverseCumulativeProbability(x - Math.floor(x));
36 | long n = 20;
37 | double interval = 10.0;
38 | // Sorted
39 | Double[] t = g.doubles(n, 0.0, interval).boxed().sorted().toArray(Double[]::new);
40 | Double[] tseas = Arrays.stream(t).map(x -> adjust.applyAsDouble(x)).toArray(Double[]::new);
41 | System.out.println("Times with seasonal adjustments");
42 | for (int i = 0; i < n; i++) {
43 | System.out.println(t[i] + ", " + tseas[i]);
44 | }
45 |
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/CensoredMultinomialTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 |
3 | import java.util.Arrays;
4 |
5 | import utilities.CensoredMultinomialTrial;
6 |
7 | /**
8 | * Used only for development
9 | * @author rwdarli
10 | * @see utilities.CensoredMultinomialTrial
11 | */
12 | public class CensoredMultinomialTest {
13 |
14 | private CensoredMultinomialTrial cmt;
15 |
16 | public CensoredMultinomialTest(int n) {
17 | cmt = new CensoredMultinomialTrial(n);
18 | }
19 |
20 | /**
21 | * @param args
22 | */
23 | public static void main(String[] args) {
24 | final int n = 51;
25 | CensoredMultinomialTest test = new CensoredMultinomialTest(n);
26 | double[] rate = new double[n];
27 | /*
28 | * in this test the final rate component equals all the others put together
29 | */
30 | Arrays.setAll(rate, i -> (i < 50) ? 1.0 : 50.0);
31 | boolean[] offrange = new boolean[n];
32 | Arrays.fill(offrange, false);
33 | int s = 30;
34 | System.out.println("Draw " + s + " samples from distribution on {0, 1, ..., " + (n - 1) + "}");
35 | for (int t = 0; t < s; t++) {
36 | System.out.print(test.cmt.sample(rate, offrange) + "; ");
37 | }
38 | System.out.println();
39 | System.out.println("Same where " + (n - 1) + " is unavailable.");
40 | offrange[n - 1] = true;
41 | for (int t = 0; t < s; t++) {
42 | System.out.print(test.cmt.sample(rate, offrange) + "; ");
43 | }
44 | System.out.println();
45 | System.out.println("Same where " + (n - 1) + " and states 0 to 9 are unavailable.");
46 | Arrays.fill(offrange, 0, 10, true);
47 | for (int t = 0; t < s; t++) {
48 | System.out.print(test.cmt.sample(rate, offrange) + "; ");
49 | }
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/EuclideanPointTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 | import java.util.Arrays;
3 | import java.util.Random;
4 |
5 | import utilities.EuclideanPoint;
6 |
7 | /**
8 | * Used only for development
9 | * @author rwdarli
10 | * @see utilities.EuclideanPoint
11 | */
12 | public class EuclideanPointTest {
13 |
14 | public EuclideanPointTest() {
15 |
16 | }
17 |
18 | /**
19 | * @param args
20 | */
21 | public static void main(String[] args) {
22 | Random g = new Random();
23 | int d = 3;
24 | /*
25 | * Two random points in [-1,1)^d
26 | */
27 | double[] x = g.doubles(d, -1.0, 1.0).toArray();
28 | EuclideanPoint px = new EuclideanPoint(x);
29 | double[] y = g.doubles(d, -1.0, 1.0).toArray();
30 | EuclideanPoint py = new EuclideanPoint(y);
31 | System.out.println("Distance from x to y: " +px.distanceTo(py) );
32 | System.out.println("Are x and y equal? " + px.equals(py));
33 | /*
34 | * Corrupt vector x by sqrt then square
35 | */
36 | double[] xx = new double[d];
37 | Arrays.setAll(xx, j->Math.pow(Math.sqrt(x[j]), 2.0));
38 | EuclideanPoint pxx = new EuclideanPoint(xx);
39 | System.out.println("Are x and xx equal? " + px.equals(pxx));
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/HeavyTailPointProcessTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 |
3 | import java.util.Arrays;
4 |
5 | import org.knowm.xchart.SwingWrapper;
6 | import org.knowm.xchart.XYChart;
7 |
8 | import utilities.HeavyTailPointProcess;
9 | import utilities.ScatterPlotInputData;
10 |
11 | /**
12 | * Used only for development
13 | * @author rwdarli
14 | * @see utilities.HeavyTailPointProcess
15 | */
16 | public class HeavyTailPointProcessTest {
17 | private HeavyTailPointProcess pp;
18 |
19 | public HeavyTailPointProcessTest() {
20 | pp = new HeavyTailPointProcess();
21 | }
22 |
23 | /**
24 | * @param args
25 | */
26 | public static void main(String[] args) {
27 | final double duration = 100.0; // days
28 | // Gives about 15 events / day with these choices.
29 | final double lo = 1.0 / (30.0 * 24.0); // two minutes in days
30 | final double hi = 1.5; // day & a half
31 |
32 | HeavyTailPointProcessTest test = new HeavyTailPointProcessTest();
33 |
34 | /*
35 | * Mean events per day
36 | */
37 | System.out.println("How does alphaDaily relate to average events per day, keeping lo and hi fixed?");
38 | int mesh = 30;
39 | double[] alphaValues = new double[mesh];
40 | Arrays.setAll(alphaValues, j -> -1.5 - j * 0.1);
41 | double[] meanValues = new double[mesh];
42 | Arrays.setAll(meanValues, j -> 1.0 / test.pp.meanRate(lo, hi, alphaValues[j]));
43 | for (int j = 0; j < mesh; j++) {
44 | System.out.print("{" + alphaValues[j] + ", " + meanValues[j] + "}, ");
45 | }
46 | System.out.println();
47 |
48 | final double alpha = -2.5; // tail parameter
49 |
50 | System.out.println("How does lo relate to average events per day, keeping alphaDaily and hi fixed?");
51 | double[] loValues = new double[mesh];
52 | double sec = 1.0 / (3600.0 * 24.0);
53 | Arrays.setAll(loValues, j -> (j + 1) * 4.0 * sec); // multiples of 4 seconds
54 | Arrays.setAll(meanValues, j -> 1.0 / test.pp.meanRate(loValues[j], hi, alpha));
55 | for (int j = 0; j < mesh; j++) {
56 | System.out.print("{" + (loValues[j] / sec) + ", " + meanValues[j] + "}, ");
57 | }
58 | System.out.println();
59 |
60 | double[] x = test.pp.generate(duration, lo, hi, alpha);
61 | System.out.println("# arrivals = " + x.length);
62 | System.out.println("Intended duration: " + duration + "; actual duration: " + x[x.length - 1]);
63 | /*
64 | * What rate did we expect?
65 | */
66 | double paretoMean = test.pp.meanRate(lo, hi, alpha);
67 | double actualRate = x.length / duration;
68 | System.out.println("Expected rate / day: " + (1.0 / paretoMean) + "; actual rate: " + actualRate);
69 |
70 | // Create Scatter Plot
71 | double[] y = new double[x.length];
72 | Arrays.setAll(y, j -> 1.0 + j); // 1,2,3, ..., n
73 |
74 | ScatterPlotInputData scatter = new ScatterPlotInputData("Point Process " + (-alpha), x, y);
75 | XYChart chartAPP = scatter.getChart();
76 | new SwingWrapper(chartAPP).displayChart();
77 |
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/HeavyTailedPartialSumsTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 |
3 | import java.util.Arrays;
4 |
5 | import org.knowm.xchart.SwingWrapper;
6 | import org.knowm.xchart.XYChart;
7 |
8 | import utilities.HeavyTailedPartialSums;
9 | import utilities.ScatterPlotInputData;
10 |
11 | /**
12 | * Used only for development
13 | * @author rwdarli
14 | * @see utilities.HeavyTailedPartialSums
15 | */
16 | public class HeavyTailedPartialSumsTest {
17 | private HeavyTailedPartialSums ps;
18 |
19 | public HeavyTailedPartialSumsTest() {
20 | ps = new HeavyTailedPartialSums();
21 | }
22 |
23 | /**
24 | * @param args
25 | *
26 | */
27 | public static void main(String[] args) {
28 | final int count = 1000;
29 | // Take delta = 0.001 (about 1/30 divided by 36 hours), alpha = -1.5
30 | final double delta = 0.001; // two minutes / 1.5 days
31 | final double alpha = -1.5;
32 | final double days = 90.0;
33 |
34 | HeavyTailedPartialSumsTest test = new HeavyTailedPartialSumsTest();
35 |
36 | Double[] xx = test.ps.generate(count, delta, alpha).toArray(new Double[count]);
37 | System.out.println("first entry: " + xx[0]);
38 | System.out.println("last entry: " + xx[count - 1]);
39 |
40 | // Create Scatter Plot
41 | double[] t = new double[xx.length];
42 | Arrays.setAll(t, j -> 1.0 + j); //1,2,3, ..., n
43 | double[] x = new double[count];
44 | Arrays.parallelSetAll(x, j->days*xx[j].doubleValue()); //unboxing
45 |
46 | ScatterPlotInputData scatter = new ScatterPlotInputData("Point Process "+(-alpha), x, t);
47 | XYChart chartAPP = scatter.getChart();
48 | new SwingWrapper(chartAPP).displayChart();
49 |
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/IrregularBinTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 |
3 | /**
4 | * Ran successfully 11.14.2018
5 | */
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 | import java.util.Random;
10 | import java.util.stream.Collectors;
11 |
12 | import utilities.IrregularBinAssignment;
13 |
14 | /**
15 | * Used only for development
16 | * @author rwdarli
17 | * @see utilities.IrregularBinAssignment
18 | */
19 | public class IrregularBinTest {
20 |
21 | private IrregularBinAssignment iba;
22 |
23 | public IrregularBinTest() {
24 | iba = new IrregularBinAssignment<>();
25 | }
26 |
27 | /**
28 | * @param args
29 | */
30 | public static void main(String[] args) {
31 | IrregularBinTest test = new IrregularBinTest();
32 | Random g = new Random();
33 | List obs = g.doubles(100).map(x -> -Math.log(x)).sorted().boxed().collect(Collectors.toList());
34 | double maxObs = obs.get(obs.size() - 1);
35 | List bins = new ArrayList();
36 | bins.add(0.0); // first element
37 | int bincount = 20; // add one for endpoints
38 | bins.addAll(g.doubles(bincount, 0.0, Math.ceil(maxObs)).sorted().boxed().collect(Collectors.toList()));
39 | test.iba.assign(bins, obs);
40 | System.out.println("bin boundaries:");
41 | for (Double a : bins) {
42 | System.out.print(a + ", ");
43 | }
44 | System.out.println();
45 | int testbin = g.nextInt(bincount);
46 |
47 | int counter = 0;
48 | for (Double b : obs) {
49 | if ((b >= bins.get(testbin)) && (b < bins.get(testbin + 1))) {
50 | counter++;
51 | }
52 | }
53 | System.out.println("observation count for bin " + testbin + " = " + counter);
54 | System.out.println();
55 | System.out.println("placements of observations in bins:");
56 | for (Integer p : test.iba.getPlacements()) {
57 | System.out.print(p + ", ");
58 | }
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/ParameterCSVReader.java:
--------------------------------------------------------------------------------
1 |
2 | package utilityTests;
3 |
4 | import java.io.FileReader;
5 | import java.io.IOException;
6 | import java.io.Reader;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import org.apache.commons.csv.CSVFormat;
11 | import org.apache.commons.csv.CSVRecord;
12 |
13 | /**
14 | * Used only for development
15 | * @author rwrd
16 | *
17 | */
18 | public class ParameterCSVReader {
19 |
20 | public ParameterCSVReader() {
21 |
22 | }
23 |
24 | /**
25 | * @param args
26 | */
27 | public static void main(String[] args) {
28 | try {
29 | Reader in = new FileReader(args[0]);
30 | Iterable records = CSVFormat.RFC4180.parse(in);
31 | List p = new ArrayList<>();
32 | for (CSVRecord record : records) {
33 | System.out.println(record.get(0) + " has value " + record.get(1));
34 | p.add(record.get(1).replaceAll("\\s","")); // remove whitespace
35 | }
36 | int d = Integer.parseInt(p.get(0));
37 | double h = Double.parseDouble(p.get(1));
38 | int n = Integer.parseInt(p.get(2));
39 | int numTravelers = Integer.parseInt(p.get(3));
40 | int numCoTravelers = Integer.parseInt(p.get(4));
41 | double days = Double.parseDouble(p.get(5));
42 | double countMean = Double.parseDouble(p.get(6));
43 |
44 | } catch (IOException ex) {
45 | System.out.println(ex.toString());
46 | System.out.println("Could not find file.");
47 | }
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/PoissonVariateTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 |
3 |
4 | import java.util.Arrays;
5 | import java.util.IntSummaryStatistics;
6 |
7 | import utilities.PoissonVariate;
8 |
9 | /**
10 | * Used only for development
11 | * @author rwdarli
12 | * @see utilities.PoissonVariate
13 | */
14 | public class PoissonVariateTest {
15 |
16 | private PoissonVariate pv;
17 | public PoissonVariateTest(double lam) {
18 | this.pv = new PoissonVariate(lam);
19 | }
20 |
21 | /**
22 | * @param args
23 | */
24 | public static void main(String[] args) {
25 | double lambda = 1000.0;
26 | PoissonVariateTest test = new PoissonVariateTest(lambda);
27 | int ntrials = 100;
28 | int[] data = new int[ntrials];
29 | Arrays.setAll(data, i->test.pv.generate());
30 |
31 | IntSummaryStatistics stats = Arrays.stream(data).summaryStatistics();
32 | System.out.println(ntrials + " trials: " + stats);
33 |
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/ReweightedMultinomialTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 |
3 | import java.util.Arrays;
4 | import java.util.HashSet;
5 | import java.util.Random;
6 | import java.util.Set;
7 |
8 | import utilities.ReweightedMultinomialTrial;
9 |
10 | /**
11 | * Used only for development
12 | *
13 | * @author rwdarli
14 | * @see utilities.ReweightedMultinomialTrial
15 | */
16 | public class ReweightedMultinomialTest {
17 |
18 | ReweightedMultinomialTrial rmt;
19 |
20 | public ReweightedMultinomialTest() {
21 | this.rmt = new ReweightedMultinomialTrial();
22 | }
23 |
24 | /**
25 | * @param args
26 | */
27 | public static void main(String[] args) {
28 | final int n = 60; // overall set of states
29 | final int s = 35; // sample size
30 | double[] rate = new double[n];
31 | double[] freq = new double[n];
32 | Random g = new Random();
33 | Arrays.setAll(rate, i -> g.nextDouble()); // random rates
34 | final double mu = 4.0;
35 | Arrays.setAll(freq, i -> Math.floor(mu * g.nextDouble())); // round a random double down
36 | /*
37 | * the places are states whose frequency is not zero
38 | */
39 | Set places = new HashSet();
40 | for (int j = 0; j < n; j++) {
41 | if (freq[j] > 0.0) {
42 | places.add(j);
43 | }
44 | }
45 | ReweightedMultinomialTest test = new ReweightedMultinomialTest();
46 | System.out.println("Draw " + s + " samples from distribution on " + places.size() + " integers.");
47 | for (int t = 0; t < s; t++) {
48 | System.out.print(test.rmt.sample(places, rate, freq) + "; ");
49 | }
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/SpacePointTest.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
2 |
3 | import utilities.SpacePointGenerator;
4 |
5 | /**
6 | * Used only for development
7 | * @see utilities.SpacePointGenerator
8 | * @author rwdarli
9 | */
10 | public class SpacePointTest {
11 |
12 |
13 | SpacePointGenerator x;
14 | /**
15 | *
16 | * @param d dimension of ambient Euclidean space
17 | */
18 | public SpacePointTest(int d) {
19 | this.x = new SpacePointGenerator(d);
20 | }
21 |
22 | /**
23 | * @param args null
24 | */
25 | public static void main(String[] args) {
26 | int d = 3;
27 | SpacePointTest spt = new SpacePointTest(d);
28 | System.out.println("Random point v1 in disc: ");
29 | double[] v1 = spt.x.samplePointUnitDisk();
30 | for (double z : v1) {
31 | System.out.print("," + z);
32 | }
33 | System.out.println();
34 | double[] v2 = spt.x.samplePointUnitDisk();
35 | System.out.println("Distance between two random points in disc: " + SpacePointGenerator.distance(v1, v2));
36 | System.out.println("Test ToDoubleBifunction version: " + spt.x.distance.applyAsDouble(v1, v2));
37 | System.out.println("Are v1 and v2 equal? " + SpacePointGenerator.equalPoints(v1, v2));
38 | System.out.println("Test BiPredicate version: " + spt.x.equalPoints.test(v1, v2));
39 | System.out.println("Are v1 and v1 equal? " + SpacePointGenerator.equalPoints(v1, v1));
40 | System.out.println("Test BiPredicate version: " + spt.x.equalPoints.test(v1, v1));
41 |
42 | double radius = 0.07;
43 | double[] v3 = spt.x.sampleNearbyPoint(radius, v1);
44 | System.out.println("Random point v3 within radius " + radius + " of v1: ");
45 | for (double z : v3) {
46 | System.out.print("," + z);
47 | }
48 | System.out.println();
49 | System.out.println("Distance between v1 and v3: " + SpacePointGenerator.distance(v1, v3));
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/test/java/utilityTests/package-info.java:
--------------------------------------------------------------------------------
1 | package utilityTests;
--------------------------------------------------------------------------------
/target/classes/simulators/SporadicReporter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/target/classes/simulators/SporadicReporter.class
--------------------------------------------------------------------------------
/target/classes/utilities/HeavyTailedPartialSums.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/target/classes/utilities/HeavyTailedPartialSums.class
--------------------------------------------------------------------------------
/target/classes/utilities/IrregularBinAssignment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/target/classes/utilities/IrregularBinAssignment.class
--------------------------------------------------------------------------------
/target/test-classes/utilityTests/HeavyTailPointProcessTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/target/test-classes/utilityTests/HeavyTailPointProcessTest.class
--------------------------------------------------------------------------------
/target/test-classes/utilityTests/IrregularBinTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NationalSecurityAgency/fractalrabbit/9933449c4f4fe1b26b6ac7bfdeeac76583085df5/target/test-classes/utilityTests/IrregularBinTest.class
--------------------------------------------------------------------------------