Loop until MAX_ITEMS and not bestSolutionLength
This commit is contained in:
parent
029ce6264f
commit
3c0ce892a9
@ -137,11 +137,11 @@ void getSolution(sem_t *sUsedSpace, sem_t *sFreeSpace)
|
|||||||
|
|
||||||
if (newSolutionLength < bestSolutionLength) {
|
if (newSolutionLength < bestSolutionLength) {
|
||||||
// Set all entries of bestSolution to -1
|
// 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;
|
bestSolution[i] = -1;
|
||||||
}
|
}
|
||||||
// Copy all entries from solution to bestSolution
|
// 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];
|
bestSolution[i] = solution[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user