osurs
0.0.1
|
Optimization of space utilization on routs. More...
#include "osurs/types.h"
Go to the source code of this file.
Functions | |
Seat * | new_seat (int seat_id) |
Create a new seat. More... | |
void | seat_add_reservation (Seat *seat, int res_id) |
Adds a new reservation to the seat. More... | |
void | delete_seat (Seat *seat) |
Delete a seat. More... | |
SeatCollection * | new_seat_collection (int seat_count, int seat_ids[]) |
Create a new seat collection. More... | |
void | delete_seat_collection (SeatCollection *collection) |
Delete a seat collection. More... | |
int | space_available (unsigned int res_arr[], int res_count, int segment_count, unsigned int seat_count, unsigned int new_res) |
Check if there is enough space available. More... | |
SeatCollection * | optimize_reservation (unsigned int res_arr[], int res_arr_count, int res_ids[], int segment_count, int seat_ids[], int seat_count) |
Optimize the reservations. More... | |
Optimization of space utilization on routs.
This module contains an algorithm to optimally distribute reservations along a route to the available seats.
void delete_seat | ( | Seat * | seat | ) |
Delete a seat.
Frees the memory of the given seat on the heap.
seat | The seat to delete. |
void delete_seat_collection | ( | SeatCollection * | collection | ) |
Delete a seat collection.
Frees the memory of the given seat collection on the heap.
collection | The seat collection to delete. |
Seat* new_seat | ( | int | seat_id | ) |
Create a new seat.
Initializes the seat properties and allocates the memory for the reservation array.
seat_id | The id of the seat. |
SeatCollection* new_seat_collection | ( | int | seat_count, |
int | seat_ids[] | ||
) |
Create a new seat collection.
Initializes the seat collection properties and allocates the memory for the seat array.
seat_count | The Number of seats. |
seat_ids[] | Array that contains all the seat ids. |
SeatCollection* optimize_reservation | ( | unsigned int | res_arr[], |
int | res_arr_count, | ||
int | res_ids[], | ||
int | segment_count, | ||
int | seat_ids[], | ||
int | seat_count | ||
) |
Optimize the reservations.
Places the reservations on the seats in a way that optimizes the capacity.
res_arr[] | The logical representation of each reservation. |
res_arr_count | The number of reservations in the res_array. |
res_ids[] | Array that contains the reservation ids |
segment_count | The number of segments on the route. (stops - 1) |
seat_ids[] | Array that contains the seat ids |
seat_count | The number of seats in the composition. |
void seat_add_reservation | ( | Seat * | seat, |
int | res_id | ||
) |
Adds a new reservation to the seat.
Initializes the seat properties and allocates the memory for the reservation array.
seat | The seat to which the reservation should be added. |
res_id | The reservation id. |
int space_available | ( | unsigned int | res_arr[], |
int | res_count, | ||
int | segment_count, | ||
unsigned int | seat_count, | ||
unsigned int | new_res | ||
) |
Check if there is enough space available.
Checks if the given reservation fits into the current configuration.
res_arr[] | The logical representation of each reservation. |
res_count | The number of reservations in the res_array. |
segment_count | The number of segments on the route. (stops - 1) |
seat_count | The number of seats. |
new_res | The logical representation of the new reservation. |