Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| lehrkraefte:blc:informatik:glf25:glueckswerkstatt:plan [2025/10/29 08:17] – created Ivo Blöchliger | lehrkraefte:blc:informatik:glf25:glueckswerkstatt:plan [2025/11/03 06:49] (current) – [Wichtige Code-Schnipsel] Ivo Blöchliger | ||
|---|---|---|---|
| Line 18: | Line 18: | ||
| === 1. Priorität eines Teilnehmers s === | === 1. Priorität eines Teilnehmers s === | ||
| <code python> | <code python> | ||
| - | workshop_nummer = plan.o[s][0] | + | workshop_nummer = plan.o[s][0] |
| </ | </ | ||
| === Workshop w zur Zeit t schon voll? === | === Workshop w zur Zeit t schon voll? === | ||
| <code python> | <code python> | ||
| if plan.b[w][t] >= plan.m[w]: | if plan.b[w][t] >= plan.m[w]: | ||
| - | # Tu wat | + | # Tu wat, wenn Workshop w zur Zeit t schon voll |
| else: | else: | ||
| - | # Tu wat anderes | + | # Tu wat anderes, wenn noch Platz im Workshop w zur Zeit t |
| </ | </ | ||
| Line 33: | Line 33: | ||
| w = plan.o[s][i] | w = plan.o[s][i] | ||
| if plan.b[w][t] < plan.m[w]: | if plan.b[w][t] < plan.m[w]: | ||
| - | plan.schedule(s, | + | |
| + | if not w in plan.x[s] | ||
| + | | ||
| </ | </ | ||
| Mögliche Variante für obigen Code: Mögliche Zeitfenster innerhalb der '' | Mögliche Variante für obigen Code: Mögliche Zeitfenster innerhalb der '' | ||
| === Umteilen === | === Umteilen === | ||
| - | Teilnehmer suchen, die zur Zeit '' | + | Teilnehmer suchen, die zur Zeit '' |
| <code python> | <code python> | ||
| + | umteilbar = [] | ||
| for s in range(plan.S): | for s in range(plan.S): | ||
| if not plan.laueri[s]: | if not plan.laueri[s]: | ||
| - | if plan.x[s][t]==plan.o[s][p1]: | + | if plan.x[s][t]==plan.o[s][p1]: |
| w2 = plan.o[s][p2] | w2 = plan.o[s][p2] | ||
| if plan.b[w2][t]< | if plan.b[w2][t]< | ||
| + | umteilbar.append(s) | ||
| </ | </ | ||
| + | === Zufällige Reihenfolge === | ||
| + | Hier am Beispiel der Teilnehmernummern | ||
| + | <code python> | ||
| + | import random | ||
| + | randomS = list(range(plan.S)) | ||
| + | random.shuffle(randomS) | ||
| + | for s in randomS: | ||
| + | # Tu wat mit s | ||
| + | </ | ||