function scip_solution_read_test ( )

%*****************************************************************************80
%
%% scip_solution_read_test tests scip_solution_read.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    11 March 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../scip_solution_read' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'scip_solution_read_test:\n' );
  fprintf ( 1, '  MATLAB version.\n' );
  fprintf ( 1, '  Test scip_solution_read,\n' );
  fprintf ( 1, '  which tries to extract the solution vectors\n' );
  fprintf ( 1, '  X returned by SCIP for a particular polyomino tiling problem.\n' );

  filename = 'reid.csv';
  scip_solution_read_demo ( filename );

   filename = 'pent5x6.csv';
   scip_solution_read_demo ( filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'scip_solution_read_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../scip_solution_read' );

  return
end
function scip_solution_read_demo ( filename )

%*****************************************************************************80
%
%% SCIP_SOLUTION_READ_DEMO analyzes an SCIP solution read from a file.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    13 June 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'SCIP_SOLUTION_READ_DEMO:\n' );
  fprintf ( 1, '  MATLAB version.\n' );
  fprintf ( 1, '  SCIP solution file to be read is "%s"\n', filename );

  x = scip_solution_read ( filename );
%
%  Report the solutions.
%
  [ x_dim, x_num ] = size ( x );

  i4mat_print ( x_dim, x_num, x, ' Unscrambled solution data:' );
%
%  Save X as a text file.
%
  [ filepath, name, extension ] = fileparts ( filename );
  filename2 = strcat ( name, '.txt' );

  output = fopen ( filename2, 'wt' );

  for i = 1 : x_dim
    for j = 1 : x_num
      fprintf ( output, '  %g', x(i,j) );
    end
    fprintf ( output, '\n' );
  end
  fclose ( output );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Wrote the ASCII file "%s"\n', filename2 );

  return
end
