function florida_cvt_pop_test01 ( )

%*****************************************************************************80
%
%% florida_cvt_pop_test01() tests florida_cvt_pop().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 July 2016
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'florida_cvt_pop_test01():\n' );
  fprintf ( 1, '  FLORIDA_CVT_POP can estimate the population centroidal\n' );
  fprintf ( 1, '  Voronoi tessellation (CVT) of a set of points\n' );
  fprintf ( 1, '  within the boundaries of Florida,\n' );
  fprintf ( 1, '  expressed as longitudes and latitudes.\n' );
%
%  Read the longitude, latitude, population and geoid of each census tract.
%
  filename = 'florida_census.csv';
  [ pop_lon, pop_lat, pop_count, pop_geoid ] = florida_census_reader ( filename );
%
%  Construct the CDF.
%
  pop_cdf = florida_cdf_pop ( pop_count );
%
%  Select N locations uniformly at random with respect to population.
%
  n = 27;
  [ indx ] = florida_sample_pop ( n, pop_cdf );
  gen_lat = pop_lat(indx);
  gen_lon = pop_lon(indx);
%
%  Estimate the CVT.
%
  [ gen_lon, gen_lat ] = florida_cvt_pop ( gen_lon, gen_lat, pop_lon, ...
    pop_lat, pop_cdf );
%
%  Estimate the centroids.
%
  sample_num = 5000;
  [ cen_lon, cen_lat ] = florida_centroid_pop ( gen_lon, ...
    gen_lat, sample_num, pop_lon, pop_lat, pop_cdf );
%
%  Show generators, centroids, and Voronoi region together.
% 
  filename = 'florida_cvt_pop.png';
  plot_title = sprintf ( '%d-Generator population CVT', n );
  florida_voronoi_display ( gen_lon, gen_lat, cen_lon, cen_lat, filename, plot_title );

  return
end

