function subset_sum_swap_try ( n, w, t )

%*****************************************************************************80
%
%% subset_sum_swap_try() tries the swap code for a given subset_sum problem.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 June 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Target value: %g\n', t );
  
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Available weights:\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %d\n', w(i) );
  end

  [ a, index, sum_achieved ] = subset_sum_swap ( n, w, t );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Selected weights:\n' );
  fprintf ( 1, '\n' );

  for i = 1 : n
    if ( index(i) == 1 )
      fprintf ( 1, '  %d\n', a(i) );
    end
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The target was      %d\n', t );
  fprintf ( 1, '  The achieved sum is %d\n', sum_achieved );
  fprintf ( 1, '  The defect is       %d\n', t - sum_achieved );

  return
end

