function polyomino_monohedral_tiling_plot_test ( )

%*****************************************************************************80
%
%% POLYOMINO_MONOHEDRAL_TILING_PLOT_TEST tests POLYOMINO_MONOHEDRAL_TILING_PLOT.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 June 2018
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_MONOHEDRAL_TILING_PLOT_TEST:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  POLYOMINO_MONOHEDRAL_TILING_PLOT plots\n' );
  fprintf ( 1, '  solutions to the problem of tiling a given region R, using\n' );
  fprintf ( 1, '  multiple copies of a single polyomino P.\n' );

  polyomino_monohedral_tiling_plot_test01 ( );
% polyomino_monohedral_tiling_plot_test02 ( );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_MONOHEDRAL_TILING_PLOT_TEST:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
function polyomino_monohedral_tiling_plot_test01 ( )

%*****************************************************************************80
%
%% POLYOMINO_MONOHEDRAL_TILING_PLOT_TEST01 sets up test example 1.
%
%  Discussion:
%
%    The region R consists of the following arrangement of square cells:
%
%      1 1
%      1 1 1
%      1 1 1
%
%    The polyomino P is:
%
%      1 1
%
%    It is desired to determine all distinct solutions that use multiple (4)
%    copies of P to tile R.  
%
%    In this formulation, there are 10 variables, corresponding to 10 ways
%    of placing a single copy of P onto R:
%
%      1 1     0 0    0 0    0 0    0 0
%      0 0 0   1 1 0  0 1 1  0 0 0  0 0 0
%      0 0 0   0 0 0  0 0 0  1 1 0  0 1 1
%        x1      x2     x3     x4    x5
%  
%      1 0     0 0    0 1    0 0    0 0
%      1 0 0   1 0 0  0 1 0  0 1 0  0 0 1
%      0 0 0   1 0 0  0 0 0  0 1 0  0 0 1
%       x6      x7     x8     x9     x10
%
%    For this problem, there are four solutions:
%
%      A A      
%      B B D    = x1 + x2 + x4 + x10 = (1,1,0,1,0,0,0,0,0,1)
%      C C D
%
%      A A
%      B C D    = x1 + x7 + x9 + x10 = (1,0,0,0,0,0,1,0,1,1)
%      B C D
%
%      A A
%      B C C    = x1 + x3 + x5 + x7 = (1,0,1,0,1,0,1,0,0,0)
%      B D D
%
%      A C
%      A C D    = x4 + x6 + x8 + x10 = (0,0,0,1,0,1,0,1,0,1)
%      B B D
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    07 June 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_MONOHEDRAL_TILING_PLOT_TEST01\n' );
  fprintf ( 1, '  Given 4 solutions for the Reid polyomino tiling problem,\n' );
  fprintf ( 1, '  plot a representation of the tiling corresponding to\n' );
  fprintf ( 1, '  each solution.\n' );
%
%  Define R.
%
  r = [ ...
    1, 1, 0;
    1, 1, 1;
    1, 1, 1 ];
%
%  Define P.
%
  p = [ ...
    1, 1 ];
%
%  Define the 4 solutions X.
%
  x = [ ...
   1, 1, 1, 0;
   0, 1, 0, 0;
   1, 0, 0, 0;
   0, 1, 0, 1;
   1, 0, 0, 0;
   0, 0, 0, 1;
   0, 0, 0, 1;
   1, 0, 1, 0;
   0, 0, 1, 0;
   0, 1, 1, 1 ];
%
%  Plot the tiling corresponding to each column of X.
%
  filename = 'reid01.png';
  label = 'Reid Example Solution';
  polyomino_monohedral_tiling_plot2 ( r, p, x, filename, label );

  return
end
function polyomino_monohedral_tiling_plot_test02 ( )

%*****************************************************************************80
%
%% POLYOMINO_MONOHEDRAL_TILING_PLOT_TEST02 sets up test example 2.
%
%  Discussion:
%
%    The region R consists of the following arrangement of square cells:
%
%      1 1 1 1 1
%      1 1 1 1 1
%      1 1 1 1 1
%      1 1 1 1 1
%
%    The polyomino P is:
%
%      1 1 0
%      1 1 1
%
%    There are 6 distinct ways of tiling the region R with copies of P.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    07 June 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_MONOHEDRAL_TILING_PLOT_TEST02\n' );
  fprintf ( 1, '  Given 6 solutions to the 4x5 rectangle tiling problem,\n' );
  fprintf ( 1, '  plot a representation of the tiling corresponding to\n' );
  fprintf ( 1, '  each solution.\n' );
%
%  Define R.
%
  r = [ ...
    1, 1, 1, 1, 1;
    1, 1, 1, 1, 1;
    1, 1, 1, 1, 1;
    1, 1, 1, 1, 1 ];
%
%  Define P.
%
  p = [ ...
    1, 1, 0; ...
    1, 1, 1 ];
%
%  Define the 6 solutions X, obtained by POLYOMINO_MONOHEDRAL.
%
  x = [ ...
   1, 0, 1, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   1, 1, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 1, 0, 0; ...
   0, 0, 0, 1, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   1, 0, 1, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   1, 1, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 1, 0, 0, 1, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 1; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 1, 0, 1, 0; ...
   0, 1, 0, 0, 1, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 1; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 1, 0, 1, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 1; ...
   0, 0, 0, 0, 0, 1; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 1, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 1, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0; ...
   0, 0, 0, 0, 0, 0 ];
%
%  Print the tilings corresponding to each column of X.
%
  filename = 'rectangle01.png';
  label = '4x5 Rectangle Example Solution';
  polyomino_monohedral_tiling_plot2 ( r, p, x, filename, label );

  return
end

