From 9c6f15f6dbfdeee10c28513d4be5d9f230679931 Mon Sep 17 00:00:00 2001 From: Frederik Arnold <frederik.arnold@hu-berlin.de> Date: Thu, 16 Mar 2023 08:42:23 +0100 Subject: [PATCH] Add problem description and print list of papers which were not assigned to a time slot --- notebooks/Optimization.ipynb | 53 ++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/notebooks/Optimization.ipynb b/notebooks/Optimization.ipynb index e593332..46ee18f 100644 --- a/notebooks/Optimization.ipynb +++ b/notebooks/Optimization.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "df593963", + "id": "4e9207f1", "metadata": {}, "source": [ "# Optimization Example\n", @@ -11,7 +11,7 @@ "\n", "## Problem Description\n", "\n", - "TBD\n", + "Given a set of papers, a set of reviewers, which are a assigned to the papers a and set of time slots from which the reviewers selected their availabilty, we want to assign the papers to time slots in such a way that the optimal number of papers can be discussed with the reviewers. Papers with disagreeing reviews, i.e. the paper score is close to 0, should be assigned with higher priority.\n", "\n", "## General approach\n", "\n", @@ -19,12 +19,12 @@ "2. Remove combinations which are impossible to satisfy because authors have conflicting time slot preferences.\n", "3. Add a contraint to limit the number of time slots.\n", "4. Add a constraint to make sure that a paper can only appear in up to one time slot.\n", - "5. Solve" + "5. Solve." ] }, { "cell_type": "markdown", - "id": "0e2d98ee", + "id": "d43e2d19", "metadata": {}, "source": [ "## Dependencies" @@ -33,7 +33,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5a732db1", + "id": "fa369056", "metadata": {}, "outputs": [], "source": [ @@ -43,7 +43,7 @@ { "cell_type": "code", "execution_count": null, - "id": "64604da8", + "id": "7d617f38", "metadata": {}, "outputs": [], "source": [ @@ -54,7 +54,7 @@ }, { "cell_type": "markdown", - "id": "97cdf625", + "id": "27e8cff1", "metadata": {}, "source": [ "## Data structures" @@ -63,7 +63,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7036ad2e", + "id": "7e971701", "metadata": {}, "outputs": [], "source": [ @@ -80,7 +80,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e8352c4f", + "id": "846517b8", "metadata": {}, "outputs": [], "source": [ @@ -101,7 +101,7 @@ }, { "cell_type": "markdown", - "id": "405bf280", + "id": "36d5ab0d", "metadata": {}, "source": [ "## Functions" @@ -110,7 +110,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8b90cf13", + "id": "d737af19", "metadata": {}, "outputs": [], "source": [ @@ -157,7 +157,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dcd2472b", + "id": "23670286", "metadata": {}, "outputs": [], "source": [ @@ -186,7 +186,7 @@ }, { "cell_type": "markdown", - "id": "a09dfb77", + "id": "c9268636", "metadata": {}, "source": [ "## Test data" @@ -195,7 +195,7 @@ { "cell_type": "code", "execution_count": null, - "id": "61224383", + "id": "4db0d156", "metadata": {}, "outputs": [], "source": [ @@ -222,7 +222,7 @@ }, { "cell_type": "markdown", - "id": "56c78a45", + "id": "b96637c3", "metadata": {}, "source": [ "## The Model" @@ -231,12 +231,12 @@ { "cell_type": "code", "execution_count": null, - "id": "daafd13a", + "id": "69c85176", "metadata": {}, "outputs": [], "source": [ "max_time_slots = 2\n", - "max_slot_size = 2\n", + "max_slot_size = 3\n", "\n", "all_time_slots = [tuple(c) for c in pulp.allcombinations(papers, max_slot_size)]\n", "possible_time_slots = []\n", @@ -268,27 +268,28 @@ "if status == 1:\n", " slot_count = 1\n", "\n", + " assigned_papers = []\n", + " \n", " print(f\"The best time slots are:\")\n", " for ts in possible_time_slots:\n", " if x[ts].value() == 1.0:\n", " print(f'\\nSlot {slot_count}:')\n", "\n", " for p in ts:\n", + " assigned_papers.append(p)\n", " print(f'\\n{p}')\n", "\n", " slot_count += 1\n", - "\n", + " \n", + " diff = set(papers) - set(assigned_papers)\n", + " \n", + " if len(diff) > 0:\n", + " print('\\nThe following papers were not assigned to a time slot:')\n", + " for p in diff:\n", + " print(f'\\n{p}')\n", "else:\n", " print('Problem could not be solved!')" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "856d62e2", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { -- GitLab