AKSolverInterface.serializers module

class AKSolverInterface.serializers.ExportRoomInfoSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer of Room objects for the ‘info’ field.

Used in ExportRoomSerializer to serialize Room objects for the export to a solver. Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

class AKSolverInterface.serializers.ExportRoomSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Export serializer for Room objects.

Used to serialize Room objects for the export to a solver. Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

class AKSolverInterface.serializers.ExportAKSlotInfoSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer of AKSlot objects for the ‘info’ field.

Used in ExportAKSlotSerializer to serialize AKSlot objects for the export to a solver. Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

get_head(slot: AKSlot) str[source]

Get string representation for ‘head’ field.

class AKSolverInterface.serializers.ExportAKSlotPropertiesSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer of AKSlot objects for the ‘properties’ field.

Used in ExportAKSlotSerializer to serialize AKSlot objects for the export to a solver. Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

class AKSolverInterface.serializers.ExportAKSlotSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Export serializer for AKSlot objects.

Used to serialize AKSlot objects for the export to a solver. Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

__init__(*args, export_scheduled_aks_as_fixed: bool = False, **kwargs)[source]
get_room_constraints(slot: AKSlot)[source]

Get serialized representation for room_constraints.

Used to pass export_scheduled_aks_as_fixed to AKSlot’s function.

get_time_constraints(slot: AKSlot)[source]

Get serialized representation for time_constraints.

Used to pass export_scheduled_aks_as_fixed to AKSlot’s function.

class AKSolverInterface.serializers.ExportParticipantAndDummiesSerializer(*args, **kwargs)[source]

Bases: BaseSerializer

Export serializer for EventParticipant objects that includes ‘dummy’ participants.

This serializer is a work-around to make the solver compatible with the AKOwner model.

Internally, ExportParticipantSerializer is used to serialize all EventParticipants of the event to serialize. To avoid scheduling conflicts, a ‘dummy’ participant is then added to the list for each AKOwner of the event. These dummy participants only have ‘required’ preference for all AKs of the owner, so the target of the optimization is not impacted.

Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

__init__(*args, slots_qs: QuerySet = None, filter_participants_cb: Callable[[QuerySet], QuerySet], **kwargs)[source]
class AKSolverInterface.serializers.ExportEventInfoSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

Serializer of an Event object for the ‘info’ field.

Used in ExportEventSerializer to serialize an Event object for the export to a solver. Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

class AKSolverInterface.serializers.ExportTimeslotBlockSerializer(*args, **kwargs)[source]

Bases: BaseSerializer

Read-only serializer for timeslots.

Used to serialize timeslots for the export to a solver. Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

__init__(*args, export_scheduled_aks_as_fixed: bool = False, **kwargs)[source]
to_representation(instance: Event)[source]

Construct serialized representation of the timeslots of an event.

class AKSolverInterface.serializers.ExportEventSerializer(*args, **kwargs)[source]

Bases: BaseSerializer

Export serializer for an Event object.

Allows filtering of the exported AKSlots and Rooms by passing a filter callback function as a kwarg to __init__

Used to serialize an Event for the export to a solver. Part of the implementation of the format of the KoMa solver: https://github.com/Die-KoMa/ak-plan-optimierung/wiki/Input-&-output-format#input–output-format

__init__(*args, filter_participants_cb: Callable[[QuerySet], QuerySet] | None = None, filter_slots_cb: Callable[[QuerySet], QuerySet] | None = None, filter_rooms_cb: Callable[[QuerySet], QuerySet] | None = None, export_scheduled_aks_as_fixed: bool = False, **kwargs)[source]
to_representation(instance: Event)[source]

Object instance -> Dict of primitive datatypes.