function polyomino_monohedral_test ( )

%*****************************************************************************80
%
%% polyomino_monohedral_test() tests polyomino_monohedral().
%
%  Discussion:
%
%    This test solves a particular problem using polyomino_monohedral.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 May 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polyomino_monohedral_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  polyomino_monohedral() investigates solutions to\n' );
  fprintf ( 1, '  the problem of tiling a given region R, using multiple\n' );
  fprintf ( 1, '  copies of a single polyomino P.\n' );

  polyomino_monohedral_test01 ( );
  polyomino_monohedral_test02 ( );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polyomino_monohedral_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );

  return
end
function polyomino_monohedral_test01 ( )

%*****************************************************************************80
%
%% polyomino_monohedral_test01() sets up test example 1.
%
%  Discussion:
%
%    This test solves a particular problem using polyomino_monohedral.
%
%    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:
%
%    15 May 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polyomino_monohedral_test01():\n' );
%
%  Define R.
%
  r = [ ...
    1, 1, 0;
    1, 1, 1;
    1, 1, 1 ];

  [ m_r, n_r ] = size ( r );
  polyomino_print ( r, '  Region R:' );
%
%  Define P.
%
  p = [ ...
    1, 1 ];

  [ m_p, n_p ] = size ( p );
  polyomino_print ( p, '  Polyomino P:' );
%
%  Seek tilings of R by P.
%
  [ m, n, k, a, b, x ] = polyomino_monohedral ( r, p, 'reid.lp', ...
    'The Reid example' );

  return
end
function polyomino_monohedral_test02 ( )

%*****************************************************************************80
%
%% polyomino_monohedral_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
%
%    It is desired to determine all distinct solutions that use multiple (4)
%    copies of P to tile R.  
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 May 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polyomino_monohedral_test02():\n' );
%
%  Define R.
%
  r = [ ...
    1, 1, 1, 1, 1;
    1, 1, 1, 1, 1;
    1, 1, 1, 1, 1;
    1, 1, 1, 1, 1 ];

  [ m_r, n_r ] = size ( r );
  polyomino_print ( r, '  Region R:' );
%
%  Define P.
%
  p = [ ...
    1, 1, 0;
    1, 1, 1 ];

  [ m_p, n_p ] = size ( p );
  polyomino_print ( p, '  Polyomino P:' );
%
%  Seek tilings of R by P.
%
  [ m, n, k, a, b, x ] = polyomino_monohedral ( r, p, '4x5.lp', ...
    'The 4x5 rectangle example' );

  return
end

