-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
236 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
# Algoritme | ||
|
||
Algoritmen baserer seg på MIP-programmering (Mixed Integer Linear Programming). | ||
**mip_matching** er en pakke for å tildele intervjutider til søkere basert på ledige tider for søkere og komitéer. | ||
|
||
Algoritmen baserer seg på MIP-programmering (Mixed Integer Linear Programming). Se [Modellering.md](./src/Modellering.md) for detaljer. | ||
|
||
## Setup Python Venv | ||
|
||
```bash | ||
cd algorithm | ||
python -m venv ".venv" | ||
``` | ||
|
||
``` | ||
.\.venv\Scripts\activate | ||
pip install -e . | ||
pip install -r requirements.txt | ||
pip install pymongo[srv] | ||
``` | ||
|
||
## TODOs | ||
|
||
- [x] Lage funksjon som deler opp fra en komités slot | ||
- [x] Sette opp begrensningene fra modelleringen | ||
- [ ] Flikke litt på modelleringen. | ||
- [ ] Finn ut hvordan man kan preprosessere dataen for å få ned kjøretiden (f. eks ved å lage lister av personer for hver komité.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Typealiaser | ||
""" | ||
|
||
from typing import TypedDict, TYPE_CHECKING | ||
import mip | ||
if TYPE_CHECKING: | ||
# Unngår cyclic import | ||
from mip_matching.Applicant import Applicant | ||
from mip_matching.Committee import Committee | ||
from mip_matching.TimeInterval import TimeInterval | ||
|
||
|
||
type Room = str | ||
type Matching = tuple[Applicant, Committee, TimeInterval, Room] | ||
|
||
class MeetingMatch(TypedDict): | ||
"""Type definition of a meeting match object""" | ||
solver_status: mip.OptimizationStatus | ||
matched_meetings: int | ||
total_wanted_meetings: int | ||
matchings: list[Matching] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
from __future__ import annotations | ||
from datetime import datetime, timedelta | ||
import unittest | ||
from mip_matching.TimeInterval import TimeInterval | ||
from mip_matching.Committee import Committee | ||
# from __future__ import annotations | ||
# from datetime import datetime, timedelta | ||
# import unittest | ||
# from mip_matching.TimeInterval import TimeInterval | ||
# from mip_matching.Committee import Committee | ||
|
||
|
||
class ApplicantTest(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.committee = Committee( | ||
"TestKom", interview_length=timedelta(minutes=30)) | ||
self.committee.add_intervals_with_capacities({ | ||
TimeInterval(datetime(2024, 8, 24, 8, 0), datetime(2024, 8, 24, 9, 30)): 1, | ||
TimeInterval(datetime(2024, 8, 24, 8, 30), datetime(2024, 8, 24, 9, 30)): 1 | ||
}) | ||
# class ApplicantTest(unittest.TestCase): | ||
# def setUp(self) -> None: | ||
# self.committee = Committee( | ||
# "TestKom", interview_length=timedelta(minutes=30)) | ||
|
||
|
||
def test_capacity_stacking(self) -> None: | ||
self.assertEqual(1, self.committee.get_capacity( | ||
TimeInterval(datetime(2024, 8, 24, 8, 0), datetime(2024, 8, 24, 8, 30)))) | ||
self.assertEqual(2, self.committee.get_capacity( | ||
TimeInterval(datetime(2024, 8, 24, 8, 30), datetime(2024, 8, 24, 9, 0)))) | ||
|
Oops, something went wrong.