{ "info": { "author": "Arnold Buss", "author_email": "abuss@nps.edu", "bugtrack_url": null, "classifiers": [], "description": "# DESpy\n**DESpy** is a Python implementation of Discrete Event Simulation \n(DES) methodology based on Schruben's Event Graphs (see [Simulation Modeling with Event Graphs](http://delivery.acm.org/10.1145/360000/358460/p957-schruben.pdf)).\nIt also suports the LEGO component framework (see [Building Complex Models with LEGOs](https://www.informs-sim.org/wsc02papers/094.pdf) and [Component Based Simulation Modeling with Simkit](https://www.informs-sim.org/wsc02papers/031.pdf)).\n\n\n## Installation\n\n* Python 3.7 or greater installed\n* `pip install DESpy`\n\n## Running Example Scenarios\nThe sample components are in the ``examples`` package, with the \nsample scenarios in the ``examples.run`` package\n* SimpleServer\n* FiniteCapacityServer\n* EntityServer\n* ServerWithReneges\n* TransferLine\n* Confidence Interval Example: terminating case\n* Confidence Interval Example: steady-state case\n\n## Defining an Event Graph Component\nEach Event Graph component corresponds to a specific element in a DESpy model\n\n|Event Graph|DESpy|\n|-----------|-----|\n|Component |Subclass of SimEntityBase|\n|Parameter |attribute passed in to`` __init()__``|\n|State variable| attribute initialized to ``nan`` or ``[]``|\n|Run Event| ``reset()`` method and ``run()`` method|\n|Other Events|method of same name, first letter lower-case|\n|State transition|assignment to state variable followed by ``notify_state_change()``|\n|Schedule event|call ``schedule(, , [])``|\n|Cancel event|call ``cancel(, []`` |\n\n## Executing Model\n\n|Action|EventList call|\n|------|--------------|\n|Run verbose mode|``EventList.verbose=True``|\n|Run for xxx simtime units|``EventList.stop_at_time(xxx)``|\n|Run for n Foo events|``EventList.stop_on_event(n, 'Foo')``\n|Prepare for running model|``EventList.reset()``|\n|Run Model|``EventList.start_simulation()``|\n\n## Example: SimpleServer\n\nThe `SimpleServer` component is the most basic implementation of a multiple\nserver queue. Its state representation consists of integers representing the\nnumber of customers in queue (`number_in_queue`) and the number of available\nservers (`number_available_servers`). It is not a stand-alone model, but must be \nset up to \"listen\" to another component that periodically schedules an `Arrival` event.\nThe most basic such component is the `ArrivalProcess`.\n\n```\n# Instantiate ArrivalProcess component with interarrival times Exponential(1.7)\ninterarrival_time_generator = RandomVariate.instance('Exponential', mean=1.7)\narrival_process = ArrivalProcess(interarrival_time_generator)\n\n# Instantiate SimpleServer component with 2 servers and service times Gamma(1.7, 1.8)\nnumber_servers = 2;\nservice_time_generator = RandomVariate.instance('Gamma', alpha=1.7, beta=1.8)\nsimple_server = SimpleServer(number_servers, service_time_generator)\n\n# Add the SimpleServer instance to the ArrivalProcess instance as a\n# SimEventListener\narrival_process.add_sim_event_listener(simple_server)\n\n# These statistics objects will collect the time-varying number_in_queue\n# and number_available_servers of the SimpleServer instance\nnumber_in_queue_stat = SimpleStatsTimeVarying('number_in_queue')\nnumber_available_servers_stat = SimpleStatsTimeVarying('number_available_servers')\n\n# Add the statistics objects as StateChangeListeners\nsimple_server.add_state_change_listener(number_in_queue_stat)\nsimple_server.add_state_change_listener(number_available_servers_stat)\n\n# Execute the model for 100,000 time units\nstopTime = 100000;\nEventList.stop_at_time(stopTime)\n\n# Initialize the EventList and put all Run events on the EventList\nEventList.reset()\n\n# Execute the simulation\nEventList.start_simulation()\n```\n\n## Running Multiple Replications\n\nThe most straightforward way to estimate confidence intervals is by running\nmultiple independent replications. \nTo run multiple replications, wrap the ``reset()`` and ``start_simulation()``\ncalls in a ``for`` loop. Collecting statistics, however, needs to be different\nfor the \"inner\" statistics objects and \"outer\" ones.\n\nStatistics objects are ``StateChangeListeners`` that implement the ``stateChange()`` method\nto update their counters. The two main types are \"tally\" and \"time-varying.\"\nThey are typically used in tow different ways: \"inner\" and \"outer.\" \n\nAn **Inner** statistics object uses state trajectories from a single replication to \nproduce a value - typically a mean - for that replication. Since simulation data\nare tyically auto-correlated, estimates of the variance can be extremely biased.\nThus, the usual expression for a confidence interval cannot be applied.\nIt is important to `clear()` each inner statistics object\nbefore each replication in order to ensure independence between replications.\n\nAn **Outer** statistics object is typically used to collect data from the inner\nstatistics objects. After each replication, a value from an inner statistics\nobject (often the mean) is passed to the outer object. \n\nIn this manner, regardless of the value passed, the outer statistics object\ncan then (with sufficient quantity of replications) produce a confidence interval for the \nvalue in question (with all the \"usual\" assumptions about the central limit theorem). \n\n### Parameters vs State Variables\n\n## Parameters\n\nParameters are variables in a component that do not change during a given replication of\nthe simulation. These are inputs to the simulation and, as such, must be \npassed in via the `__init()__` method. Parameters may be scalars, such as the\ntotal number of servers, or RandomVariates which generate different values\non each call, such as the service time generator. In such cases, while the generated values may be different,\nthe distribution itself remains the same.\n\n## State Variables\n\nState variables _do_ change within a given replication of a model. The full\ndefinition of a state variable must include its initial value, since that \nis set in the `reset()` method of each component. Only event methods are\npermitted to change the value of a state variable, since events are identified with state transitions. Thus, the value of a given\nstate at any point in simulated time is completely determinded by its \ninitial value and the subsequent state transitions.\n\nEvery state transition must be accompanied by a `notify_state_change()` call, which \nnotifies StateChangeListsners that the given state has changed. This allows\ncomponents to be written to the dynamics of the model only and not be concerned with\ncollecting statistics, since that can be done with the appropriate statistical\nobjects, which are StateChanegListsners.\n\n### Defining Events\n\nAn Event is defined in a subclass of `SimEntityBase` as simply an ordinary method. Within an event method,\nthere should only be (in order):\n\n1. State transitions (followed by state change notifications)\n2. Canceling events (if needed) by a call to `self.cancel()`\n3. Scheduling events (if needed) by a call to `self.sechedule()`\n\n### RandomVariate Instantiation\n\nBy convention, a `RandomVariate` class specifies its parameters as named ones in the \nconstructor. \n\nThere are several ways to instantiate a `RandomVariate`. \n\n* Direct instantiation, e.g. `Exponential(mean=2.3)`\n* Using the `RandomVariate` factory method with keywords: `RandomVariate.instance('Exponential', mean=2.3)`\n* Using the RandomVariate factory method with a dictionary (using the `params` keyword):\n```\nparams_map={mean:2.3}\nRandomVariate.instance('Exponential', params=params_map)\n```\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ahbuss/DESpy", "keywords": "", "license": "Apache 2.0 License", "maintainer": "", "maintainer_email": "", "name": "DESpy", "package_url": "https://pypi.org/project/DESpy/", "platform": "", "project_url": "https://pypi.org/project/DESpy/", "project_urls": { "Homepage": "https://github.com/ahbuss/DESpy" }, "release_url": "https://pypi.org/project/DESpy/0.1.14/", "requires_dist": null, "requires_python": "", "summary": "Support for DES Modeling using Event Graphs", "version": "0.1.14" }, "last_serial": 5978488, "releases": { "0.1.11": [ { "comment_text": "", "digests": { "md5": "b1426eb8c1d030fd4c4f717333721d42", "sha256": "1fcb9230fc84ed7fa05a9bf31111d1d5a5f0cbfd8dc8fcf991510dd2324ad1f2" }, "downloads": -1, "filename": "DESpy-0.1.11-py3-none-any.whl", "has_sig": false, "md5_digest": "b1426eb8c1d030fd4c4f717333721d42", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22170, "upload_time": "2018-11-07T00:13:19", "url": "https://files.pythonhosted.org/packages/84/f0/791223f054414cc7ffedce2e3f08800c8fa6459f9c99d580965def2537d0/DESpy-0.1.11-py3-none-any.whl" } ], "0.1.12": [ { "comment_text": "", "digests": { "md5": "538a90941ef6fea5efcabb49701531c5", "sha256": "0e0fd2ee443c25c3acf31e3f71524f84a725a61ec941f522b9f7d5388d50701e" }, "downloads": -1, "filename": "DESpy-0.1.12-py3-none-any.whl", "has_sig": false, "md5_digest": "538a90941ef6fea5efcabb49701531c5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22175, "upload_time": "2018-11-07T18:25:50", "url": "https://files.pythonhosted.org/packages/4f/ed/8f513c7d615bdaf664b9d1720cb8a4d9bcc831c6c7d604888aab0ffb5cf6/DESpy-0.1.12-py3-none-any.whl" } ], "0.1.13": [ { "comment_text": "", "digests": { "md5": "c788eb0a2a667ed5490e181a86a0779b", "sha256": "8bc39d1bd34423c4c61e547420c7b674ba7c1a626760e4896648c39d1f263dab" }, "downloads": -1, "filename": "DESpy-0.1.13-py3-none-any.whl", "has_sig": false, "md5_digest": "c788eb0a2a667ed5490e181a86a0779b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21724, "upload_time": "2019-10-14T22:32:49", "url": "https://files.pythonhosted.org/packages/a9/4a/4eb1073a6e1372ccdd3fa817e46b5faa655f46354a326c140921cc04854d/DESpy-0.1.13-py3-none-any.whl" } ], "0.1.14": [ { "comment_text": "", "digests": { "md5": "35f68b6a2c64109a3cd605d5bf999fe6", "sha256": "9b1187ba65e30326984a4243bca0647b9f2f4cb65588515bb15e2e8b805d8a6e" }, "downloads": -1, "filename": "DESpy-0.1.14-py3-none-any.whl", "has_sig": false, "md5_digest": "35f68b6a2c64109a3cd605d5bf999fe6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22360, "upload_time": "2019-10-15T17:13:03", "url": "https://files.pythonhosted.org/packages/bb/eb/2a90a004f8288485efabd7e20ddd0381788ecd6dc6cc9a331d8ecfb69dfd/DESpy-0.1.14-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "35f68b6a2c64109a3cd605d5bf999fe6", "sha256": "9b1187ba65e30326984a4243bca0647b9f2f4cb65588515bb15e2e8b805d8a6e" }, "downloads": -1, "filename": "DESpy-0.1.14-py3-none-any.whl", "has_sig": false, "md5_digest": "35f68b6a2c64109a3cd605d5bf999fe6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22360, "upload_time": "2019-10-15T17:13:03", "url": "https://files.pythonhosted.org/packages/bb/eb/2a90a004f8288485efabd7e20ddd0381788ecd6dc6cc9a331d8ecfb69dfd/DESpy-0.1.14-py3-none-any.whl" } ] }