samples.tutorials.to_sort
Class Picross

java.lang.Object
  extended by choco.cp.model.CPModel
      extended by samples.tutorials.to_sort.Picross
All Implemented Interfaces:
IPretty, Model, Serializable

public class Picross
extends CPModel

This class implements a nonogram strategy.

See Also:
Serialized Form

Field Summary
 IntegerVariable[][] dualmyvars
           
 IntegerVariable[][] myvars
          The model variables.
 
Fields inherited from class choco.cp.model.CPModel
_iterator, clausesStore, constantVars, constraints, defDecExp, expVars, floatVars, intVars, LOGGER, nbBoolVar, properties, setVars, storedMultipleVariables
 
Constructor Summary
Picross(int[][] consRows, int[][] consCols, Solver s)
          Create a new nanogram
 
Method Summary
static void main(String[] args)
           
 void makeConstraint()
          Post the regular constraint with the DFAs created earlier
 void makeDFAs()
          Creates the Automaton used to describe the pattern constraints.
 void makeVar()
          Creates the choco variable : each variable represents a square, it is wether 0 (white) or 1 (black)
 void showSolution(Solver s)
          Draw the solution in a new Frame
 String toString(Solver solver)
           
 
Methods inherited from class choco.cp.model.CPModel
addConstraint, addConstraint, addConstraint, addConstraint, addConstraints, addConstraints, addOptions, addVariable, addVariable, addVariable, addVariable, addVariables, addVariables, constraintsToString, contains, getConstantVar, getConstraint, getConstraintByType, getConstraintIterator, getConstVarIterator, getDefaultExpressionDecomposition, getExprVarIterator, getIntConstraintIterator, getIntVar, getIntVarIndex, getIntVarIndex, getIntVarIterator, getMultipleVarIterator, getNbBoolVar, getNbConstantVars, getNbConstraintByType, getNbConstraints, getNbIntVars, getNbRealVars, getNbSetVars, getNbStoredMultipleVars, getNbTotVars, getRealVar, getRealVarIterator, getSetVar, getSetVarIterator, getStoredMultipleVar, pretty, readFromFile, remove, removeConstraint, removeConstraints, removeVariable, removeVariable, removeVariable, removeVariables, remVariable, setDefaultExpressionDecomposition, solutionToString, varsToString, writeInFile, writeInFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myvars

public IntegerVariable[][] myvars
The model variables.


dualmyvars

public IntegerVariable[][] dualmyvars
Constructor Detail

Picross

public Picross(int[][] consRows,
               int[][] consCols,
               Solver s)
Create a new nanogram

Parameters:
consRows - The constraint on the rows
consCols - The constraint on the columns
s -
Method Detail

makeVar

public void makeVar()
Creates the choco variable : each variable represents a square, it is wether 0 (white) or 1 (black)


makeDFAs

public void makeDFAs()
Creates the Automaton used to describe the pattern constraints. makeDFAs() first converts the two int[][] into regular expression then it makes automatons out of the regular expressions.


makeConstraint

public void makeConstraint()
Post the regular constraint with the DFAs created earlier


toString

public String toString(Solver solver)

showSolution

public void showSolution(Solver s)
Draw the solution in a new Frame


main

public static void main(String[] args)


Copyright © 2012. All Rights Reserved.