from hotel import Hotel h = Hotel() h.menu()
def main(): print("Time to book") hotel = Hotel("California", 5, 10) print(hotel)
def fill_test(self): show=notification.Notifications() Rotana_hotel = Hotel(1,"Rotana","Abu Dhabi",200,40) Rotana_hotel.add_hotel() show.display(Rotana_hotel) # Display General details for ONE hotels Sheraton_hotel = Hotel(2,"Sheraton","Abu Dhabi",300,100) Sheraton_hotel.add_hotel() Hayat_hotel = Hotel(3,"Hayat","Aden",150,100) Hayat_hotel.add_hotel() Crecent_hotel = Hotel(4,"Crecent","Mukala",200,50) Crecent_hotel.add_hotel() Holydayin_hotel = Hotel(5,"Holydayin","Sana'a",200,100) Holydayin_hotel.add_hotel() Rotana_hotel = Hotel(1,"Rotana","Abu Dhabi",200,40) Rotana_hotel.add_hotel() Zero_hotel = Hotel(6,"Zero","Virtual",200,0) # used to check unavailablity condition Zero_hotel.add_hotel() show.display("\t list of the Hotels available") show.display(Hotel.hotels) # Display General details for all hotels show.display(Hayat_hotel.hotel_name) # Display the name for ONE hotel #Create instance objects for 4 customers Saqr_Thabet=Reservation("Hayat","Saqr_thabet","+8613094449161") Ali_Ahmed=Reservation("Holydayin","Ali_ahmed","+8613094449161") Ameer_Nezar=Reservation("Holydayin","Ameer_nezar","+8613094449161") Galal_Taleb=Reservation("Zero","Galal_taleb","+8613228191565") #Create reservations for 4 customers if Saqr_Thabet.add_new_reservation(): s_t=Customer(Saqr_Thabet.hotel_name,Saqr_Thabet.customer,Saqr_Thabet.number) s_t.add_customer() show.display(Saqr_Thabet.message) #show.display(Saqr_Thabet.reservations) #show.send_message(Saqr_Thabet.message,Saqr_Thabet.number) if Ali_Ahmed.add_new_reservation(): m_a=Customer(Ali_Ahmed.hotel_name,Ali_Ahmed.customer,Ali_Ahmed.number) m_a.add_customer() show.display(Ali_Ahmed.message) #show.display(Ali_Ahmed.reservations) #show.send_message(Ali_Ahmed.message,Ali_Ahmed.number) if Ameer_Nezar.add_new_reservation(): m_b=Customer(Ameer_Nezar.hotel_name,Ameer_Nezar.customer,Ameer_Nezar.number) m_b.add_customer() show.display(Ameer_Nezar.message) #show.display(Ameer_Nezar.reservations) #show.send_message(Ameer_Nezar.message,Ameer_Nezar.number) #def Test_reservation_disapproval(): show.display("\t Test_reservation_disapproval ") if Galal_Taleb.add_new_reservation(): # no rooms available m_c=Customer(Galal_Taleb.hotel_name,Galal_Taleb.customer,Galal_Taleb.number) #show.display(Galal_Taleb.message) #show.display(Galal_Taleb.reservations) #m_a1.send_message(Galal_Taleb.message,Galal_Taleb.number) #def Test_misspelled_hotel_name(): show.display("\t Test_misspelled_hotel_name ") Fagr_khalil=Reservation("Holyday","Fagr_Khalil","+8613094449161") Fagr_khalil.add_new_reservation() #def Test_delete_a_customer(): show.display('\t Test_delete_a_customer') show.display(m_b.customer_list) m_a.delete_customer() # delete customer from customer Class show.display(m_b.customer_list) #def Test_reservation_removal(): show.display('\t Test_reservation_removal') show.display(Ameer_Nezar.reservations) Ameer_Nezar.delete_a_reservation() # delete customer booking from reswervation Class show.display(Ameer_Nezar.reservations) #def Test_delete_a_hotel(): show.display('\t Test_delete_a_hotel') show.display(Hotel.hotels) Rotana_hotel.delete_hotel() show.display(Hotel.hotels) #def Test_reservation_in_a_hotel(hotel): show.display("\t Test_reservation_in_a_hotel('Holydayin')") show.display(reservation.list_resevrations_for_hotel('Holydayin')) #from reservation.py #def Test_list_of_available_hotels_in_a_city(city): show.display("\t Test_list_of_available_hotels_in_a_city('Abu Dhabi')") show.display(hotel.list_hotels_in_city('Abu Dhabi')) # from hotel.py
def start(): help_text() run = True hotel_name = None hotel_address = None hotel_created = False while run: if not hotel_name: hotel_name = input("Hotel name? ").upper() if not hotel_address: hotel_address = input("Hotel address? ").upper() if not hotel_name and not hotel_address: continue if not hotel_created: hotel = Hotel(hotel_name, hotel_address) hotel_created = True clear_screen() user_choice = input("What would you like to do? ").upper() if user_choice not in ['C', 'R', 'L', 'LR1', 'LR2', 'LR3', 'Q', 'H']: print("sorry dont recognise that choice!") continue if user_choice == 'Q': clear_screen() print("Good bye!") run = False if user_choice == 'H': clear_screen() help_text() if user_choice == 'LR1': clear_screen() hotel.list_rooms(1) if user_choice == 'LR2': clear_screen() hotel.list_rooms(2) if user_choice == 'LR3': clear_screen() hotel.list_rooms(3) if user_choice == 'C': clear_screen() reservation_id = input("What is the reservation id? ") if not reservation_id: print("You did not enter a reservation id") continue checkout(int(reservation_id), hotel) if user_choice == 'R': clear_screen() guest_name = input("Name of the Guest? ") guest_address = input("Address ? ") guest_phone = input("Phone number? ") if not guest_name or not guest_address or not guest_phone: print("You missed some key guest information!") continue guest = Guest(guest_name, guest_address, guest_phone) clear_screen() print("What kind of room do you want to reserve?") room_type = input("1 for single, 2 for double, 3 for suite ") if not room_type: print("you did not enter a room type!") continue print("len of single rooms before the pop {}".format( len(hotel.single_bedrooms))) # get a room from the hotel if room_type == '1': if len(hotel.single_bedrooms) < 1: print("No single rooms available") continue room = hotel.single_bedrooms.pop() if room_type == '2': if len(hotel.double_bedrooms) < 1: print("No double rooms available") continue room = hotel.double_bedrooms.pop() if room_type == '3': print("hello") if len(hotel.suites) < 1: print("No suites available") continue room = hotel.suites.pop() print("how long will you be staying") date_from = input("From date? ") date_to = input("To date? ") if not date_from or not date_to: print("""If you dont provide how long you will be staying, we will assume you are staing a day""") res = Reservation(random_res_id(), guest, room) else: res = Reservation(random_res_id(), guest, room, date_from, date_to) hotel.reservations.append(res) print("reservation made!") clear_screen() if user_choice == 'L': clear_screen() hotel.list_reservations()
def run_simulation(): ###parameters set_price=71 # sets average price shown by revenue manager gamma = 20 # sets width of booking time distribution average_number_of_potential_customers = 100 min_budget=30 capacity = 76 # No. of rooms in hotel ###Weights of price for month and day of week variation month_prob = [0.75,0.8,0.95,0.9,1.,0.95,0.95,1.,1.,1.,1.1,1.2] dow_prob = [1,1,1,1,1,1,0.7] gamma_weights = [1.1,0.8,1.2,1.1,0.6,1.1,1.2,0.9,0.7,1.0,0.9,0.9] gamma_weights_dow = [1.05,1.05,1.05,1.05,0.9,0.95,0.8] ###Start/End date start_reserved_night_date = dt.datetime(2018, 1, 1) end_reserved_night_date = dt.datetime(2018, 12, 30) ###Define Hotel. (Doesn't do much now, but in future will have multiple merchants/room types) hotel = Hotel(merchant_id=1, capacities={10: capacity}, available_rooms=[10]) #Initial prices for each DOW prices = { 10: {0: set_price, 1: set_price, 2: set_price, 3: set_price, 4: set_price, 5: set_price, 6: set_price}, } ###Open and write first line of output files with open("transformed_data.csv", "w") as data: writer = csv.writer(data, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) writer.writerow(['hotelroom_id','reserved_night_date','booking_datetime','type','price']) person_data=open("person_data.csv", "w") pers_writer = csv.writer(person_data, delimiter=',', quotechar='"',quoting=csv.QUOTE_MINIMAL) pers_writer.writerow(['booking_datetime','price']) ###Call revenue manager (currently very simple human like) lead_rm = LeadRevenueManager(prices=prices, hotel=hotel, start_reserved_night_date=start_reserved_night_date, end_reserved_night_date=end_reserved_night_date) start_date = start_reserved_night_date - dt.timedelta(days=gamma * 10) end_date = end_reserved_night_date ### initialise number of customers, budget and interested date market = Market(start_date=start_date, start_reserved_night_date=start_reserved_night_date, end_reserved_night_date=end_reserved_night_date, average_number_of_potential_customers=average_number_of_potential_customers, minimum_budget_in_population=min_budget,gamma=gamma,gamma_weights_months=gamma_weights, gamma_weights_dow=gamma_weights_dow,month_prob=month_prob,dow_prob=dow_prob,capacity=capacity ) ### iterate over lead time for delta in range((end_date-start_date).days): time = start_date + dt.timedelta(days=delta) #print("Processing",time) RND = start_reserved_night_date + dt.timedelta(days=delta) if RND<end_date: person_np = market._create_persons(RND,pers_writer) if delta == 0: person = person_np else: person = np.vstack([person,person_np]) where = (person[:,6]==delta) lead_rm = market.generate_bookings_for_lead_time(lead_rm,person,time,where) inv_where=np.invert(where) person = person[inv_where] ###Output bookings= np.array([[0,dt.datetime(2018,1,1),0]]*len(lead_rm._current_bookings)) bookings[:,0] = lead_rm._current_bookings[:,2] bookings[:,1] = lead_rm._current_bookings[:,0] bookings[:,2] = lead_rm._current_bookings[:,1] df= pd.DataFrame(data=bookings) df.columns=['hotelroom_id','reserved_night_date','units'] df.to_csv('transformed_room_nights.csv',index=False) person_data.close() ### Return total revenue return lead_rm._revenue
if __name__ == "__main__": controller = Controller() customer1 = Customer("Naga", "Regular") controller.add_customers_details(customer1) customer2 = Customer("Rani", "Reward") controller.add_customers_details(customer2) customer3 = Customer("Raja", "Regular") controller.add_customers_details(customer3) customer4 = Customer("raveena", "Reward") controller.add_customers_details(customer4) customer5 = Customer("Nithya", "Regular") controller.add_customers_details(customer5) Lakewood = Hotel("Lakewood", 3) Lakewood.add_price_details(110, 90, 80, 80) controller.add_hotels_details(Lakewood) Bridgewood = Hotel("Bridgewood", 4) Bridgewood.add_price_details(160, 60, 110, 50) controller.hotels_details.append(Bridgewood) Ridgewood = Hotel("Ridgewood", 5) Ridgewood.add_price_details(220, 150, 100, 40) controller.add_hotels_details(Ridgewood) result, username, user_dates = controller.user_input() result, user_booking_days = controller.convert_dates_to_days(user_dates) week_days, week_ends = controller.seperate_days(user_booking_days) customer = controller.get_customer_type(username)