Find Jobs
Hire Freelancers

Ruby elevator simulator program

$30-250 USD

Closed
Posted over 3 years ago

$30-250 USD

Paid on delivery
Develop a simulation of an elevator that travels between floors 1 and N where N is an input. Time is sequenced in discrete steps starting at 1; at each time step, the elevator may ascend one floor, descend one floor, or remain at its current floor, as determined by its strategy. The first line of the input file indicates the number N of floors. This is followed by one line per person using the elevator: her id, call time (when she calls for the elevator), origin floor (where she boards the elevator), and destination floor (where she debarks the elevator). For example: 5 100 2 1 4 101 3 4 5 102 3 3 2 103 5 5 1 104 5 1 4 Here, individual 100 boards at time 2 from floor 1 with a destination of floor 4. Assume sensible inputs (e.g., times are positive integers, floors are integers in the range 1 through N). Whenever the elevator stops at a floor from which people have called it (i.e., their origin floor but not before their call time), they all board the elevator. And whenever the elevator stops at any passengers’ destination floor, they all get off the elevator. (Everyone behaves so as to minimize their travel time.) The simulation stops when every passenger has been brought to his or her destination floor (subject of course to their call time and origin floor constraints). A strategy determines the floor the elevator begins on at time 1, and a policy for moving to the next floor (up one floor, down one floor, or remaining at the current floor) from one time step to the next. These are implemented by its intial_floor and next_floor policy methods. A strategy is notified whenever a person calls it (person_calls method), when a passenger boards (person_gets_on), and when a passenger debarks (person_gets_off). Information provided through these last three notification methods can be used to tailor an intelligent strategy for moving from floor to floor. class Strategy def initial_floor end def next_floor end def person_calls(time, from) end def person_gets_on(time, from, to) end def person_gets_off(time, to) end end Here is a naïve strategy that does not make use of the information supplied by the notification methods: Strategy 1: Start at floor 1. In each time step, successively go up one floor until reaching the top floor N, then successively go down one floor until reaching the bottom floor 1, and continue this ‘up to the top floor then down to the bottom floor’ policy. Here we run the simulation using the input file [login to view URL] (given above) and Strategy 1:
Project ID: 28411155

About the project

1 proposal
Remote project
Active 3 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
1 freelancer is bidding on average $250 USD for this job
User Avatar
Hello! I am bidding on the project regarding Ruby elevator simulator program I have read your project description carefully. I am software developer and programmer have 7 years experience in it. I have few questions. I am waiting for your message in chat box. Thanks
$250 USD in 12 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of ROMANIA
Romania
0.0
0
Member since Dec 2, 2020

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.