org.cpsolver.ifs.example.csp

## Class Test

- java.lang.Object
- - org.cpsolver.ifs.example.csp.Test

-     public class Test
      extends Object

  Test of Structured CSP problems. It takes one argument -- property file with all the parameters. It allows to execute given number of tests. It also allows to define several configurations which will be executed. For instance CSP(20,15,5%..95%,5..95%), 10 runs of each configuration. All such configuration are processed in one run of Test class.
  In Structured CSP, variables are divided into several kernels (some variables may remain ouside kernels). Different constraints (in density and tightnes) are generated according to whether variables are from the same kernel or not.
  Test's parameters:

  Related Solver Parameters
  Parameter | Type | Comment
  --- | --- | ---
  General.MPP | `String` | Minimal perturbation problem (if true), this mj. means that initial assignment will be generated
  CSP.Seed | `Long` | Random number generator seed, `System.currentTimeMillis()` is taken if not present
  CSP.ForceSolutionExistance | `Boolean` | If true, generated problem will always have at least one feasible solution
  CPS.NrTests | `Integer` | Number of tests (for each input configuration)
  CSP.NrVariables | `Integer` | Number of variables
  CSP.NrVariablesMin CSP.NrVariablesMax CSP.NrVariablesStep | `Integer` | Range of the number variables (a set of different configurations will be generated) Use either CSP.NrVariables or these CSP.NrVariablesMin, CSP.NrVariablesMax, CSP.NrVariablesStep
  CSP.DomainSize | `Integer` | Number of values of every variable
  CSP.DomainSizeRatio | `Double` | Number of values as a ration of the number of variables. This way we can model for instance CSP(N,2N,p1,p2) problems with one configuration. Use either CSP.DomainSize or CSP.DomainSizeRatio
  CSP.Tightness | `Double` | Tightness of constraints outside kernels
  CSP.TightnessMin CSP.TightnessMax CSP.TightnessStep | `Double` | Tightness of constraints outside kernels given as a range → respective configurations will be generated and tested
  CSP.Density | `Double` | Density of constraints outside kernels
  CSP.DensityMin CSP.DensityMax CSP.DensityStep | `Double` | Density of constraints outside kernels given as a range → respective configurations will be generated and tested
  CSP.NrKernels | `Integer` | Number of kernels (Structured CSP, use 0 for "normal" CSP)
  CSP.KernelSize | `Integer` | Number of variables in each kernel
  CSP.KernelTightness | `Double` | Tightness of constraints inside a kernel
  CSP.KernelDensity | `Double` | Density of constraints inside a kernel
  CSP.SameProblemEachStep | `Boolean` | If true, each configuration will start with the same seed
  CSP.SameProblemEachTest | `Boolean` | If true, each test of the same configuration will start with the same seed
  General.Output | `String` | Output folder where a log file and tables with results. In order not to overwrite the results if executed more than once, a subfolder with the name taken from current date and time will be created in this folder and all results will go to this subfolder.

  Also, the configuration file can consist only from one parameter (named INCLUDE_REGEXP) which is processed as a regular expression of semicolon separated list of property files, for instance

      INCLUDE_REGEXP=general.ini;{CSP(50,12,250,p2)|CSP(25,15,198,p2)}.ini;{std|opt}.ini;{10x1min}.ini;{cbs|rw1|tabu20}.ini

  where {a|b|c|...} means a selection of a, b, c, .. All possible combinations are taken and for each of them an input configuration is combined from the relevant files. So, for instance, the above example will result into the following configurations:
  - general.ini;CSP(50,12,250,p2).ini;std.ini;10x1min.ini;cbs.ini
  - general.ini;CSP(50,12,250,p2).ini;std.ini;10x1min.ini;rw1.ini
  - general.ini;CSP(50,12,250,p2).ini;std.ini;10x1min.ini;tabu20.ini
  - general.ini;CSP(50,12,250,p2).ini;opt.ini;10x1min.ini;cbs.ini
  - general.ini;CSP(50,12,250,p2).ini;opt.ini;10x1min.ini;rw1.ini
  - general.ini;CSP(50,12,250,p2).ini;opt.ini;10x1min.ini;tabu20.ini
  - general.ini;CSP(25,15,198,p2).ini;std.ini;10x1min.ini;cbs.ini
  - general.ini;CSP(25,15,198,p2).ini;std.ini;10x1min.ini;rw1.ini
  - general.ini;CSP(25,15,198,p2).ini;std.ini;10x1min.ini;tabu20.ini
  - general.ini;CSP(25,15,198,p2).ini;opt.ini;10x1min.ini;cbs.ini
  - general.ini;CSP(25,15,198,p2).ini;opt.ini;10x1min.ini;rw1.ini
  - general.ini;CSP(25,15,198,p2).ini;opt.ini;10x1min.ini;tabu20.ini
  To be able to distinguish such configuration a subfolder in General.Output folder is created, its name is combined from the names which are in parenthesis. So, for instance the first bunch of tests will output into the folder:

       ${General.Output}\CSP(50,12,250,p2)_std_10x1min_csb\25-Feb-05_191136

  If one parameter is defined in more than one configuration files (e.g. in general.ini as well as cbs.ini) the one from the file more on the right is taken.
  An example of the configurations:
  File general.ini

       #Default settings common for all configurations
       General.MPP=false
       General.InitialAssignment=false
       General.Output=output\\RandomCSP\\IFS

       #Value selection heuristics
       Value.Class=org.cpsolver.ifs.heuristics.GeneralValueSelection
       Value.WeightWeightedConflicts=0.0
       Value.RandomWalkProb=0.0
       Value.WeightConflicts=1.0
       Value.WeightNrAssignments=0.0
       Value.WeightValue=0.0
       Value.Tabu=0

       #Variable selection heuristics
       Variable.Class=org.cpsolver.ifs.heuristics.GeneralVariableSelection
       Variable.RandomSelection=true

       #Termination condition
       Termination.Class=org.cpsolver.ifs.termination.GeneralTerminationCondition
       Termination.MaxIters=-1
       Termination.TimeOut=-1
       Termination.StopWhenComplete=true

       #Solution comparator
       Comparator.Class=org.cpsolver.ifs.solution.GeneralSolutionComparator

  File CSP(50,12,250,p2).ini

       #Sparse problem CSP(50,12,250/1225,p2)
       CSP.NrVariables=50
       CSP.DomainSize=12
       CSP.Density=0.2
       CSP.TightnessMin=0.10
       CSP.TightnessMax=0.95
       CSP.TightnessStep=0.02

       CSP.Seed=780921

       CSP.ForceSolutionExistance=false
       CSP.SameProblemEachStep=false
       CSP.SameProblemEachTest=false

       CSP.NrKernels=0

  File std.ini

       #Standard problem
       CSP.ForceSolutionExistance=false

  File opt.ini

       #Optimization problem (minCSP)
       #Value selection: use weigh of a conflict, but when there are more than one value
       #        with the same number of conflicts, use the one with lower value
       Value.WeightValue=0.0001
       Value.WeightConflicts=1.0
       #Do not stop when a complete solution is found
       Termination.StopWhenComplete=false

  File 10x1min.ini

       #For each configuration, execute 10 tests, each with 1 minute timeout
       CPS.NrTests=10
       Termination.TimeOut=60

  File cbs.ini

       #Use conflict-based statistics
       Extensions.Classes=org.cpsolver.ifs.extension.ConflictStatistics
       Value.WeightWeightedConflicts=1.0

  File tabu20.ini

       #Use tabu-list of the length 20
       Value.Tabu=20

  File rw1.ini

       #Use 1% random walk selection
       Value.RandomWalkProb=0.01

  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2006 - 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.
  Author:
    Tomáš Müller
  See Also:
    `StructuredCSPModel`, `ConflictStatistics`, `GeneralValueSelection`, `GeneralVariableSelection`, `GeneralTerminationCondition`, `GeneralSolutionComparator`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Test()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `main(String[] args)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Test

          public Test()

  - ### Method Detail

    - #### main

          public static void main(String[] args)