GA optimization of 3D point cloud
Show older comments
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 Comments
Matt J
on 9 Oct 2014
I have a 3D point cloud I need to optimize with respect to maximizing the volume of its convex hull.
If you have no bounds on Xi,Yi, the maximum volume of the hull should be Inf.
I think we need to see the constraints, too.
Note also that the solution will be ambiguous unless one of the vertices is fixed at a known location. Since translating the polyhedron won't change its volume, the solution could only be unique up to a translation of all the vertices. Rotations and other isometric transformations would be issues that way as well....
It seems unlikely to me that the interval in question Z = [ 3000, 9000 ] is the issue as it is almost always a subset of the Z interval of the unbounded solutions
If the solution without the imposed Z-bounds already lies in the interval [3000,9000] then
- Why do you feel the need to impose the bounds at all?
- What happens when you put that solution in the initial population and re-run with the bounds imposed?
When I feed the final population (5th return value) of the unbounded GA to the bounded GA, it behaves exactly like it does when the bounded GA is run from scratch: it tries to create a point cloud whose convex hull approaches a cube as it cannot differentiate between X, Y, and Z coordinates.
I've lost track of what you're claiming. You claimed earlier (I thought) that unbounded GA already produces satisfactory results, i.e., the Z's returned by unbounded GA turn out to be already bounded to the interval [3000, 9000] even though you didn't impose that explicitly through the LB,UB arguments.
If that's true, then putting that solution in the initial population of bounded GA should cause GA to stop after 0 generations, because the solution is already optimal and satisfies all the bounds already including [3000,9000].
If that's not what you're claiming then please explain again why you think imposing bounds on Z shouldn't change the solution drastically.
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?
Answers (1)
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 Comments
Hand-crafting solutions is not an option as this is only part of the big picture that will be completely automated.
Well, it was an option as a test, which is what I proposed it as. Interesting, though, that the penalty approach resolves everything.
slaiyer
on 12 Oct 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.
Categories
Find more on Display Point Clouds in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!