Loop until MAX_ITEMS and not bestSolutionLength

This commit is contained in:
zenon 2018-06-08 11:35:59 +02:00
parent 029ce6264f
commit 3c0ce892a9

View File

@ -137,11 +137,11 @@ void getSolution(sem_t *sUsedSpace, sem_t *sFreeSpace)
if (newSolutionLength < bestSolutionLength) {
// Set all entries of bestSolution to -1
for (int i = 0; i < bestSolutionLength; i++) {
for (int i = 0; i < MAX_ITEMS; i++) {
bestSolution[i] = -1;
}
// Copy all entries from solution to bestSolution
for (int i = 0; i < newSolutionLength; i++) {
for (int i = 0; i < MAX_ITEMS; i++) {
bestSolution[i] = solution[i];
}