org.cpsolver.ifs.example.csp

## Class CSPModel

- java.lang.Object
- - org.cpsolver.ifs.model.Model<CSPVariable,CSPValue>
  - - org.cpsolver.ifs.example.csp.CSPModel

-     public class CSPModel
      extends Model<CSPVariable,CSPValue>

  Random Binary CSP with uniform distribution.
  A random CSP is defined by a four-tuple (n, d, p1, p2), where n denotes the number of variables and d denotes the domain size of each variable, p1 and p2 are two probabilities. They are used to generate randomly the binary constraints among the variables. p1 represents the probability that a constraint exists between two different variables and p2 represents the probability that a pair of values in the domains of two variables connected by a constraint are incompatible.
  We use a so called model B of Random CSP (n, d, n1, n2) where n1 = p1*n*(n-1)/2 pairs of variables are randomly and uniformly selected and binary constraints are posted between them. For each constraint, n2 = p1*d^2 randomly and uniformly selected pairs of values are picked as incompatible.
  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/.

- - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.model.Model

      `sDoubleFormat, sPercentageFormat, sTimeFormat`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSPModel()`
    `CSPModel(int nrVariables, int nrValues, int nrConstraints, int nrCompatiblePairs, long seed)` Constructor

  - ### Method Summary

    - ### Methods inherited from class org.cpsolver.ifs.model.Model

      `addConstraint, addCriterion, addGlobalConstraint, addModelListener, addVariable, afterAssigned, afterAssigned, afterUnassigned, afterUnassigned, assignedVariables, assignedVariables, beforeAssigned, beforeAssigned, beforeUnassigned, beforeUnassigned, bestUnassignedVariables, bestUnassignedVariables, clearAssignmentContexts, clearBest, conflictConstraints, conflictValues, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, createAssignmentContexts, createInheritedAssignment, createReference, getBestPerturbations, getBestUnassignedVariables, getBestValue, getCriteria, getCriterion, getDefaultAssignment, getEmptyAssignment, getExtendedInfo, getExtendedInfo, getInfo, getInfo, getInfo, getInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, getTotalValue, getTotalValue, getTotalValue, getTotalValue, globalConstraints, inConflict, inConflict, init, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrAssignedVariables, nrUnassignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, perturbVariables, perturbVariables, removeConstraint, removeCriterion, removeCriterion, removeGlobalConstraint, removeModelListener, removeReference, removeVariable, restoreBest, restoreBest, restoreBest, saveBest, saveBest, setBestValue, setDefaultAssignment, toString, toString, unassignedHardConstraints, unassignedVariables, unassignedVariables, variables, variablesWithInitialValue, weaken`

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

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

- - ### Constructor Detail

    - #### CSPModel

          public CSPModel(int nrVariables,
                          int nrValues,
                          int nrConstraints,
                          int nrCompatiblePairs,
                          long seed)

      Constructor
      Parameters:
        `nrVariables` - number of variables in the problem
        `nrValues` - number of values of each variable
        `nrConstraints` - number of constraints in the problem
        `nrCompatiblePairs` - number of compatible pairs of values for every constraint
        `seed` - seed for random number generator (use `System.currentTimeMillis()` if not bother)

    - #### CSPModel

          public CSPModel()