Skip to content
Snippets Groups Projects
Commit 43f0f7f5 authored by beekmannju85374's avatar beekmannju85374 :writing_hand:
Browse files

Merge branch 'master' into 'main'

updated comments

See merge request !16
parents 9d76769a 606708a1
No related branches found
No related tags found
1 merge request!16updated comments
backup/
Bachelorarbeit/
presentations.aux
presentations.fdb_latexmk
presentations.fls
......
......@@ -100,7 +100,7 @@ generateSchedules rooms startDay endDay professors = groups
-- the possible dates x room must be >= the number of professors and their projects in order to combine them
groups
| length days * length rooms < projectsLen = error "not enough possible dates or rooms for scheduling"
| otherwise = map (splitIntoGroups (fairRest projectsLen) . sortByRoom) $ combinationsFast projectsLen (sort presentations) -- try complexity with sort and without
| otherwise = map (splitIntoGroups (fairRest projectsLen) . sortByRoom) $ combinationsFast projectsLen (sort presentations) -- TODO: try complexity with sort and without
-- after combining the presentations, split each list into the fairest groups
saveToFile :: [[Presentation]] -> FilePath -> IO ()
......@@ -113,10 +113,9 @@ loadFromFile filename = do
str <- readFile filename
return $ map (map read . lines) (splitOn "\n\n" str)
-- a presentationgroup should have 3 to 5 projects each
-- a presentationgroup should have 3 to 5 projects
-- finds the fairest 3,4,5 grouping for n projects
-- a fair grouping is either where every group has the same amount of projects or where one group has one less or one more project than all the others
-- lowest remainder = 1 means last group has one more project, lowest dif remainder = 1 means last group has one less project
-- if 5 is the fairest with rest 1 change to resultDif because you cannot have groupings of 6
-- if 3 is the fairest with dif rest 1 change to result because you cannot have groupings of 2
......@@ -141,9 +140,8 @@ fairRest n
-- ( n, x, n%x, x - (n%x) )
fairRestDebug :: Int -> [(Int, Int,Int,Int)]
fairRestDebug n = result
fairRestDebug n = modResults
where
result = modResults
modResult x = (n, x, n `mod` x, x - (n `mod` x))
modResults = map modResult [5,4,3]
......@@ -155,7 +153,6 @@ splitIntoGroups n xs
| n > 0 = take n xs : splitIntoGroups n (drop n xs)
| otherwise = []
-- choose n from [a] without repeats
combinations :: Eq a => Int -> [a] -> [[a]]
combinations 0 _ = [[]]
......@@ -173,7 +170,6 @@ filterPresentations x = filter (\p -> (professor p, project p) /= (professor x,
&& (room p, day p) /= (room x, day x)
&& (professor p, day p) /= (professor x, day x))
-- tries to find the most even schedule
-- if less than 6 projects it will return schedules in all the same room
-- if the amount of groups are even: no mix of rooms inside a group
......@@ -237,19 +233,18 @@ addProfUnavailability prof unavailables rooms startDay endDay oldPresentations =
updatedPresentations = filter (\pres -> professor pres /= prof) oldPresentationsFlat
newGroups = addProfessor updatedProf rooms startDay endDay [updatedPresentations] --bland grouping for addProfessor
-- ein Professor braucht nur eine Präsentation pro Projekt = jeder Professor muss in einer Liste von Präsentation mit seinen Präsentationen vertreten sein
-- one prof only needs one presentation per project
hasUniqueProjectProf :: [Presentation] -> Bool
hasUniqueProjectProf presList = length (nub $ map (\p -> (professor p, project p)) presList) == length presList
-- eine Liste von Präsentationen darf keine Listen enthalten die zwei Präsentationen auf den selben Raum am gleichen Tag legen
-- only one presentation in the same room on the same date
hasUniqueDaysRooms :: [Presentation] -> Bool
hasUniqueDaysRooms presList = length (nub $ map (\p -> (day p, room p)) presList) == length presList
-- ein Prof kann an einem Tag nicht zwei Vorträge betreuen
-- one prof can only supervise one project at the same day
hasUniqueDaysProf :: [Presentation] -> Bool
hasUniqueDaysProf presList = length (nub $ map (\p -> (professor p, day p)) presList) == length presList
groupByDay :: [Presentation] -> [[Presentation]]
groupByDay presentations = groupBy (\x y -> day x == day y && room x == room y) (sort presentations)
......@@ -330,7 +325,6 @@ detailedPrint p = "Presentation {room = " ++ show (room p) ++
", project = " ++ show (project p) ++
", professor = " ++ show (professor p) ++ "}"
{-
-- CSV handling:
......@@ -362,21 +356,21 @@ generateLaTeX :: [[Presentation]] -> String
generateLaTeX presentations = unlines $ header ++ zipWith formatGroup [1..] presentations ++ footer
where
header =
[ "\\documentclass[a4paper]{article}"
, "\\usepackage{geometry}"
, "\\geometry{a4paper, margin=1in}"
, "\\usepackage[ngerman]{babel}"
, "\\usepackage{titling}"
, "\\usepackage{fancyhdr}"
, "\\pagestyle{fancy}"
, "\\fancyhf{}"
, "\\renewcommand{\\headrulewidth}{0pt}"
, "\\rhead{Stand: \\today}"
, "\\lhead{\\thetitle}"
["\\documentclass[a4paper]{article}",
"\\usepackage{geometry}",
"\\geometry{a4paper, margin=1in}",
"\\usepackage[ngerman]{babel}",
"\\usepackage{titling}",
"\\usepackage{fancyhdr}",
"\\pagestyle{fancy}",
"\\fancyhf{}",
"\\renewcommand{\\headrulewidth}{0pt}",
"\\rhead{Stand: \\today}",
"\\lhead{\\thetitle}",
-- CHANGE TITLE HERE
, "\\title{IT-Projekte XxXx 20YY}"
, "\\begin{document}"
"\\title{IT-Projekte XxXx 20YY}",
"\\begin{document}"
]
footer = ["\\end{document}"]
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed.
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment