choco.kernel.solver.constraints.integer.extension
Class IterTuplesTable

java.lang.Object
  extended by choco.kernel.solver.constraints.integer.extension.TuplesList
      extended by choco.kernel.solver.constraints.integer.extension.IterTuplesTable
All Implemented Interfaces:
IterLargeRelation, LargeRelation

public class IterTuplesTable
extends TuplesList
implements IterLargeRelation, LargeRelation


Field Summary
protected  int[] dsizes
          The sizes of the domains
protected  int nbVar
          number of variables
protected  int[] offsets
          The lower bound of each variable
protected  int[][][] table
          table[i][j] gives the table of supports as an int[] for value j of variable i
 
Fields inherited from class choco.kernel.solver.constraints.integer.extension.TuplesList
tuplesIndexes
 
Constructor Summary
IterTuplesTable(List<int[]> tuples, int[] offsets, int[] domSizes)
           
 
Method Summary
 void buildInitialListOfSupports(List<int[]> tuples)
           
 boolean checkTuple(int[] tuple)
          return true if tuple is feasible according to the definition of the relation. e.g if the relation is defined with infeasible tuples, it returns true if tuple is one of them.
 int getNbSupport(int var, int val)
          return the number of supports of the pair (var, val) assuming the offset has already been removed
 int[] getNbSupportFor(List<int[]> tups, int i)
          return the number of tuples supporting each value of variable i
 int getRelationOffset(int var)
           
 int[][][] getTableLists()
          for fast access
 boolean isConsistent(int[] tuple)
          Test whether a tuple is consistent
 int seekNextTuple(int oldidx, int var, int val)
          This relation do not take advantage of the knowledge of the previous support !
 
Methods inherited from class choco.kernel.solver.constraints.integer.extension.TuplesList
getTuple, getTupleTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface choco.kernel.solver.constraints.integer.extension.IterLargeRelation
getTuple
 

Field Detail

table

protected int[][][] table
table[i][j] gives the table of supports as an int[] for value j of variable i


nbVar

protected int nbVar
number of variables


dsizes

protected int[] dsizes
The sizes of the domains


offsets

protected int[] offsets
The lower bound of each variable

Constructor Detail

IterTuplesTable

public IterTuplesTable(List<int[]> tuples,
                       int[] offsets,
                       int[] domSizes)
Method Detail

getNbSupportFor

public int[] getNbSupportFor(List<int[]> tups,
                             int i)
return the number of tuples supporting each value of variable i

Parameters:
tups -
i - a variable
Returns:

buildInitialListOfSupports

public void buildInitialListOfSupports(List<int[]> tuples)

getTableLists

public int[][][] getTableLists()
for fast access

Returns:

seekNextTuple

public int seekNextTuple(int oldidx,
                         int var,
                         int val)
This relation do not take advantage of the knowledge of the previous support ! so start from scratch

Specified by:
seekNextTuple in interface IterLargeRelation
Parameters:
oldidx -
var -
val - is the value assuming the offset has already been removed
Returns:

getNbSupport

public int getNbSupport(int var,
                        int val)
return the number of supports of the pair (var, val) assuming the offset has already been removed

Specified by:
getNbSupport in interface IterLargeRelation
Parameters:
var -
val -
Returns:

getRelationOffset

public int getRelationOffset(int var)

checkTuple

public boolean checkTuple(int[] tuple)
Description copied from interface: LargeRelation
return true if tuple is feasible according to the definition of the relation. e.g if the relation is defined with infeasible tuples, it returns true if tuple is one of them.

Specified by:
checkTuple in interface LargeRelation
Overrides:
checkTuple in class TuplesList
Returns:

isConsistent

public boolean isConsistent(int[] tuple)
Description copied from interface: LargeRelation
Test whether a tuple is consistent

Specified by:
isConsistent in interface LargeRelation
Overrides:
isConsistent in class TuplesList
Returns:
true if tuple is consistent.


Copyright © 2012. All Rights Reserved.