# gamultiobj sticks in the loop while trimming population

8 views (last 30 days)
Ilia on 6 Aug 2024
Answered: arushi on 8 Aug 2024 at 8:35
I am running gamultiobj in the following form for 10 variables with integer constraints for half of variables and with nonlinear equality:
[x,fval] = gamultiobj(fun,nvars,[],[],[],[],lb,ub,nonlcon,intcon,options)
Optimization seems to work fine for relatively small population <1e4. However given specifics of my problem, I need to use populations >1e5. In the latter case, gamultiobj at some certain generation just sticks in the loop within trimPopulation.m (lines 75-88):
front = totalNumOfRank; increase = 0.10;
while sum(retainIndiv) <= ceil(nParents)
if retainIndiv(front) < availableIndiv(front)
retainIndiv(front) = min(availableIndiv(front),ceil(retainIndiv(front)*(1+increase)));
increase = increase*0.95;
end
if front == 1
front = totalNumOfRank;
increase = 0.10;
else
front = front - 1;
end
end
with variable increase decreasing down to 1e-188 and below.
Any ideas on what's going on here?

arushi on 8 Aug 2024 at 8:35
Hi Ilia,
The issue you're encountering with `gamultiobj` in MATLAB when using very large populations (>1e5) seems to be related to the way the `trimPopulation` function handles the population adjustment. Specifically, the loop in `trimPopulation.m` is trying to adjust `retainIndiv` to ensure that the number of retained individuals meets the required number of parents (`nParents`). However, with such a large population, the adjustment process might be taking an extremely long time or getting stuck in an ineffective loop due to the small increment (`increase`).
Here are a few suggestions to address this issue:
1. Adjust the Population Size and Max Generations
Sometimes, using an excessively large population may not be necessary. Try to balance the population size and the number of generations. For example, if you need a large population for diversity, consider using a smaller population with more generations instead.
2. Modify the `trimPopulation` Function -If you have access to the `trimPopulation.m` file, you can modify the loop to avoid the issue with extremely small increments. For instance, you can add a break condition if `increase` becomes too small.
3. Increase the Tolerance for Convergence -Increasing the tolerance for convergence can sometimes help the algorithm to terminate earlier, especially if the solution is not improving significantly.
Hope this helps.

### Categories

Find more on Genetic Algorithm in Help Center and File Exchange

R2024a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!