Class SimpleCartesianProductConstraintConverter

  • All Implemented Interfaces:
    IndexBasedConstraintConverter

    public class SimpleCartesianProductConstraintConverter
    extends java.lang.Object
    implements IndexBasedConstraintConverter
    Converts Constraint objects to their TupleList representation by executing their ConstraintFunction with every possible value combination of its parameters. This means the cartesian product of its parameters values is used. For example, if a constraint uses parameters "param1" with value "1" and "2" and "param2" with value "5" and "6", then the constraint it tested with all these combinations: {"1", "5"}, {"1", "6"}, {"2", "5"} ,{"2", "6"}. For all combinations for which the ConstraintFunction returns false, a corresponding tuple is added to the TupleList representation. Naturally, this is a very expensive conversion process, especially if there are many large parameters involved.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<de.rwth.swc.coffee4j.engine.TupleList> convert​(java.util.List<Constraint> constraints, java.util.List<Parameter> parameters)
      Converts all constraints to tuple lists by using the index based schema explained in ModelConverter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleCartesianProductConstraintConverter

        public SimpleCartesianProductConstraintConverter()
    • Method Detail

      • convert

        public java.util.List<de.rwth.swc.coffee4j.engine.TupleList> convert​(java.util.List<Constraint> constraints,
                                                                             java.util.List<Parameter> parameters)
        Description copied from interface: IndexBasedConstraintConverter
        Converts all constraints to tuple lists by using the index based schema explained in ModelConverter. The constraints need to be converted in order.
        Specified by:
        convert in interface IndexBasedConstraintConverter
        Parameters:
        constraints - all constraint which need to be converted. Must not be null but can be empty
        parameters - the parameters containing the values for the conversion. Must not be null. Can only be empty if constraints is empty too as otherwise parameters are constrained
        Returns:
        the converted constraints in the same order as the given constraints