#Student Dorm Optimization
import random
import math
dorms = ['Zeus','Athena','Hercules','Bacchus','Pluto']
prefs = [('Toby',('Bacchus','Hercules')),('Steve',('Zeus','Pluto')),('Andrea',('Andrea','Zeus')),
('Sarah',('Zeus','Pluto')),('Dave',('Athena','Bacchus')),('Jeff',('Hercules','Pluto')),
('Fred',('Pluto','Athena')),('Suzie',('Bacchus','Hercules')),('Laura',('Bacchus','Hercules')),
('Neil',('Hercules','Athena'))]
domain = [(0,(len(dorms)*2)-i-1) for i in range(0,len(dorms)*2)]
def printsolution(vec):
slots = []
for i in range(len(dorms)):slots+=[i,i]
for i in range(len(vec)):
x=int(vec[i])
学生宿舍分配方案优化
最新推荐文章于 2024-12-15 11:06:19 发布
