Fork me on GitHub
#off-topic
<
2017-03-19
>
sova-soars-the-sora03:03:53

Hey anybody want to help me with an interview problem?

sova-soars-the-sora03:03:14

I don't know the exact problem yet but I know what the nature of the problem is...

sova-soars-the-sora03:03:26

Basically there are cabins that you rent out by the night, and people want to make reservations

sova-soars-the-sora03:03:42

Say you have 4 cabins and 10 guest-groups that are going to stay in them over the course of a month

sova-soars-the-sora03:03:25

The task is to find a good packing of timeslots so that all the guests get their preferred days and we also minimize the number of "gap days" or one-day-span free slots, since it's hard to rent out a remote cabin for just a single night.

qqq03:03:50

why are we not maximizing profit ?

sova-soars-the-sora03:03:40

Well, it kind of leads that direction. profit will increase with more reservations, we just want to pack them efficiently so that when new reservations surface we don't have fragmented days that we can't rent out.

sova-soars-the-sora03:03:18

But you're saying that maybe the cabins are different prices, and therefore we would want to maximize cha-ching$$

sova-soars-the-sora03:03:42

I'm just focused on the leave-no-one-day-gaps issue at the moment. But you're right, that's probably a smart way to go ...

qqq03:03:51

These details are important; they determine what algorithm should be used.

sova-soars-the-sora03:03:24

I have not received any details yet

sova-soars-the-sora03:03:31

But I was given a generous hint ^

sova-soars-the-sora03:03:43

So, I'm trying to do my mental prep beforehand ^^

sova-soars-the-sora03:03:25

but let's say instead of maximizing profit$ we are maximizing the number of contiguous stretches of free days...

jjl06:03:11

packing is NP complete, so it's good you only have small numbers to work with

sova-soars-the-sora07:03:00

Yeah, that's true! I was thinking ... np-complete, but then noticed there are quite a lot of "restraints" so-to-speak. It's 2D which is convenient, and it's possible to brute-force over all the solutions. It's certainly an interesting exercise

yogidevbear07:03:45

A lot of places do set quantities of days for rental (e.g. Fri to Mon, Fri to Fri, Mon to Fri, and Mon to Mon). You could possibly work that into the mix if they'd consider that route. It would negate the single day gap issue

jjl07:03:36

so i'm actually building a booking platform and i can tell you that much of the complexity of the entire exercise is in how to deal with booking and pricing rules

jjl07:03:13

aligning week-long bookings to start on a monday is a common thing, for example

jjl07:03:08

it would help if you had historical bookings data to determine how different strategies have fared in the past