function tortoise_test ( )

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

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

  label = 'tortoise';
  tile_num = tortoise_tile_num ( );

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

  [ nvar, nsol ] = size ( x );
 
  fprintf ( 1, '\n' );
  fprintf ( 1, '  CPLEX solution involves %d variables\n', nvar );
  fprintf ( 1, '  CPLEX found %d solutions\n', nsol );

  for j = 1 : nsol
    filename = sprintf ( 'tortoise_solution%d.png', j );
    fprintf ( 1, '  Creating "%s"\n', filename );
    solution_plot ( x(:,j), filename, label, @tortoise_grid_word, ...
      @tortoise_tile_num, @tortoise_tile_word );
  end

  for j = 1 : nsol
    header = sprintf ( 'tortoise solution #%d', j );
    tortoise_solution_print ( x(:,j), header );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'tortoise_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../tortoise' );
  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

