Git Product home page Git Product logo

lift-sim's Introduction

lift-sim

Simulator for Elevator Control

A simplified elevator simulator that follows the rules specified in the problem statement here.

This simulator has been created for Assignment 4 of the Fall 2016 course COL333 (Artificial Intelligence) at IIT-Delhi. Before solving your MDP, don't forget that honesty is the best policy.

Usage Instructions

To run the simulator:

python sim.py run.sh <N> <K> <p> <q> <r> <t_u>

run.sh should be a bash script which runs your code. It should take the arguments N, K, p, q, r, t_u as specified in the problem statement.

Optional arguments:
-ep <ep> : Number of episodes to play out (Default: 1000)
-log <log> : Name of output log file (Default: 'simulation.txt')
-mode <mode> : 'CUI' for a command line visualisation, 'None' for no visualisation (Default: 'CUI')

You should read subsequent updates from stdin and write actions to stdout. Debug messages can be written to stderr. On running your executable for the first time, you should send a '0' when ready. The initial state has all elevators on the first floor with no buttons pressed.

You may have a look at SimpleAgent.py and run.sh for an example agent and script.

Note: To create an agent in C++, write a program that:

  • reads from stdin (cin) the buttons pressed in the form of a single string. Note that the state of individual buttons is delimited by spaces. For example, if in a time step, a person shows up on the 4th floor and decides to go up, the update received would be 'BU4'. If along with this, a person enters the 2nd elevator and presses the button for the 3rd floor, the update would be 'BU4 B32'. Hence every message in the state received will be either of the form B<D/U><floor number> or B<destination><elevator number>.

The state of a button will only be sent if it's not already pressed.

  • writes actions to stdout (cout) in the form of a string, with one action per elevator separated by spaces. For example, read the actions outputted by simpleAgent inside simpleAgent.py.

Sample Print Trace:

alt tag

  • Actions taken : action taken by the controller based on the previous state. Based on these actions, a simulation is performed and printed below.
  • People Waiting Up/Down : number of people waiting to go up and down on each floor (note that this is not explicitly available to the agent).
  • Floor Up/Down Buttons : In the above Episode, the BD is pressed for floors 3 and 5, and BU is pressed for floor 1.
  • Elevators : A dot shows which floor the elevator is on. If it is open, then a gap is shown with the direction of the light.
  • Elevator Buttons : Buttons pressed inside each elevator are shown with 'o's. For Elevator 1, button for the 5th floor is pressed while the button for the 1st floor is pressed for Elevator 2.
  • Update sent : The additional updates that transpired in the last time step. In this case, the button 'BD3' was pressed since someone arrived at floor 3. If no one arrives (or presses an already pressed floor button), a '0' is sent, followed by new lift buttons pressed (if any).

Log to PDF

To convert a .txt log to a pdf for easier viewing:

python convertToPDF.py <simulation.txt> <simulation.pdf>

Note: reportlab is a prerequisite and can be installed using pip:

pip install reportlab

lift-sim's People

Contributors

murtyshikhar avatar suragnair avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.