40 lines
667 B
C++
40 lines
667 B
C++
|
#include "Solution.h"
|
||
|
|
||
|
void Solution::addAssignment(Assignment* assignment)
|
||
|
{
|
||
|
this->assignments.push_back(assignment);
|
||
|
}
|
||
|
|
||
|
Assignments* Solution::getAssignments()
|
||
|
{
|
||
|
return &(this->assignments);
|
||
|
}
|
||
|
|
||
|
MissionList* Solution::getUnassignedMissions()
|
||
|
{
|
||
|
return this->unassignedMissions;
|
||
|
}
|
||
|
|
||
|
float Solution::cost()
|
||
|
{
|
||
|
float cost = ((float)this->unassignedCount()) / this->totalMissions;
|
||
|
for (Assignment* assignment : this->assignments)
|
||
|
{
|
||
|
cost += assignment->cost();
|
||
|
}
|
||
|
return cost;
|
||
|
}
|
||
|
|
||
|
int Solution::unassignedCount()
|
||
|
{
|
||
|
return this->unassignedMissions->size();
|
||
|
}
|
||
|
|
||
|
void Solution::print()
|
||
|
{
|
||
|
for (Assignment* assignment : this->assignments)
|
||
|
{
|
||
|
assignment->print();
|
||
|
}
|
||
|
}
|