mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
deploy: d2b25f9340
This commit is contained in:
parent
76759d5da2
commit
296416f52b
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `BUILT_TIME_UTC` constant in crate `game`."><meta name="keywords" content="rust, rustlang, rust-lang, BUILT_TIME_UTC"><title>game::pregame::built_info::BUILT_TIME_UTC - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script id="default-settings"></script><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
|
||||
<link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png">
|
||||
<link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../../game/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../../index.html">game</a>::<wbr><a href="../index.html">pregame</a>::<wbr><a href="index.html">built_info</a></p><script>window.sidebarCurrent = {name: "BUILT_TIME_UTC", ty: "constant", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../../src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-a95c4551e63dceca/out/built.rs.html#53" title="goto source code">[src]</a></span><span class="in-band">Constant <a href="../../index.html">game</a>::<wbr><a href="../index.html">pregame</a>::<wbr><a href="index.html">built_info</a>::<wbr><a class="constant" href="">BUILT_TIME_UTC</a></span></h1><pre class="rust const">pub const BUILT_TIME_UTC: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = "Fri, 05 Mar 2021 20:33:36 +0000";</pre><div class="docblock"><p>The built-time in RFC2822, UTC</p>
|
||||
<a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../../src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-a95c4551e63dceca/out/built.rs.html#53" title="goto source code">[src]</a></span><span class="in-band">Constant <a href="../../index.html">game</a>::<wbr><a href="../index.html">pregame</a>::<wbr><a href="index.html">built_info</a>::<wbr><a class="constant" href="">BUILT_TIME_UTC</a></span></h1><pre class="rust const">pub const BUILT_TIME_UTC: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = "Fri, 05 Mar 2021 20:41:23 +0000";</pre><div class="docblock"><p>The built-time in RFC2822, UTC</p>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../";window.currentCrate = "game";</script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>
|
@ -3,4 +3,4 @@
|
||||
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../popdat/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Crate popdat</p><div class="block version"><p>Version 0.1.0</p></div><a id="all-types" href="index.html"><p>Back to index</p></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span>
|
||||
</span>
|
||||
<span class="in-band">List of all items</span></h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="struct.CensusArea.html">CensusArea</a></li><li><a href="struct.CensusPerson.html">CensusPerson</a></li><li><a href="struct.Config.html">Config</a></li><li><a href="struct.Schedule.html">Schedule</a></li><li><a href="make_person/struct.PersonFactory.html">make_person::PersonFactory</a></li><li><a href="od/struct.DesireLine.html">od::DesireLine</a></li><li><a href="od/struct.NormalDistribution.html">od::NormalDistribution</a></li><li><a href="od/struct.Options.html">od::Options</a></li><li><a href="od/struct.Zone.html">od::Zone</a></li></ul><h3 id="Enums">Enums</h3><ul class="enums docblock"><li><a href="enum.Activity.html">Activity</a></li><li><a href="enum.PersonType.html">PersonType</a></li></ul><h3 id="Functions">Functions</h3><ul class="functions docblock"><li><a href="activities/fn.hours.html">activities::hours</a></li><li><a href="activities/fn.minutes.html">activities::minutes</a></li><li><a href="activities/fn.rand_duration.html">activities::rand_duration</a></li><li><a href="activities/fn.rand_time.html">activities::rand_time</a></li><li><a href="distribute_people/fn.assign_people_to_houses.html">distribute_people::assign_people_to_houses</a></li><li><a href="distribute_people/fn.distribute_population_to_homes.html">distribute_people::distribute_population_to_homes</a></li><li><a href="fn.distribute_population_to_homes.html">distribute_population_to_homes</a></li><li><a href="fn.generate_scenario.html">generate_scenario</a></li><li><a href="make_person/fn.make_people.html">make_person::make_people</a></li><li><a href="make_person/fn.pick_mode.html">make_person::pick_mode</a></li><li><a href="od/fn.create_zones.html">od::create_zones</a></li><li><a href="od/fn.disaggregate.html">od::disaggregate</a></li><li><a href="od/fn.represent_homes_proportionally.html">od::represent_homes_proportionally</a></li><li><a href="od/fn.represent_workplaces_proportionally.html">od::represent_workplaces_proportionally</a></li></ul></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "popdat";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
<span class="in-band">List of all items</span></h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="struct.CensusArea.html">CensusArea</a></li><li><a href="struct.CensusPerson.html">CensusPerson</a></li><li><a href="struct.Config.html">Config</a></li><li><a href="struct.Schedule.html">Schedule</a></li><li><a href="make_person/struct.PersonFactory.html">make_person::PersonFactory</a></li><li><a href="od/struct.DesireLine.html">od::DesireLine</a></li><li><a href="od/struct.NormalDistribution.html">od::NormalDistribution</a></li><li><a href="od/struct.Options.html">od::Options</a></li><li><a href="od/struct.Zone.html">od::Zone</a></li></ul><h3 id="Enums">Enums</h3><ul class="enums docblock"><li><a href="enum.Activity.html">Activity</a></li><li><a href="enum.PersonType.html">PersonType</a></li></ul><h3 id="Functions">Functions</h3><ul class="functions docblock"><li><a href="activities/fn.hours.html">activities::hours</a></li><li><a href="activities/fn.minutes.html">activities::minutes</a></li><li><a href="activities/fn.rand_duration.html">activities::rand_duration</a></li><li><a href="activities/fn.rand_time.html">activities::rand_time</a></li><li><a href="distribute_people/fn.assign_people_to_houses.html">distribute_people::assign_people_to_houses</a></li><li><a href="distribute_people/fn.distribute_population_to_homes.html">distribute_people::distribute_population_to_homes</a></li><li><a href="fn.distribute_population_to_homes.html">distribute_population_to_homes</a></li><li><a href="fn.generate_scenario.html">generate_scenario</a></li><li><a href="make_person/fn.make_people.html">make_person::make_people</a></li><li><a href="make_person/fn.pick_mode.html">make_person::pick_mode</a></li><li><a href="od/fn.create_zones.html">od::create_zones</a></li><li><a href="od/fn.disaggregate.html">od::disaggregate</a></li></ul></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "popdat";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `create_zones` fn in crate `popdat`."><meta name="keywords" content="rust, rustlang, rust-lang, create_zones"><title>popdat::od::create_zones - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../popdat/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a></p><script>window.sidebarCurrent = {name: "create_zones", ty: "fn", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/popdat/od.rs.html#134-183" title="goto source code">[src]</a></span><span class="in-band">Function <a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a>::<wbr><a class="fn" href="">create_zones</a></span></h1><pre class="rust fn">fn create_zones(<br> map: &<a class="struct" href="../../map_model/struct.Map.html" title="struct map_model::Map">Map</a>, <br> input: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="../../geom/polygon/struct.Polygon.html" title="struct geom::polygon::Polygon">Polygon</a>><br>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="../../popdat/od/struct.Zone.html" title="struct popdat::od::Zone">Zone</a>></pre></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "popdat";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/popdat/od.rs.html#126-178" title="goto source code">[src]</a></span><span class="in-band">Function <a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a>::<wbr><a class="fn" href="">create_zones</a></span></h1><pre class="rust fn">fn create_zones(<br> map: &<a class="struct" href="../../map_model/struct.Map.html" title="struct map_model::Map">Map</a>, <br> input: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="../../geom/polygon/struct.Polygon.html" title="struct geom::polygon::Polygon">Polygon</a>><br>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="../../popdat/od/struct.Zone.html" title="struct popdat::od::Zone">Zone</a>></pre></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "popdat";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `disaggregate` fn in crate `popdat`."><meta name="keywords" content="rust, rustlang, rust-lang, disaggregate"><title>popdat::od::disaggregate - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../popdat/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a></p><script>window.sidebarCurrent = {name: "disaggregate", ty: "fn", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/popdat/od.rs.html#50-125" title="goto source code">[src]</a></span><span class="in-band">Function <a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a>::<wbr><a class="fn" href="">disaggregate</a></span></h1><pre class="rust fn">pub fn disaggregate(<br> map: &<a class="struct" href="../../map_model/struct.Map.html" title="struct map_model::Map">Map</a>, <br> zones: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="../../geom/polygon/struct.Polygon.html" title="struct geom::polygon::Polygon">Polygon</a>>, <br> desire_lines: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../popdat/od/struct.DesireLine.html" title="struct popdat::od::DesireLine">DesireLine</a>>, <br> opts: <a class="struct" href="../../popdat/od/struct.Options.html" title="struct popdat::od::Options">Options</a>, <br> rng: &mut <a class="struct" href="https://docs.rs/rand_xorshift/0.3.0/rand_xorshift/struct.XorShiftRng.html" title="struct rand_xorshift::XorShiftRng">XorShiftRng</a>, <br> timer: &mut <a class="struct" href="../../abstutil/time/struct.Timer.html" title="struct abstutil::time::Timer">Timer</a><'_><br>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../sim/make/scenario/struct.PersonSpec.html" title="struct sim::make::scenario::PersonSpec">PersonSpec</a>></pre><div class="docblock"><p>TODO Describe. In particular, how are polygons partly or fully outside the map's boundary
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/popdat/od.rs.html#50-114" title="goto source code">[src]</a></span><span class="in-band">Function <a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a>::<wbr><a class="fn" href="">disaggregate</a></span></h1><pre class="rust fn">pub fn disaggregate(<br> map: &<a class="struct" href="../../map_model/struct.Map.html" title="struct map_model::Map">Map</a>, <br> zones: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="../../geom/polygon/struct.Polygon.html" title="struct geom::polygon::Polygon">Polygon</a>>, <br> desire_lines: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../popdat/od/struct.DesireLine.html" title="struct popdat::od::DesireLine">DesireLine</a>>, <br> opts: <a class="struct" href="../../popdat/od/struct.Options.html" title="struct popdat::od::Options">Options</a>, <br> rng: &mut <a class="struct" href="https://docs.rs/rand_xorshift/0.3.0/rand_xorshift/struct.XorShiftRng.html" title="struct rand_xorshift::XorShiftRng">XorShiftRng</a>, <br> timer: &mut <a class="struct" href="../../abstutil/time/struct.Timer.html" title="struct abstutil::time::Timer">Timer</a><'_><br>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../sim/make/scenario/struct.PersonSpec.html" title="struct sim::make::scenario::PersonSpec">PersonSpec</a>></pre><div class="docblock"><p>TODO Describe. In particular, how are polygons partly or fully outside the map's boundary
|
||||
handled?
|
||||
TODO Add an options struct to specify AM/PM time distribution, lunch trips, etc.</p>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "popdat";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
@ -1,7 +0,0 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `represent_homes_proportionally` fn in crate `popdat`."><meta name="keywords" content="rust, rustlang, rust-lang, represent_homes_proportionally"><title>popdat::od::represent_homes_proportionally - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../popdat/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a></p><script>window.sidebarCurrent = {name: "represent_homes_proportionally", ty: "fn", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/popdat/od.rs.html#189-200" title="goto source code">[src]</a></span><span class="in-band">Function <a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a>::<wbr><a class="fn" href="">represent_homes_proportionally</a></span></h1><pre class="rust fn">fn represent_homes_proportionally(input: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../map_model/objects/building/struct.BuildingID.html" title="struct map_model::objects::building::BuildingID">BuildingID</a>>, map: &<a class="struct" href="../../map_model/struct.Map.html" title="struct map_model::Map">Map</a>)</pre><div class="docblock"><p>Repeat each residential building based on a guess of how many people live there. That way,
|
||||
we're more likely to allocate more people to larger homes.</p>
|
||||
<p>The heuristic for people per building is unfortunately very primitive right now, though.</p>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "popdat";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
@ -1,6 +0,0 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `represent_workplaces_proportionally` fn in crate `popdat`."><meta name="keywords" content="rust, rustlang, rust-lang, represent_workplaces_proportionally"><title>popdat::od::represent_workplaces_proportionally - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../popdat/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a></p><script>window.sidebarCurrent = {name: "represent_workplaces_proportionally", ty: "fn", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/popdat/od.rs.html#204-214" title="goto source code">[src]</a></span><span class="in-band">Function <a href="../index.html">popdat</a>::<wbr><a href="index.html">od</a>::<wbr><a class="fn" href="">represent_workplaces_proportionally</a></span></h1><pre class="rust fn">fn represent_workplaces_proportionally(input: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../../map_model/objects/building/struct.BuildingID.html" title="struct map_model::objects::building::BuildingID">BuildingID</a>>, map: &<a class="struct" href="../../map_model/struct.Map.html" title="struct map_model::Map">Map</a>)</pre><div class="docblock"><p>Repeat each commercial building based on a guess of how many people work there. That way,
|
||||
we're more likely to allocate more employees to larger stores.</p>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "popdat";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `od` mod in crate `popdat`."><meta name="keywords" content="rust, rustlang, rust-lang, od"><title>popdat::od - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../popdat/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module od</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#functions">Functions</a></li></ul></div><p class="location"><a href="../index.html">popdat</a></p><script>window.sidebarCurrent = {name: "od", ty: "mod", relpath: "../"};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/popdat/od.rs.html#1-242" title="goto source code">[src]</a></span><span class="in-band">Module <a href="../index.html">popdat</a>::<wbr><a class="mod" href="">od</a></span></h1><div class="docblock"><p>This is an alternative pipeline for generating a Scenario, starting from origin-destination
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/popdat/od.rs.html#1-206" title="goto source code">[src]</a></span><span class="in-band">Module <a href="../index.html">popdat</a>::<wbr><a class="mod" href="">od</a></span></h1><div class="docblock"><p>This is an alternative pipeline for generating a Scenario, starting from origin-destination
|
||||
data (also called desire lines), which gives a count of commuters between two zones, breaking
|
||||
down by mode.</p>
|
||||
<p>Maybe someday, we'll merge the two approaches, and make the first generate DesireLines as an
|
||||
@ -14,8 +14,4 @@ same zone), and commuting using some mode.</p>
|
||||
<table><tr class="module-item"><td><a class="fn" href="fn.create_zones.html" title="popdat::od::create_zones fn">create_zones</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="fn" href="fn.disaggregate.html" title="popdat::od::disaggregate fn">disaggregate</a></td><td class="docblock-short"><p>TODO Describe. In particular, how are polygons partly or fully outside the map's boundary
|
||||
handled?
|
||||
TODO Add an options struct to specify AM/PM time distribution, lunch trips, etc.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="fn" href="fn.represent_homes_proportionally.html" title="popdat::od::represent_homes_proportionally fn">represent_homes_proportionally</a></td><td class="docblock-short"><p>Repeat each residential building based on a guess of how many people live there. That way,
|
||||
we're more likely to allocate more people to larger homes.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="fn" href="fn.represent_workplaces_proportionally.html" title="popdat::od::represent_workplaces_proportionally fn">represent_workplaces_proportionally</a></td><td class="docblock-short"><p>Repeat each commercial building based on a guess of how many people work there. That way,
|
||||
we're more likely to allocate more employees to larger stores.</p>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "popdat";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
@ -1 +1 @@
|
||||
initSidebarItems({"fn":[["create_zones",""],["disaggregate","TODO Describe. In particular, how are polygons partly or fully outside the map's boundary handled? TODO Add an options struct to specify AM/PM time distribution, lunch trips, etc."],["represent_homes_proportionally","Repeat each residential building based on a guess of how many people live there. That way, we're more likely to allocate more people to larger homes."],["represent_workplaces_proportionally","Repeat each commercial building based on a guess of how many people work there. That way, we're more likely to allocate more employees to larger stores."]],"struct":[["DesireLine","This describes some number of commuters living in some named zone, working in another (or the same zone), and commuting using some mode."],["NormalDistribution","A normal distribution of Durations."],["Options",""],["Zone",""]]});
|
||||
initSidebarItems({"fn":[["create_zones",""],["disaggregate","TODO Describe. In particular, how are polygons partly or fully outside the map's boundary handled? TODO Add an options struct to specify AM/PM time distribution, lunch trips, etc."]],"struct":[["DesireLine","This describes some number of commuters living in some named zone, working in another (or the same zone), and commuting using some mode."],["NormalDistribution","A normal distribution of Durations."],["Options",""],["Zone",""]]});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -122,7 +122,7 @@
|
||||
<span class="doccomment">/// The output of `rustdoc -V`</span>
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">RUSTDOC_VERSION</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">"rustdoc 1.50.0 (cb75ad5db 2021-02-10)"</span>;
|
||||
<span class="doccomment">/// The built-time in RFC2822, UTC</span>
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">BUILT_TIME_UTC</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">"Fri, 05 Mar 2021 20:33:36 +0000"</span>;
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">BUILT_TIME_UTC</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">"Fri, 05 Mar 2021 20:41:23 +0000"</span>;
|
||||
<span class="doccomment">/// The target architecture, given by `cfg!(target_arch)`.</span>
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">CFG_TARGET_ARCH</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">"x86_64"</span>;
|
||||
<span class="doccomment">/// The endianness, given by `cfg!(target_endian)`.</span>
|
||||
|
@ -207,42 +207,6 @@
|
||||
<span id="204">204</span>
|
||||
<span id="205">205</span>
|
||||
<span id="206">206</span>
|
||||
<span id="207">207</span>
|
||||
<span id="208">208</span>
|
||||
<span id="209">209</span>
|
||||
<span id="210">210</span>
|
||||
<span id="211">211</span>
|
||||
<span id="212">212</span>
|
||||
<span id="213">213</span>
|
||||
<span id="214">214</span>
|
||||
<span id="215">215</span>
|
||||
<span id="216">216</span>
|
||||
<span id="217">217</span>
|
||||
<span id="218">218</span>
|
||||
<span id="219">219</span>
|
||||
<span id="220">220</span>
|
||||
<span id="221">221</span>
|
||||
<span id="222">222</span>
|
||||
<span id="223">223</span>
|
||||
<span id="224">224</span>
|
||||
<span id="225">225</span>
|
||||
<span id="226">226</span>
|
||||
<span id="227">227</span>
|
||||
<span id="228">228</span>
|
||||
<span id="229">229</span>
|
||||
<span id="230">230</span>
|
||||
<span id="231">231</span>
|
||||
<span id="232">232</span>
|
||||
<span id="233">233</span>
|
||||
<span id="234">234</span>
|
||||
<span id="235">235</span>
|
||||
<span id="236">236</span>
|
||||
<span id="237">237</span>
|
||||
<span id="238">238</span>
|
||||
<span id="239">239</span>
|
||||
<span id="240">240</span>
|
||||
<span id="241">241</span>
|
||||
<span id="242">242</span>
|
||||
</pre><div class="example-wrap"><pre class="rust ">
|
||||
<span class="doccomment">//! This is an alternative pipeline for generating a Scenario, starting from origin-destination</span>
|
||||
<span class="doccomment">//! data (also called desire lines), which gives a count of commuters between two zones, breaking</span>
|
||||
@ -304,19 +268,12 @@
|
||||
<span class="comment">// First decide which zones are relevant for our map. Find all homes and shops for each zone,</span>
|
||||
<span class="comment">// and make it easy to repeatedly ask for a good random choice of home/work.</span>
|
||||
<span class="ident">timer</span>.<span class="ident">start</span>(<span class="string">"match zones"</span>);
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">zones</span> <span class="op">=</span> <span class="ident">create_zones</span>(<span class="ident">map</span>, <span class="ident">zones</span>);
|
||||
<span class="kw">for</span> <span class="ident">z</span> <span class="kw">in</span> <span class="ident">zones</span>.<span class="ident">values_mut</span>() {
|
||||
<span class="ident">represent_homes_proportionally</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">z</span>.<span class="ident">homes</span>, <span class="ident">map</span>);
|
||||
<span class="ident">represent_workplaces_proportionally</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">z</span>.<span class="ident">workplaces</span>, <span class="ident">map</span>);
|
||||
<span class="comment">// Make it easy to grab a random home or workplace.</span>
|
||||
<span class="ident">z</span>.<span class="ident">homes</span>.<span class="ident">shuffle</span>(<span class="ident">rng</span>);
|
||||
<span class="ident">z</span>.<span class="ident">workplaces</span>.<span class="ident">shuffle</span>(<span class="ident">rng</span>);
|
||||
}
|
||||
<span class="kw">let</span> <span class="ident">zones</span> <span class="op">=</span> <span class="ident">create_zones</span>(<span class="ident">map</span>, <span class="ident">zones</span>);
|
||||
<span class="ident">timer</span>.<span class="ident">stop</span>(<span class="string">"match zones"</span>);
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">people</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">new</span>();
|
||||
<span class="ident">timer</span>.<span class="ident">start</span>(<span class="string">"create people"</span>);
|
||||
<span class="lifetime">'DESIRE</span>: <span class="kw">for</span> <span class="ident">desire</span> <span class="kw">in</span> <span class="ident">desire_lines</span> {
|
||||
<span class="kw">for</span> <span class="ident">desire</span> <span class="kw">in</span> <span class="ident">desire_lines</span> {
|
||||
<span class="comment">// Skip if we filtered out either zone.</span>
|
||||
<span class="kw">if</span> <span class="op">!</span><span class="ident">zones</span>.<span class="ident">contains_key</span>(<span class="kw-2">&</span><span class="ident">desire</span>.<span class="ident">home_zone</span>) <span class="op">|</span><span class="op">|</span> <span class="op">!</span><span class="ident">zones</span>.<span class="ident">contains_key</span>(<span class="kw-2">&</span><span class="ident">desire</span>.<span class="ident">work_zone</span>) {
|
||||
<span class="kw">continue</span>;
|
||||
@ -328,20 +285,16 @@
|
||||
(<span class="ident">zones</span>[<span class="kw-2">&</span><span class="ident">desire</span>.<span class="ident">home_zone</span>].<span class="ident">pct_overlap</span> <span class="op">*</span> (<span class="ident">desire</span>.<span class="ident">number_commuters</span> <span class="kw">as</span> <span class="ident">f64</span>)) <span class="kw">as</span> <span class="ident">usize</span>;
|
||||
<span class="kw">for</span> <span class="kw">_</span> <span class="kw">in</span> <span class="number">0</span>..<span class="ident">num_commuters</span> {
|
||||
<span class="comment">// Pick a specific home and workplace.</span>
|
||||
<span class="kw">let</span> <span class="ident">home</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">zones</span>.<span class="ident">get_mut</span>(<span class="kw-2">&</span><span class="ident">desire</span>.<span class="ident">home_zone</span>).<span class="ident">unwrap</span>().<span class="ident">homes</span>.<span class="ident">pop</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">b</span>) <span class="op">=</span><span class="op">></span> <span class="ident">b</span>,
|
||||
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">></span> {
|
||||
<span class="macro">warn</span><span class="macro">!</span>(<span class="string">"Ran out of homes in {}"</span>, <span class="ident">desire</span>.<span class="ident">home_zone</span>);
|
||||
<span class="kw">continue</span> <span class="lifetime">'DESIRE</span>;
|
||||
}
|
||||
};
|
||||
<span class="kw">let</span> <span class="ident">work</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">zones</span>.<span class="ident">get_mut</span>(<span class="kw-2">&</span><span class="ident">desire</span>.<span class="ident">work_zone</span>).<span class="ident">unwrap</span>().<span class="ident">workplaces</span>.<span class="ident">pop</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">b</span>) <span class="op">=</span><span class="op">></span> <span class="ident">b</span>,
|
||||
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">></span> {
|
||||
<span class="macro">warn</span><span class="macro">!</span>(<span class="string">"Ran out of workplaces in {}"</span>, <span class="ident">desire</span>.<span class="ident">work_zone</span>);
|
||||
<span class="kw">continue</span> <span class="lifetime">'DESIRE</span>;
|
||||
}
|
||||
};
|
||||
<span class="kw">let</span> <span class="ident">home</span> <span class="op">=</span> <span class="ident">zones</span>[<span class="kw-2">&</span><span class="ident">desire</span>.<span class="ident">home_zone</span>]
|
||||
.<span class="ident">homes</span>
|
||||
.<span class="ident">choose_weighted</span>(<span class="ident">rng</span>, <span class="op">|</span>(<span class="kw">_</span>, <span class="ident">n</span>)<span class="op">|</span> <span class="kw-2">*</span><span class="ident">n</span>)
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="number">0</span>;
|
||||
<span class="kw">let</span> <span class="ident">work</span> <span class="op">=</span> <span class="ident">zones</span>[<span class="kw-2">&</span><span class="ident">desire</span>.<span class="ident">work_zone</span>]
|
||||
.<span class="ident">workplaces</span>
|
||||
.<span class="ident">choose_weighted</span>(<span class="ident">rng</span>, <span class="op">|</span>(<span class="kw">_</span>, <span class="ident">n</span>)<span class="op">|</span> <span class="kw-2">*</span><span class="ident">n</span>)
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="number">0</span>;
|
||||
|
||||
<span class="comment">// Create their schedule</span>
|
||||
<span class="kw">let</span> <span class="ident">goto_work</span> <span class="op">=</span> <span class="ident">Time</span>::<span class="ident">START_OF_DAY</span> <span class="op">+</span> <span class="ident">opts</span>.<span class="ident">departure_time</span>.<span class="ident">sample</span>(<span class="ident">rng</span>);
|
||||
@ -373,8 +326,11 @@
|
||||
<span class="kw">struct</span> <span class="ident">Zone</span> {
|
||||
<span class="ident">polygon</span>: <span class="ident">Polygon</span>,
|
||||
<span class="ident">pct_overlap</span>: <span class="ident">f64</span>,
|
||||
<span class="ident">homes</span>: <span class="ident">Vec</span><span class="op"><</span><span class="ident">BuildingID</span><span class="op">></span>,
|
||||
<span class="ident">workplaces</span>: <span class="ident">Vec</span><span class="op"><</span><span class="ident">BuildingID</span><span class="op">></span>,
|
||||
<span class="comment">// For each building, have a value describing how many people live or work there. The exact</span>
|
||||
<span class="comment">// value doesn't matter; it's just a relative weighting. This way, we can use a weighted sample</span>
|
||||
<span class="comment">// and match more people to larger homes/stores.</span>
|
||||
<span class="ident">homes</span>: <span class="ident">Vec</span><span class="op"><</span>(<span class="ident">BuildingID</span>, <span class="ident">usize</span>)<span class="op">></span>,
|
||||
<span class="ident">workplaces</span>: <span class="ident">Vec</span><span class="op"><</span>(<span class="ident">BuildingID</span>, <span class="ident">usize</span>)<span class="op">></span>,
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">create_zones</span>(<span class="ident">map</span>: <span class="kw-2">&</span><span class="ident">Map</span>, <span class="ident">input</span>: <span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">Polygon</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">Zone</span><span class="op">></span> {
|
||||
@ -410,15 +366,18 @@
|
||||
.<span class="ident">find</span>(<span class="op">|</span>(<span class="kw">_</span>, <span class="ident">z</span>)<span class="op">|</span> <span class="ident">z</span>.<span class="ident">polygon</span>.<span class="ident">contains_pt</span>(<span class="ident">center</span>))
|
||||
{
|
||||
<span class="kw">match</span> <span class="ident">b</span>.<span class="ident">bldg_type</span> {
|
||||
<span class="ident">BuildingType</span>::<span class="ident">Residential</span> { .. } <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">zone</span>.<span class="ident">homes</span>.<span class="ident">push</span>(<span class="ident">b</span>.<span class="ident">id</span>);
|
||||
<span class="ident">BuildingType</span>::<span class="ident">Residential</span> { <span class="ident">num_residents</span>, .. } <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">zone</span>.<span class="ident">homes</span>.<span class="ident">push</span>((<span class="ident">b</span>.<span class="ident">id</span>, <span class="ident">num_residents</span>));
|
||||
}
|
||||
<span class="ident">BuildingType</span>::<span class="ident">ResidentialCommercial</span>(<span class="kw">_</span>, <span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">zone</span>.<span class="ident">homes</span>.<span class="ident">push</span>(<span class="ident">b</span>.<span class="ident">id</span>);
|
||||
<span class="ident">zone</span>.<span class="ident">workplaces</span>.<span class="ident">push</span>(<span class="ident">b</span>.<span class="ident">id</span>);
|
||||
<span class="ident">BuildingType</span>::<span class="ident">ResidentialCommercial</span>(<span class="ident">num_residents</span>, <span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">zone</span>.<span class="ident">homes</span>.<span class="ident">push</span>((<span class="ident">b</span>.<span class="ident">id</span>, <span class="ident">num_residents</span>));
|
||||
<span class="comment">// We know how many different stores are located in each building, according to</span>
|
||||
<span class="comment">// OSM. A big mall might have 10 amenities, while standalone</span>
|
||||
<span class="comment">// shops just have 1.</span>
|
||||
<span class="ident">zone</span>.<span class="ident">workplaces</span>.<span class="ident">push</span>((<span class="ident">b</span>.<span class="ident">id</span>, <span class="ident">b</span>.<span class="ident">amenities</span>.<span class="ident">len</span>()));
|
||||
}
|
||||
<span class="ident">BuildingType</span>::<span class="ident">Commercial</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">zone</span>.<span class="ident">workplaces</span>.<span class="ident">push</span>(<span class="ident">b</span>.<span class="ident">id</span>);
|
||||
<span class="ident">zone</span>.<span class="ident">workplaces</span>.<span class="ident">push</span>((<span class="ident">b</span>.<span class="ident">id</span>, <span class="ident">b</span>.<span class="ident">amenities</span>.<span class="ident">len</span>()));
|
||||
}
|
||||
<span class="ident">BuildingType</span>::<span class="ident">Empty</span> <span class="op">=</span><span class="op">></span> {}
|
||||
}
|
||||
@ -428,37 +387,6 @@
|
||||
<span class="ident">zones</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Repeat each residential building based on a guess of how many people live there. That way,</span>
|
||||
<span class="doccomment">/// we're more likely to allocate more people to larger homes.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// The heuristic for people per building is unfortunately very primitive right now, though.</span>
|
||||
<span class="kw">fn</span> <span class="ident">represent_homes_proportionally</span>(<span class="ident">input</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Vec</span><span class="op"><</span><span class="ident">BuildingID</span><span class="op">></span>, <span class="ident">map</span>: <span class="kw-2">&</span><span class="ident">Map</span>) {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">output</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">new</span>();
|
||||
<span class="kw">for</span> <span class="ident">b</span> <span class="kw">in</span> <span class="ident">input</span>.<span class="ident">drain</span>(..) {
|
||||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">map</span>.<span class="ident">get_b</span>(<span class="ident">b</span>).<span class="ident">bldg_type</span> {
|
||||
<span class="ident">BuildingType</span>::<span class="ident">Residential</span> { <span class="ident">num_residents</span>, .. }
|
||||
<span class="op">|</span> <span class="ident">BuildingType</span>::<span class="ident">ResidentialCommercial</span>(<span class="ident">num_residents</span>, <span class="kw">_</span>) <span class="op">=</span><span class="op">></span> <span class="ident">num_residents</span>,
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> <span class="macro">unreachable</span><span class="macro">!</span>(),
|
||||
};
|
||||
<span class="ident">output</span>.<span class="ident">extend</span>(<span class="ident">std</span>::<span class="ident">iter</span>::<span class="ident">repeat</span>(<span class="ident">b</span>).<span class="ident">take</span>(<span class="ident">n</span>));
|
||||
}
|
||||
<span class="kw-2">*</span><span class="ident">input</span> <span class="op">=</span> <span class="ident">output</span>;
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Repeat each commercial building based on a guess of how many people work there. That way,</span>
|
||||
<span class="doccomment">/// we're more likely to allocate more employees to larger stores.</span>
|
||||
<span class="kw">fn</span> <span class="ident">represent_workplaces_proportionally</span>(<span class="ident">input</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Vec</span><span class="op"><</span><span class="ident">BuildingID</span><span class="op">></span>, <span class="ident">map</span>: <span class="kw-2">&</span><span class="ident">Map</span>) {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">output</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">new</span>();
|
||||
<span class="kw">for</span> <span class="ident">b</span> <span class="kw">in</span> <span class="ident">input</span>.<span class="ident">drain</span>(..) {
|
||||
<span class="comment">// We know how many different stores are located in each building, according to OSM. A big</span>
|
||||
<span class="comment">// mall might have 10 amenities, while standalone shops just have 1. For now, assume 1</span>
|
||||
<span class="comment">// worker per store.</span>
|
||||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="ident">map</span>.<span class="ident">get_b</span>(<span class="ident">b</span>).<span class="ident">amenities</span>.<span class="ident">len</span>();
|
||||
<span class="ident">output</span>.<span class="ident">extend</span>(<span class="ident">std</span>::<span class="ident">iter</span>::<span class="ident">repeat</span>(<span class="ident">b</span>).<span class="ident">take</span>(<span class="ident">n</span>));
|
||||
}
|
||||
<span class="kw-2">*</span><span class="ident">input</span> <span class="op">=</span> <span class="ident">output</span>;
|
||||
}
|
||||
|
||||
<span class="doccomment">/// A normal distribution of Durations.</span>
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">NormalDistribution</span> {
|
||||
<span class="kw">pub</span> <span class="ident">mean</span>: <span class="ident">Duration</span>,
|
||||
|
Loading…
Reference in New Issue
Block a user