org.cpsolver.ifs.example.csp

## Class CSPVariable

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

- All Implemented Interfaces:
    Comparable<CSPVariable>

      public class CSPVariable
      extends Variable<CSPVariable,CSPValue>

  CSP variable.
  This class only implements generation of variable's values (domain)
  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

- - ### Field Summary

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

      `iId, iIndex, iValue`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSPVariable(int id, int domainSize)` Constructor
    `CSPVariable(int id, int domainSize, int kernelId)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `generateInitialValue(Random rnd)` Generate an intial value (for MPP and for forcing of existance of a solution)
    `int` | `getKernelId()` Get kernel id
    `String` | `getName()` Variable's name -- for printing purposes

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

      `addContstraint, addVariableListener, assign, compareTo, constraints, constraintVariables, equals, getAssignment, getAssignment, getAssignments, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getId, getIndex, getInitialAssignment, getLastIteration, getModel, getVariableListeners, hardConstraints, hasAssignment, hasAssignment, hashCode, hasInitialAssignment, hasValues, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setAssignment, setBestAssignment, setExtra, setIndex, setInitialAssignment, setLastIteration, setModel, setValues, softConstraints, toString, unassign, values, values, variableAssigned, variableUnassigned`

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

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

- - ### Constructor Detail

    - #### CSPVariable

          public CSPVariable(int id,
                             int domainSize)

      Constructor
      Parameters:
        `id` - variable id
        `domainSize` - number of values of the variable

    - #### CSPVariable

          public CSPVariable(int id,
                             int domainSize,
                             int kernelId)

      Constructor
      Parameters:
        `id` - variable id
        `domainSize` - number of values of the variable
        `kernelId` - kernel id (for structured CSP)

  - ### Method Detail

    - #### getKernelId

          public int getKernelId()

      Get kernel id
      Returns:
        kernel id

    - #### generateInitialValue

          public void generateInitialValue(Random rnd)

      Generate an intial value (for MPP and for forcing of existance of a solution)
      Parameters:
        `rnd` - random number generator

    - #### getName

          public String getName()

      Description copied from class: `Variable`
      Variable's name -- for printing purposes
      Overrides:
        `getName` in class `Variable<CSPVariable,CSPValue>`
      Returns:
        variable name