GA optimization of 3D point cloud
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a 3D point cloud I need to optimize with respect to maximizing the volume of its convex hull. For n points, the input to the fitness function currently looks like:
arr(3 * n) = [ X1, Y1, Z1, X2, Y2, Z2, ... Xn, Yn, Zn ]
This works just fine till I add upper and lower bounds to the Z coordinates via vectors which look like:
LB(3 * n) = [ -Inf, -Inf, 3000, ... -Inf, -Inf, 3000 ]
UB(3 * n) = [ Inf, Inf, 9000, ... Inf, Inf, 9000 ]
Here, the optimization performance and solution quality both drop greatly. The convex hull of the point cloud now tends to approach a cube, instead of freely expanding in X and Y. I think this because the GA only sees them as a vector of doubles, being unable to distinguish between X, Y, and Z coordinates, having no clue of their spatial significance.
I tried to implement custom data type optimization using cells, but run into other problems, the most major of which is of how to specify upper and lower bounds (which GA insists must be double vectors). The documentation for custom data type optimization offers no insight into this either.
Another wild guess would be to create 3 subpopulations of X, Y, and Z coordinates, and optimize them within themselves with no crossover, but I'm not sure if this would be feasible.
I would be grateful if someone could point me towards a viable approach for modelling this scenario, and would be glad to provide relevant snippets of code for reference as required.
EDIT (fitness function):
function volume = fitfun(N, credit, NUM)
INDIVS = size(N, 1);
volume = zeros(INDIVS, 1);
overlapFraction = 0.2;
parfor i = 1 : INDIVS
inferior = false;
N2 = reshape(N(i,:), 3, NUM).';
[ facets, volume(i) ] = convexHull(delaunayTriangulation(N2));
numFacets = size(facets, 1);
numVerts = size(facets, 2);
for f = 1 : numFacets
for v1 = 1 : numVerts
v2 = rem(v1, numVerts) + 1;
p = [ facets(f,v1); facets(f,v2) ];
n = [ N2(p(1),:); N2(p(2),:) ];
range = [ credit(p(1)); credit(p(2)) ];
edge = norm(n(1,:) - n(2,:));
% Edge length constraint:
range = range_calc(n, range, edge);
coverage = range(1) + range(2);
overlap = coverage - edge;
minOverlap = edge * overlapFraction;
if overlap < minOverlap
volume(i) = 0;
inferior = true;
break
end
end
if inferior == true
break
end
end
if inferior == true
continue
end
end
end
12 comentarios
Matt J
el 10 de Oct. de 2014
Editada: Matt J
el 10 de Oct. de 2014
The unbounded solution may now end up in Z = [ 0, 12000 ] (of which my target bounds of [ 3000, 9000 ] are clearly a subset).
Well...there's little that we can conclude from that. We also know trivially that the unbounded solution will end up in Z=[-inf, inf] of which [3000,9000] is clearly a subset.
What exactly is defective in the solution that bounded GA gives you? Does it not satisfy all the constraints?
Respuestas (1)
Matt J
el 10 de Oct. de 2014
Editada: Matt J
el 10 de Oct. de 2014
This cubic hull is not nearly optimal, as even from a cursory inspection of visualizations of the unbounded and bounded solutions, it can expand a lot more along X and Y.
Well, a test must be made to see whether the fault for that is GA, or whether it is some problem in the constraints or fitness function that you have provided.
It sounds like you could manually alter the solution given by unbounded GA to obtain a solution with a better fitness value. I.e., you could expand it further along X,Y by hand. I would do so, then re-run bounded GA with that hand-crafted solution in the initial population. Then, you can see if GA improves upon that solution or if instead it progresses back toward the solution you don't like. If the latter, you know there is something wrong in the fitness/constraint functions provided by you.
4 comentarios
Matt J
el 12 de Oct. de 2014
Editada: Matt J
el 12 de Oct. de 2014
Well now, you can take that solution and put it in the initial population of bounded GA, like I was suggesting before, and see if it solves the problem rigorously (or at least within TolCon).
Remember, even though it's a "global optimization" algorithm, it can still probably benefit from your help in finding the right region to search.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!