function partition_greedy_test01 ( w )

%*****************************************************************************80
%
%% partition_greedy_test01() tests partition_greedy() on particular data.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 October 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer W(N), a set of weights.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'partition_greedy_test01():\n' );
  fprintf ( 1, '  partition_greedy() seeks a balanced partition using a greedy method.\n' );
  fprintf ( 1, '  Partition a set of N integers W so that the subsets\n' );
  fprintf ( 1, '  have equal sums.\n' );

  x = partition_greedy ( w );

  fprintf ( 1, '\n' );
  fprintf ( 1, '     I        W0        W1\n' );
  fprintf ( 1, '\n' );
  n = length ( w );
  w0_sum = 0;
  w1_sum = 0;
  for i = 1 : n
    if ( x(i) == 0 )
      w0_sum = w0_sum + w(i);
      fprintf ( 1, '  %4d  %8d\n', i, w(i) );
    else
      w1_sum = w1_sum + w(i);
      fprintf ( 1, '  %4d            %8d\n', i, w(i) );
    end
  end
  fprintf ( 1, '        --------  --------\n' );
  fprintf ( 1, '        %8d  %8d\n', w0_sum, w1_sum );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Discrepancy = %d\n', w1_sum - w0_sum );

  return
end
 
