function pariomino_lp_write_test02 ( )

%*****************************************************************************80
%
%% pariomino_lp_write_test02 tests pariomino_lp_write.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 July 2020
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pariomino_lp_write_test02:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  pariomino_lp_write() writes an LP file associated\n' );
  fprintf ( 1, '  with a binary programming problem for tiling a region\n' );
  fprintf ( 1, '  with copies of several pariominoes.\n' );
%
%  Define R.
%
  shape_r = [ ...
    -1, +1, -1, +1; ...
    +1, -1, +1, -1 ];
  [ m_r, n_r ] = size ( shape_r );
  pariomino_print ( shape_r, '  Region R:' );
%
%  Define N, O, P
%
  shape_n = [ ...
    -1 ];
  [ m_n, n_n ] = size ( shape_n );
  pariomino_print ( shape_n, '  pariomino N:' );

  shape_o = [ ...
    +1, -1, +1 ];
  [ m_o, n_o ] = size ( shape_o );
  pariomino_print ( shape_o, '  pariomino O:' );

  shape_p = [ ...
     0,  0, -1;
    +1, -1, +1 ];
  [ m_p, n_p ] = size ( shape_p );
  pariomino_print ( shape_p, '  pariomino P:' );
%
%  Pack the arrays into P.
%
  p_num = 3;
  p = zeros ( m_r, n_r, p_num );
  p(1:m_n,1:n_n,1) = shape_n(1:m_n,1:n_n);
  p(1:m_o,1:n_o,2) = shape_o(1:m_o,1:n_o);
  p(1:m_p,1:n_p,3) = shape_p(1:m_p,1:n_p);
%
%  D indicates how many copies of each pariomino we can use.
%
  d = ones ( p_num, 1 );
%
%  Compute the system matrix.
%
  [ a, b, parent ] = pariomino_matrix ( shape_r, p_num, p, d );
  [ m, n ] = size ( a );
%
%  Print the linear system.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  System matrix A and right hand side B:\n' );
  fprintf ( 1, '\n' );
  for i = 1 : m
    fprintf ( 1, '  %2d:  ', i );
    for j = 1 : n
      fprintf ( 1, '%2d', a(i,j) );
    end
    fprintf ( 1, '  %2d\n', b(i) );
  end
%
%  Create the LP file.
%
  filename = '2x4.lp';
  label = '\ LP file for the 2x4 example.';
  [ m, n ] = size ( a );

  pariomino_lp_write ( filename, label, m, n, a, b );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  pariomino_lp_write created the LP file "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pariomino_lp_write_test02:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
