A hostel made a mistake concerning their bookings for 2017 and took many reservations without checking for free rooms in these periods. Every reservations is made for exactly one room and one period of time. All rooms are equal but were sold for different prices. The hostel now wants to cancel some bookings so everybody will have a room but at the same time the hostel wants to minimize its lost earnings. How would you solve the problem? Is it possible that no guest needs to change rooms during his stay?
I want to model the situation as a MinimumCostFlow-Problem. Where each vertex represents a day. We also add vertices s and t as the source and sink. Edges between the verticees representing days should have infinite capacity and zero costs.
But I am still unfamiliar with the MinCostFlow-Problem and thus unsure how I need to set the flow constraints and other elements and appreciate any help.
Create the following interval graph $G=(V,E)$:
A path from $s$ to $t$ is a feasible schedule for the hotel: a set of consecutive reservations that can occupy the same room. You want as many of those possible, so a maximum flow will give you as many feasible reservations possible.
We have not considered the fact that reservations have different prices. To do so, add a cost $c_{v_1v_2}$ on each arc $(v_1,v_2)$, the price of the reservation (with a negative sign). You now want a maximum flow at minimum cost (as many reservations possible, at the best price possible).
This will give you schedules where guests remain in the same room. If you allow them to change, decompose the arcs $(v_1,v_2)$ in paths $v_{t_1}-v_{t_2}---v_{t_n}$ with one extra node $v_{t_i}$ per period of time, and add arcs $(u_{t_i},v_{t_j})$ accordingly with a unitary cost (to penalize changes of rooms).
A maximum flow at minimum cost will give you the desired solution.