function polyomino_multihedral_example_octomino_matrix ( )

%*****************************************************************************80
%
%% polyomino_multihedral_example_octomino_matrix sets the octomino matrix.
%
%  Discussion:
%
%    The problem seeks to tile the 8x8 rectangle with 8 distinct octominos.
%
%    This function sets up the corresponding linear system.  But because
%    the system is large, we expect the solution to be carried out by a
%    standard integer programming package such as CPLEX.
%
%    The resulting solution vectors X can then be examined.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 June 2018
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polyomino_multihedral_example_octomino_matrix:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Set up the linear system for the 8x8 octomino example.\n' );
%
%  Define R.
%
  r_shape = ones(8,8);
  [ r_m, r_n ] = size ( r_shape );
  polyomino_print ( r_m, r_n, r_shape, '  Region R:' );
%
%  Define O1, O2, ...O8.
%
  o1 = [ ...
  1, 1, 1, 0, 0, 0, 0, 0; ...
  1, 1, 1, 0, 0, 0, 0, 0; ...
  1, 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 ];
  polyomino_print ( 8, 8, o1, '  Polyomino O1:' );

 o2 = [ ...
  1, 1, 1, 1, 0, 0, 0, 0; ...
  1, 1, 0, 1, 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 ];
  polyomino_print ( 8, 8, o2, '  Polyomino O2:' );

  o3 = [ ...
  1, 0, 0, 0, 0, 0, 0, 0; ...
  1, 0, 0, 0, 0, 0, 0, 0; ...
  1, 0, 1, 0, 0, 0, 0, 0; ...
  1, 1, 1, 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 ];
  polyomino_print ( 8, 8, o3, '  Polyomino O3:' );

  o4 = [ ...
  1, 1, 1, 1, 0, 0, 0, 0; ...
  1, 0, 1, 1, 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 ];
  polyomino_print ( 8, 8, o4, '  Polyomino O4:' );

  o5 = [ ...
  1, 0, 0, 0, 0, 0, 0, 0; ...
  1, 0, 0, 0, 0, 0, 0, 0; ...
  1, 0, 0, 0, 0, 0, 0, 0; ...
  1, 1, 1, 1, 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 ];
  polyomino_print ( 8, 8, o5, '  Polyomino O5:' );

  o6 = [ ...
  1, 0, 0, 0, 0, 0, 0, 0; ...
  1, 1, 0, 0, 0, 0, 0, 0; ...
  1, 1, 0, 0, 0, 0, 0, 0; ...
  1, 1, 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 ];
  polyomino_print ( 8, 8, o6, '  Polyomino O6:' );

  o7 = [ ...
  1, 1, 1, 1, 1, 0, 0, 0; ...
  0, 1, 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, 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 ];
  polyomino_print ( 8, 8, o7, '  Polyomino O7:' );

  o8 = [ ...
  1, 0, 1, 0, 0, 0, 0, 0; ...
  1, 1, 1, 0, 0, 0, 0, 0; ...
  1, 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, 0, 0, 0, 0, 0; ...
  0, 0, 0, 0, 0, 0, 0, 0; ...
  0, 0, 0, 0, 0, 0, 0, 0 ];
  polyomino_print ( 8, 8, o8, '  Polyomino O8:' );
%
%  Pack the octominoes into P_SHAPES.
%
  p_num = 8;
  p_shapes = zeros ( r_m, r_n, p_num );
  p_shapes(:,:,1) = o1;
  p_shapes(:,:,2) = o2;
  p_shapes(:,:,3) = o3;
  p_shapes(:,:,4) = o4;
  p_shapes(:,:,5) = o5;
  p_shapes(:,:,6) = o6;
  p_shapes(:,:,7) = o7;
  p_shapes(:,:,8) = o8;
%
%  Set the vector D, which indicates how many copies of each polyomino
%  we can use: one of each, in this case.
%
  d = ones ( p_num, 1 );
%
%  Compute the system matrix.
%
  [ a, b, parent ] = polyomino_multihedral_matrix ( r_shape, p_num, p_shapes, d );
  [ a_m, a_n ] = size ( a );
%
%  Write the linear system to an LP file.
%
  filename = 'octomino.lp';
  comment = 'The 8x8 multihedral octomino example.';
  polyomino_lp_write ( filename, comment, a_m, a_n, a, b );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_MULTIHEDRAL_EXAMPLE_OCTOMINO_MATRIX:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
