# [Paradiseo-help] Problem of front by front crowding distance calculation

Ven 2 Juil 06:51:29 CEST 2010

```Sorry, I found some bug of my previous code.
Finally, I used another vector pointer to point a sub-population in the same
front.

> sorry, the code is "std::sort(&sortedptrpop[a], &sortedptrpop[b+1], cmp2);"
>
> 程鈞彥 <cgm7487 at gmail.com> 於 2010年7月2日上午11:13 寫道：
>
> Hi,
>> Maybe the second sorting is to sort in the same front,does it?
>> How about changing the code to "std::sort(&sortedptrpop[a],
>> &sortedptrpop[b], cmp2);" instead of "std::sort(sortedptrpop.begin(),
>> sortedptrpop.end(), cmp2);"?
>>
>>
>> Best regards,
>> Jyun-Yan Cheng.
>>
>> 程鈞彥 <cgm7487 at gmail.com> 於 2010年7月1日下午8:10 寫道：
>>
>> HI,
>>> But, when I print the front depth before the code and after the code.(the
>>> attached pic)
>>> I found the rank(fitness) change.
>>> Does it not affect the following crowding distance calculation?
>>>
>>>
>>> Best regards,
>>> Jyun-Yan Cheng
>>>
>>>
>>>
>>> 寫道：
>>>
>>> Hello,
>>>> In fact, the population is not sorted according to one objective. It's a
>>>> vector of pointers that is sorted. This is used to set the crowding
>>>> distance values.
>>>> The only explanation that the crowding distance of the individuals
>>>> contained in the final population is close to infinity is that it
>>>> contains a small number of solutions only. This is also related to the
>>>> ranges of the objective values.
>>>>
>>>> Best regards,
>>>>
>>>>
>>>>
>>>> 程鈞彥 a e'crit :
>>>> > Hi, I found something strange.
>>>> >
>>>> > The following code==>
>>>> >
>>>> > moeoOneObjectiveComparator < MOEOT > objComp(obj);
>>>> > moeoPtrComparator<MOEOT> cmp2( objComp );
>>>> > std::sort(sortedptrpop.begin(), sortedptrpop.end(), cmp2);
>>>> >
>>>> > will sort the pop according to one objective.
>>>> >
>>>> > However, this code also disarranges the pareto front relationship.
>>>> > I don't know if I misunderstood something.
>>>> >
>>>> > Thanks.
>>>> >
>>>> > Best regards,
>>>> > Jyun-Yan Cheng.
>>>> >
>>>> >
>>>> > 2010/7/1 程鈞彥 <cgm7487 at gmail.com <mailto:cgm7487 at gmail.com>>
>>>> >
>>>> >     Hi, I used the oeoFrontByFrontCrowdingDiversityAssignment class to
>>>> >     calculate crowding distance.
>>>> >
>>>> >     However, I find that the crowding distance of my final
>>>> >     non-dominance set are almost Infinity.
>>>> >
>>>> >     I have no idea why the problem happened. Could you please give me
>>>> >     some suggestion of the problem?
>>>> >
>>>> >
>>>> >     Best Regards,
>>>> >     Jyun-Yan Cheng
>>>> >
>>>> >
>>>> >
>>>> ------------------------------------------------------------------------
>>>> >
>>>> > _______________________________________________