Merge fork for interoperability of KoMa solver
The KoMa developed a tool to approximate an optimal conference schedule based on constraints and participant preferences. The aim of this MR is to enable interoperability with that solver. To do this, two functionalities are added:
- A workflow to export data from this tool (rooms, AKs, timeslots, ...) in a JSON format that can be fed to the solver
- A workflow to import the schedule of the solver back into this
Note that the solver also needs preferences of all participants. As this tool does not collect such data (for now at least), one needs to employ a third tool, e.g. this very basic one.
Export data to the solver
The key functionality is the AKJSONExportView
which generates a JSON string that can be imported into the solver.
Notably, the KoMa solver models timeslots differently to this tool. Where this tool basically allows for arbitrary time slot design, the KoMa solver has a more constricted notion: The timeslots are modeled as blocks (i.e. simple lists) of consecutive timeslots of a fixed length. The AKs simply store an integer duration, i.e. the number of consecutive timeslots covered by the AK.
To convert the data of this tool into the solver's model, the following strategy is implemented (see Event::default_time_slots
, Event::merge_blocks
):
- all
DefaultSlot
instances are discretized into timeslots of a uniform length (beginning at thestart
and dropping partial timeslots at the end) → eachDefaultSlot
forms a "block" - Consecutive blocks are merged. Overlapping timeslots are identified with each other, but partial overlap errors out
The unit tests are expanded quite a bit to test the correctness of the export.
Import a schedule from the solver
This is realized in the form JSONImportForm
and the corresponding view AKJSONImportView
.
The JSON string is simply read from the form and passed to Event::schedule_from_json
.
Minor changes
- Bump python version to 3.10
-
Availability::{merge_with,intersect_with}
: If both objects are from the sameEvent
, set the event also for the returnedAvailability
object - Add utility class-method
Availibility::is_event_covered
to check ifEvent
is covered by a list ofAvailability
objects- (Possible bug in
Availability::with_event_length
: To my understanding the returned availability does in fact not have the exact duration of `event
- (Possible bug in
-
ak_requirements_changed_handler
: Skip slots with no set room - Add
beautifulsoup4
to test requirements
AKModel/models.py
)
Changes to model objects (
Event
-
Event::_generate_slots_from_block
: Given a start and time as well as a slot duration, discretizes it into blocks of consecutive discrete time slots.- Slots are dropped if no room is available for the slot.
- If
end - start
is not a multiple ofduration
, the last slot is dropped as well.
-
Event::uniform_time_slots
to uniformly discretize the full event into blocks of time slots:- For the block creation, see
Event::_generate_slots_from_block
- Adds constraints to allow all AKCategories in each timeslot
- For the block creation, see
-
Event::default_time_slots
to derive blocks by uniformly discretizingDefaultSlots
- Splits each
DefaultSlot
of the event into one block. - Adds constraints such that only AKs from the DefaultSlot's primary categories are allowed to be scheduled in the block
- Splits each
-
Event::merge_blocks
: Merge blocks in iterable- Flatten blocks into list of all timeslots
- If two slots overlap:
- If start and end match: merge slots
- If overlap only partial: error out
- group consecutive slots into block
-
Event::discretize_timeslots
: To select the discretization scheme -
Event::schedule_from_json
: Load scheduling from json file, i.e. assign each slot a room, start time and duration - Add field
export_slot
to Event to store the discretization granularity for the JSON export
AKCategory
-
AKOwner::create_category_constraints
: static method to create constraint strings for all AKCategories in iterable
Room
-
Room::as_json
: Export JSON representation for the room object
AKSlot
-
AKSlot::as_json
: Export JSON representation for theAK
object of this slot
Open ToDos
Merge request reports
Activity
added 5 commits
Toggle commit listadded 14 commits
- c7b910c2...fd6adb0e - 4 earlier commits
- 61922712 - Detach merge_blocks from Event object
- 8d049baa - Make tests more descriptive
- c73020b0 - Use uniform discretization if no default slots exist
- 1661b359 - Add more comments
- 53dfe886 - Fix docstr placement
- ec5c79e7 - Fix import
- 05dbef0b - Add json import/export view to test for only internal access
- 4505f33b - Fix event filter
- 1ae6e916 - Fix typo
- aee5627c - Merge branch 'refactor-main' into 'main'
Toggle commit listadded 6 commits
Toggle commit listadded 2 commits
mentioned in merge request felix_bonn/akplanning!18 (closed)
added 11 commits
-
c2e5f573...2046c90b - 10 commits from branch
kif:main
- 9237c47c - Merge remote-tracking branch 'upstream'
-
c2e5f573...2046c90b - 10 commits from branch
added 16 commits
-
abbe82a1...adaa6e7a - 15 commits from branch
kif:main
- 1d0e2aaf - Merge remote-tracking branch 'upstream/main'
-
abbe82a1...adaa6e7a - 15 commits from branch