OptimisationProblem/Solution.cpp
2023-07-17 01:19:10 +03:00

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();
}
}