function serenity_test ( )

%*****************************************************************************80
%
%% serenity_test() tests serenity().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    06 February 2022
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../eternity' );
  addpath ( '../serenity' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'serenity_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s.\n', version ( ) );
  fprintf ( 1, '  serenity() implements a linear programming\n' );
  fprintf ( 1, '  approach to the serenity tiling problem.\n' );

  label = 'serenity';
  tile_num = serenity_tile_num ( );

  lp_generate ( label, tile_num, @serenity_tile_word, @serenity_grid_word );
%
%  "serenity.sol" was created by CPLEX, 
%  which processed "serenity.lp".
%
  filename = 'serenity.sol';
  x = cplex_solution_read ( filename );

  [ nsol, nvar ] = size ( x );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  cplex() found %d solutions\n', nsol );
  fprintf ( 1, '  Each solution selected from %d configurations.\n', nvar );
%
%  Plot the first of the 12 solutions.
%
  filename = 'serenity_solution.png';
  solution_plot ( x(:,1), filename, label, @serenity_grid_word, ...
    @serenity_tile_num, @serenity_tile_word );
%
%  Print the first of the 12 solutions.
%
  solution_print ( x(:,1), label, tile_num, @serenity_tile_word, @serenity_grid_word );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'serenity_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../serenity' );
  rmpath ( '../eternity' );

  return
end
function timestamp ( )

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

  return
end

