OptiCloud: Generate Optimal Point Clouds with Minimal Energy
- nPts: Number of points (scalar) or an initial sample to optimize (matrix of size [nPts x dimOrd]).
- dimOrd: Dimensionality (positive integer). Not needed if nPts is a matrix.
- 'NumRun': Number of re-runs to seek minimum potential (positive integer). Default is 1. Also: 'Cycles', 'Try'.
- 'MaxIter': Maximum number of iterations (positive integer). Default depends on nPts. Also: 'Iterations', 'Iter'.
- 'PotEne': Potential energy or distance constant (positive scalar). Default depends on nPts. Also: 'Potential', 'Pot', 'Energy'.
- 'MinTol': Convergence tolerance (positive scalar). Default is 1e-16. Also: 'Tolerance', 'Tol'.
- 'Penalty': Iteration penalty for point overlap (positive integer). Default is 10.
- 'cartesian': Use a cartesian sampling method. Default is false. Opposites are 'radial' or 'spherical'.
- 'best' or 'elite': Initializes each run with the best sample found so far. Default is false.
- 'single': Use single-precision computations. Default depends on nPts. Opposite is 'double'.
- 'verbose': Display progress messages. Default is false.
- 'maximin' or 'distance': Use distance-based solver for the calculations. Deault is false.
- '2d': Use flat markers in 3D plots rather than shaded spheres. Default is false.
- X: Coordinates of the optimized point cloud (array of size [nPts x dimOrd]).
- E: Final potential energy.
- S: Structure containing all parameters and flags used.
- Additional outputs: Empty, but a figure is generated if nargout > 3 or nargout == 0.
- Visualization: When no output is specified, the function generates a figure and assigns the result to ans in the workspace.
- Optimization: Optimal energy configurations are achieved by increasing 'NumRun' and fine-tuning 'PotEne' (decrease) and 'MaxIter' (increase). Using an initialized solution in nPts can also be beneficial. Using 'maximin' can produce higher-quality solutions, although slower.
- Defaults: The default values of 'MaxIter' and 'PotEne' have been computed to produce within a low iteration count decent-quality results when nPts < 1e3 and dimOrd < 6. Operating outside that range may require manual inputs to produce optimal results.
- 1D and 2D: Uses scatter plots.
- 3D: Uses shaded spheres or scatter plots based on the '2d' flag.
- Higher Dimensions: Displays a histogram of point values.
- Performance Tips: For large nPts, consider using the 'single' flag to reduce memory usage and computation time. The algorithm 'maximin' can handle larger sample sizes, but it is notably slower. It sometimes produces higher quality results for 'cartesian' cases.
- Customization: Adjusting parameters like 'PotEne' and 'MaxIter' can significantly affect the optimization results. Experiment with different values for optimal performance, as the function has been set up for rapid and generic inputs.
- Error Handling: The function includes warnings and error messages to guide users in providing valid inputs. The use of the 'verbose' flag is encouraged for debugging.
- MATLAB Version: Developed and tested on MATLAB R2016b and later.
- Toolboxes: No additional toolboxes required.
Cite As
Moreno, M. (2024). OptiCloud: Generate Optimal Point Clouds with Minimal Energy (https://www.mathworks.com/matlabcentral/fileexchange/173255-opticloud-generate-optimal-point-clouds-with-minimal-energy), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.10 | - Moved method inside VARARGIN |
||
1.0.9 | - Removed all dependencies to 'statistics toolbox'
|
||
1.0.8 | - Removed dependency from Statistics Toolbox.
|
||
1.0.7 | Small corrections for clarity, robustness, and speed.
|
||
1.0.6 | - PotEne is always a positive scalar
|
||
1.0.5 | - Better handling of failed cases
|
||
1.0.4 | - Improved overall function robustness and clarity
|
||
1.0.3 | Small correction:
|
||
1.0.2 | Minor adjustments:
|
||
1.0.1 | Minor changes for better user experinece:
|
||
1.0.0 |