OptimisationProblem/Solution.cpp

40 lines
667 B
C++
Raw Permalink Normal View History

2023-07-17 00:19:10 +02:00
#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();
}
}