Team scheduler now considers all available students
This commit is contained in:
@@ -14,10 +14,11 @@ public class TeamScheduler
|
||||
|
||||
private readonly List<Tuple<int,int>> _scheduleSeparateTeams = [];
|
||||
|
||||
public TeamScheduler(IEnumerable<Team> teams, int numTimeSlots)
|
||||
public TeamScheduler(IEnumerable<Team> teams, int numTimeSlots, IEnumerable<Student> allStudents)
|
||||
{
|
||||
_teamObjects = teams.ToArray();
|
||||
_studentObjects = teams.SelectMany(t => t.Students).Distinct().ToList();
|
||||
//_studentObjects = teams.SelectMany(t => t.Students).Distinct().ToList();
|
||||
_studentObjects = allStudents.ToList();
|
||||
|
||||
_students = Enumerable.Range(0, _studentObjects.Count).ToArray();
|
||||
_teams = Enumerable.Range(0, _teamObjects.Count).ToArray();
|
||||
@@ -31,9 +32,9 @@ public class TeamScheduler
|
||||
_scheduleSeparateTeams.Add(Tuple.Create(one,two));
|
||||
}
|
||||
|
||||
public static TeamScheduler CreateInstance(IEnumerable<Team> teams, int numTimeSlots)
|
||||
public static TeamScheduler CreateInstance(IEnumerable<Team> teams, int numTimeSlots, IEnumerable<Student> allStudents)
|
||||
{
|
||||
return new TeamScheduler(teams, numTimeSlots);
|
||||
return new TeamScheduler(teams, numTimeSlots, allStudents);
|
||||
}
|
||||
|
||||
public TeamSchedulerSolution Solve()
|
||||
@@ -94,13 +95,14 @@ public class TeamScheduler
|
||||
if (cpSolverStatus is not (CpSolverStatus.Optimal or CpSolverStatus.Feasible))
|
||||
return new TeamSchedulerSolution(timeSlotTeams, _studentObjects.ToArray(), cpSolverStatus.ToString());
|
||||
|
||||
Debug.WriteLine($"Total cost: {solver.ObjectiveValue}\n");
|
||||
// Debug.WriteLine($"Total cost: {solver.ObjectiveValue}\n");
|
||||
|
||||
foreach (var s in _timeSlots)
|
||||
{
|
||||
var teams = (from t in _teams where solver.Value(x[t, s]) > 0 select _teamObjects[t]).ToArray();
|
||||
timeSlotTeams[s] = teams;
|
||||
}
|
||||
|
||||
//Debug.WriteLine("No solution found.");
|
||||
return new TeamSchedulerSolution(timeSlotTeams, _studentObjects.ToArray(), cpSolverStatus.ToString());
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TeamSchedulerTest
|
||||
TeamSchedulerSolution solution;
|
||||
if (true)
|
||||
{
|
||||
var teamScheduler = TeamScheduler.CreateInstance(teams, 3);
|
||||
var teamScheduler = TeamScheduler.CreateInstance(teams, 3, students);
|
||||
solution = teamScheduler.Solve();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -9,6 +9,14 @@
|
||||
<MudAppBar Class="no-print">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())" />
|
||||
TSA Chapter Organizer - @Configuration["ChapterSettings:Name"]
|
||||
<MudSpacer />
|
||||
<AuthorizeView>
|
||||
<MudText Typo="Typo.body2">Logged in</MudText>
|
||||
|
||||
<form action="Auth/CookieLogout" method="post">
|
||||
<button type="submit" class="btn btn-primary">Logout</button>
|
||||
</form>
|
||||
</AuthorizeView>
|
||||
</MudAppBar>
|
||||
<MudDrawer @bind-Open="@_drawerOpen" Class="no-print">
|
||||
<NavMenu/>
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
<MudNavLink Href="/teams/assignment" Icon="@AppIcons.TeamAssignment">Team Assignment</MudNavLink>
|
||||
</MudNavGroup>
|
||||
</MudNavMenu>
|
||||
</MudPaper>
|
||||
</MudPaper>
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
{first = false;}
|
||||
<MudText
|
||||
Typo="Typo.body2"
|
||||
Color="color">
|
||||
Color="@color">
|
||||
@student.FirstName@(overlap ? "*" : "")
|
||||
</MudText>
|
||||
}
|
||||
@@ -264,7 +264,7 @@
|
||||
{
|
||||
_isSolving = true;
|
||||
|
||||
var teamScheduler = new TeamScheduler(_scheduledTeams, _parameters.TimeSlots);
|
||||
var teamScheduler = new TeamScheduler(_scheduledTeams, _parameters.TimeSlots, _students);
|
||||
_solution = teamScheduler.Solve();
|
||||
|
||||
var loe = new UnassignedStudentScheduler(_teams, _solution.TimeSlots).ScheduleStrategy(UnassignedScheduleStrategy.LevelOfEffort);
|
||||
|
||||
Reference in New Issue
Block a user