Optimization problem issue with slopes

Hey everyone,

Hope you’re all fine.

posted already yesterday to fix a problem of a surface and a member helped me greatly but now I’m stuck with the formulation of an optimization problem , I have hilly terrain and I used Multi-agent system in order to draw serveral scenarios of paths taking into account different slope percentage as you can see one example below.

For my test I would like to spread for e.g red balls,let’s say 3 ones (which are amenities) in a way that the blue ball (the guy) will have the least steepest path to all of them , but there’s one constraint, and it’s to not put all the amenities in the lower level of the terrain or it would be useless. ,the multi-agent system itself is not perfect as I’m also stuck doing a path for 3 destinations,it can only output one for now…I’m still learning it

So basically the idea is to optimize the position of the red balls , in a way that they will be in less hilly places and in more accessible ones, according to the blue sphere position, surely one could do this manually but I’m thinking to also apply it on a bigger problem, later, and brute force won’t help in that case.

Before uploading here , I have spent serval days looking on how to “wire” the problem and to input it with Galapgos but I’m always stuck , knowing I’ve tried evalute surface + gene pools to construct points sliders but the fitness value is the one I can’t seem to understand how to create using the data I have,I’m missing something in constructing the relationship between points and the origin ,that would also take into account the slopes

I hope someone can help in explaining how to input the problems better to get an optimization.

I have uploaded the gh definition , it has the surfaces(converted from a mesh) as well as the multi agent definition that allows choosing path according to some maths rule and slope percentage (don’t know if it will be needed but anyway)

the definitions are renamed in french and english if needed.

thanks for any help provided and take care

OPTIMIZATION PROBLEM.gh (121.4 KB)