@@ -707,21 +707,21 @@ still did not use the `priority` attribute when performing the allocations. In t
you will have to modify the `add_reservation` controller function such that some reservations
have a higher priority over others.
When a a high priority reservation comes and there is no space left many different things
When a high priority reservation comes and there is no space left many different things
could be done. For example, previous reservations can be moved to make space, reservations
with lower priority can be deleted to make space, etc. As a guide we propose you one way,
which is the one we will provide as a solution. Our proposed solution is not perfect, but
with lower priority can be deleted to make space, etc. We propose one possible implementation,
which will then be the one we will provide as a solution. Our proposed solution is not perfect, but
does well enough while not needing a major change to the current implementation. In any case,
feel free to implement a different algorithm.
We propose the following algorithm:
1. if the reservation (addition or modification) fits in the current network we do the same than before.
2. if the reservation (addition or modification) does not fit in the network:
1. remove all the reservations with a lower prioiry than the requested one. Hint: you don't need to really remove them from switches, you can just remove its capacities.
2. Check if the requested reservation fits the network without the lower priority ones.
3. if it fits, add or modify it. Now, take all the reservations with lower priority that you `virtually` removed, and allocate them starting with the ones with highest priority. Some will remain in the same path, some will be moved to a new path. If they don't fit anymore, delete them.
4. if it does not fit remove the entry if this is a modification (the entry already existed)
2. if the reservation (addition or modification) does not fit in the current network:
1. remove (`virtually`) all the reservations with a lower priority than the requested one. Hint: you don't need to remove them from switches, you can just remove its capacities.
2. Check if now, (without the low priority reservations) the requested reservation fits the network.
3. if it fits, add or modify it. Now, take all the reservations with lower priority that you `virtually` removed, and allocate them starting with the ones with the highest priority. Some will remain in the same path, some will be moved to a new path, and some, if they don't fit anymore, will be deleted.
4. if it does not fit, if there is an existing entry for this reservation, delete it.
> Hint: make sure `self.links_capacity` is updated properly in each of your steps. Sometimes, when you virtually remove
reservations you will have to add the capacity to links.