function satisfy_parfor_test ( )

%*****************************************************************************80
%
%% satisfy_parfor_test() uses parpool() to run the satisfy() code in parallel.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 December 2023
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../satisfy_parfor' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'satisfy_parfor_test():\n' );
  fprintf ( 1, '  satisfy_parfor() seeks to satisfy a boolean formula.\n' );
  fprintf ( 1, '  The parfor() function is used for parallel execution.\n' );

  for w = [ 1, 4 ]

    pool = parpool ( w );

    tic
    solutions = satisfy_parfor ( );
    tw = toc;

    [ solution_num, n ] = size ( solutions );
    fprintf ( 1, '  %8d  %2d  %g\n', solution_num, w, tw );
    delete ( pool );

  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of variables was %d\n', n );
  fprintf ( 1, '  Number of solutions found was %d\n', solution_num );
  for i = 1 : solution_num
    fprintf ( 1, '  %2d:  ', i );
    for j = 1 : n
      fprintf ( 1, '%2d', solutions(i,j) );
    end
    fprintf ( 1, '\n' );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, 'satisfy_parfor_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../satisfy_parfor' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the YsatisfyHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 November 2022
%
%  Author:
%
%    John Burkardt
%
  t = now ( );
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

