Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 13-May-2025 12:27:50 cvt_box_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7. Test cvt_box(). output = 'cvt_box_final.txt' cvt_box(): Generate and animate a constrained CVT dataset. This program is meant to be used interactively. It is also possible to prepare a simple input file beforehand and use it in batch mode. The program requests input values from the user: * NDIM, the spatial dimension, * N, the number of points to generate, * NPP, the number of points to place on the boundary. * INIT_STRING, initialize the points: ** file, read data from a file; ** 'GRID', by picking points from a grid; ** 'RAND', using MATLAB's RAND function; ** 'UNIFORM', using a simple uniform RNG; * IT_MAX, the maximum number of iterations. * IT_FIXED, the number of iterative steps to take using a fixed set of sampling points. * SAMPLE_STRING, how to conduct the sampling. ** 'GRID', by picking points from a grid; ** 'RAND', using MATLAB's RAND function; ** 'UNIFORM', using a simple uniform RNG; * SAMPLE_NUM, the number of sample points; * BATCH, the number of sampling points to create at one time; * MOVIE_NAME is the name of the file in which the movie is stored; * OUTPUT, a file into which the final generator data is stored. To indicate that no further computations are desired, it is enough to input a nonsensical value, such as -1. * * * Ready to generate a new dataset: * * NDIM is the spatial dimension. NDIM = 2 N is the number of points to generate. User input N = 100 NPP is the number of sample points used to check the boundary. User input NPP = 1000 INIT_STRING is the method of initializing the data: file read data from a file; 'GRID' by picking points from a grid; 'RAND' using MATLAB's RAND function; 'UNIFORM' using a simple uniform RNG; User input INIT_STRING = "rand". User input INIT = "-1". IT_MAX is the maximum number of iterations. An iteration carries out the following steps: * the Voronoi region associated with each generator is estimated by sampling; * the centroid of each Voronoi region is estimated. * the generator is replaced by the centroid. If "enough" sampling points are used, and "enough" iterations are taken, this process will converge. User input IT_MAX = 50 IT_FIXED is the number of consecutive iterations to take with a fixed set of sample points. Setting IT_FIXED to 1 means a new set of sample points is generated on every iterative step; Setting IT_FIXED equal to IT_MAX means a single set of sample points is used for the entire iteration. Any value between 1 and IT_MAX is reasonable. User input IT_FIXED = 1 SAMPLE_STRING is the method of sampling the region: 'GRID' by picking points from a grid; 'RAND' using MATLAB's RAND function; 'UNIFORM' using a simple uniform RNG; User input SAMPLE_STRING = "rand". Numeric value of SAMPLE = -1 SAMPLE_NUM is the number of sample points. The Voronoi regions will be explored by generating SAMPLE_NUM points. For each sample point, the nearest generator is found. Using more points gives a better estimate of these regions. SAMPLE_NUM should be much larger than N, the number of generators. User input SAMPLE_NUM = 100000 BATCH is the number of sample points to create at one time BATCH should be between 1 and SAMPLE_NUM. It is FASTER to set BATCH to SAMPLE_NUM; setting BATCH to 1 requires the least memory. BATCH = 1000 MOVIE_NAME is the name of the file in which the movie is stored; User input MOVIE_NAME = cvt_box_test.avi Deleting old copy of cvt_box_test.avi FILE_DELETE: Deleting old version of "cvt_box_test.avi". OUTPUT is a file into which the data is stored; OUTPUT = "cvt_box_final.txt". Energy Energy after Iteration of CVT projection 0 0.003357 0.003634 1 0.002168 0.002632 Graphics saved as "cvt_box_initial.png" 2 0.001974 0.002391 3 0.001893 0.002258 4 0.001862 0.002213 5 0.001851 0.002185 6 0.001843 0.002167 7 0.001832 0.002147 8 0.001827 0.002133 9 0.001821 0.002124 10 0.001829 0.002109 11 0.001821 0.002104 12 0.001825 0.002096 13 0.001829 0.002088 14 0.001817 0.002086 15 0.001822 0.002088 16 0.001820 0.002069 17 0.001808 0.002075 18 0.001813 0.002095 19 0.001821 0.002092 20 0.001821 0.002087 21 0.001813 0.002079 22 0.001808 0.002077 23 0.001818 0.002109 24 0.001812 0.002091 25 0.001816 0.002097 26 0.001818 0.002091 27 0.001820 0.002087 28 0.001817 0.002088 29 0.001810 0.002082 30 0.001815 0.002091 31 0.001816 0.002086 32 0.001804 0.002082 33 0.001814 0.002080 34 0.001818 0.002073 35 0.001815 0.002074 36 0.001814 0.002068 37 0.001808 0.002069 38 0.001809 0.002073 39 0.001813 0.002067 40 0.001810 0.002070 41 0.001812 0.002062 42 0.001805 0.002066 43 0.001808 0.002066 44 0.001806 0.002062 45 0.001818 0.002062 46 0.001807 0.002059 47 0.001807 0.002067 48 0.001807 0.002062 49 0.001807 0.002058 50 0.001811 0.002054 Graphics saved as "cvt_box_final.png" Final generator set saved in file "cvt_box_final.txt". Animation saved as "cvt_box_test.avi" cvt_box(): Normal end of execution. cvt_box_test(): Normal end of execution. 13-May-2025 12:30:36