Testing the code using a sample input file

If the executable (bin/maxent) has been installed by invoking make or make maxent in the top-directory, then one can run the program. A few sample input data files are provided in the tests sub-directory. All the input data files can be run in the top-directory by executing:

make check > <output-file>

and the output is piped to the <output-file>. If you would like to run individual test examples, then use the command cd run to change to the run directory. To execute the program from this directory, you have to invoke the following command:

../bin/maxent < <path-to-input-data-file> > <output-file>

For example, if the input data file tests/8nodes3d.dat is used, then execute the following command:

../bin/maxent < ../tests/8nodes3d.dat > 8nodes3d-output.dat

A file check.dat is created, where the input parameters are printed out. The sample input data file tests/8nodes3d.dat is reproduced below.

                 Input data file: tests/8nodes3d.dat
3 8
0.25 0.15 0.05
0.0000000000000e+00 0.0000000000000e+00 0.0000000000000e+00
1.0000000000000e+00 0.0000000000000e+00 0.0000000000000e+00
0.0000000000000e+00 1.0000000000000e+00 0.0000000000000e+00
1.0000000000000e+00 1.0000000000000e+00 0.0000000000000e+00
0.0000000000000e+00 0.0000000000000e+00 1.0000000000000e+00
1.0000000000000e+00 0.0000000000000e+00 1.0000000000000e+00
0.0000000000000e+00 1.0000000000000e+00 1.0000000000000e+00
1.0000000000000e+00 1.0000000000000e+00 1.0000000000000e+00
100 1.d-14
1 uniform newton
All lines with non-numeric data are not read, but to facilitate understanding of the input data file it is advisable to indicate on these lines what parameters are expected to be read on the very next line. Referring to the above input data file, on the first line, NSD and NODES are the number of spatial dimensions and number of nodes, respectively. On the next line, NSD = 3 and NODES = 8 are indicated. On the third line, POINT refers to the Cartesian coordinates of the point in NSD-dimensions (for example, a Gauss integration point in a meshfree computation or an output point in a data approximation problem) where the evaluation of the maximum-entropy basis functions is needed. On the fourth line, POINT = {0.25,0.15,0.05} is indicated. On the fifth line, COORDS appears, which indicates that in the next 8 (NODES = 8) lines, the coordinates of the nodes are specified. In the above case, the nodal coordinates of a unit cube are specified. On line 14, MAXITER (maximum number of iterations) and TOL (convergence tolerance) are listed, and these values are set on line 15. On line 16, RMAX, PRIOR, and SOLUTION-SCHEME are indicated, and one particular setting for these parameters is shown on line 17. RMAX is the support size if a compactly-supported weight function is used as a prior. This value must be picked so that the POINT has at least NSD+1 neighbors. There are five options that are available for the choice of a prior: PRIOR = {uniform, cubic, quartic, gaussian, gaussian-rbf}. For a uniform prior, RMAX should be set to the characteristic linear dimension of the domain. It is assumed that for any non-uniform prior, all the nodes listed in the input file are neighbors. Hence, do ensure that the value of the support size is appropriately set, so that for $ {x}\in D$, $ w_i({x}) > 0 $ for all $ i$. Three different solution schemes are available to solve the convex optimization problem (steepest descent, Newton's method, and Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) algorithm): SOLUTION-SCHEME = {descent, newton, lbfgs}.

The output file 8nodes3d-output.dat and tests/results/8nodes3d.output must match; the latter is shown below (in the interest of space, only $ \phi_i$ are listed). For the input file tests/3nodes1d-uniform.dat, the exact solution for the max-ent basis functions is presented in Reference [14, Eq. (31)]. In the tests directory, in addition to 1D, 2D, and 3D data, an input file with nodes at the vertices of a hypercube in four dimensions ( $ D = [0,1]^4$) is also provided. You can repeat the above checks for all the input data files that are available in the tests sub-directory to ensure that the installation and program output are correct.

              Output file: tests/results/8nodes3d.output

 . . . . 
 ITER and ERROR:  0 0.6224949798994366
 ITER and ERROR:  1 0.06695084055654463
 ITER and ERROR:  2 0.006905786017980535
 ITER and ERROR:  3 0.00017430863425530217
 ITER and ERROR:  4 5.2009267516942105E-8
 ITER and ERROR:  5 1.0552434222233532E-14

 ***************** NEWTON METHOD *********************
 POINT =  0.25 0.15 0.05
 ERROR =  3.2148521626575033E-17
    1  1.0986122886681E+00
    2  1.7346010553881E+00
    3  2.9444389791664E+00
    1 6.0562500000000E-01
    2 2.0187500000000E-01
    3 1.0687500000000E-01
    4 3.5625000000000E-02
    5 3.1875000000000E-02
    6 1.0625000000000E-02
    7 5.6250000000000E-03
    8 1.8750000000000E-03

N. Sukumar
Copyright © 2008