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 = [];
|
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();
|
_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();
|
_students = Enumerable.Range(0, _studentObjects.Count).ToArray();
|
||||||
_teams = Enumerable.Range(0, _teamObjects.Count).ToArray();
|
_teams = Enumerable.Range(0, _teamObjects.Count).ToArray();
|
||||||
@@ -31,9 +32,9 @@ public class TeamScheduler
|
|||||||
_scheduleSeparateTeams.Add(Tuple.Create(one,two));
|
_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()
|
public TeamSchedulerSolution Solve()
|
||||||
@@ -94,13 +95,14 @@ public class TeamScheduler
|
|||||||
if (cpSolverStatus is not (CpSolverStatus.Optimal or CpSolverStatus.Feasible))
|
if (cpSolverStatus is not (CpSolverStatus.Optimal or CpSolverStatus.Feasible))
|
||||||
return new TeamSchedulerSolution(timeSlotTeams, _studentObjects.ToArray(), cpSolverStatus.ToString());
|
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)
|
foreach (var s in _timeSlots)
|
||||||
{
|
{
|
||||||
var teams = (from t in _teams where solver.Value(x[t, s]) > 0 select _teamObjects[t]).ToArray();
|
var teams = (from t in _teams where solver.Value(x[t, s]) > 0 select _teamObjects[t]).ToArray();
|
||||||
timeSlotTeams[s] = teams;
|
timeSlotTeams[s] = teams;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Debug.WriteLine("No solution found.");
|
//Debug.WriteLine("No solution found.");
|
||||||
return new TeamSchedulerSolution(timeSlotTeams, _studentObjects.ToArray(), cpSolverStatus.ToString());
|
return new TeamSchedulerSolution(timeSlotTeams, _studentObjects.ToArray(), cpSolverStatus.ToString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class TeamSchedulerTest
|
|||||||
TeamSchedulerSolution solution;
|
TeamSchedulerSolution solution;
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
var teamScheduler = TeamScheduler.CreateInstance(teams, 3);
|
var teamScheduler = TeamScheduler.CreateInstance(teams, 3, students);
|
||||||
solution = teamScheduler.Solve();
|
solution = teamScheduler.Solve();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -9,6 +9,14 @@
|
|||||||
<MudAppBar Class="no-print">
|
<MudAppBar Class="no-print">
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())" />
|
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())" />
|
||||||
TSA Chapter Organizer - @Configuration["ChapterSettings:Name"]
|
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>
|
</MudAppBar>
|
||||||
<MudDrawer @bind-Open="@_drawerOpen" Class="no-print">
|
<MudDrawer @bind-Open="@_drawerOpen" Class="no-print">
|
||||||
<NavMenu/>
|
<NavMenu/>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
{first = false;}
|
{first = false;}
|
||||||
<MudText
|
<MudText
|
||||||
Typo="Typo.body2"
|
Typo="Typo.body2"
|
||||||
Color="color">
|
Color="@color">
|
||||||
@student.FirstName@(overlap ? "*" : "")
|
@student.FirstName@(overlap ? "*" : "")
|
||||||
</MudText>
|
</MudText>
|
||||||
}
|
}
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
{
|
{
|
||||||
_isSolving = true;
|
_isSolving = true;
|
||||||
|
|
||||||
var teamScheduler = new TeamScheduler(_scheduledTeams, _parameters.TimeSlots);
|
var teamScheduler = new TeamScheduler(_scheduledTeams, _parameters.TimeSlots, _students);
|
||||||
_solution = teamScheduler.Solve();
|
_solution = teamScheduler.Solve();
|
||||||
|
|
||||||
var loe = new UnassignedStudentScheduler(_teams, _solution.TimeSlots).ScheduleStrategy(UnassignedScheduleStrategy.LevelOfEffort);
|
var loe = new UnassignedStudentScheduler(_teams, _solution.TimeSlots).ScheduleStrategy(UnassignedScheduleStrategy.LevelOfEffort);
|
||||||
|
|||||||
Reference in New Issue
Block a user