net.sf.cpsolver.ifs.extension
Class AssignmentSet

java.lang.Object
  extended by net.sf.cpsolver.ifs.extension.AssignmentSet

public class AssignmentSet
extends Object

This class describing a set of assignment (used by CBS). It also contains a counter, name, description and a constraint (for printing purposes).

Version:
IFS 1.1 (Iterative Forward Search)
Copyright (C) 2006 Tomáš Müller
muller@unitime.org
Lazenska 391, 76314 Zlin, Czech Republic

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 2.1 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Constructor Summary
AssignmentSet()
           
AssignmentSet(Assignment[] assignments)
           
AssignmentSet(Collection assignments)
           
 
Method Summary
 void addAssignment(Assignment assignment)
          Adds an assignment
 void addAssignment(long iteration, Value value, double ageing)
          Adds an assignment
 boolean contains(Assignment assignment)
          Returns true if it contains the given assignment
 boolean contains(AssignmentSet assignmentSet)
           
 boolean contains(Collection assignments)
           
 boolean contains(Value value)
          Returns true if it contains the given assignment
 boolean contains(Variable variable)
          Returns true if it contains the given assignment (assigned variable)
static AssignmentSet createAssignmentSet(long iteration, Collection assignments, double ageing)
          Create set of assignments from the list of Assignments, Values or (assigned) Variables
 boolean equals(Object o)
          Compares two assignment sets -- name, size and content (assignments) has to match.
 Assignment getAssignment(Value value)
          Returns assignment that corresponds to the given value (if it is present in the set)
 Constraint getConstraint()
          Returns constraint
 int getCounter()
          Returns counter
 String getDescription()
          Returns description
 String getName()
          Returns name
 Vector getSet()
          Returns set of assignments
 int hashCode()
           
 void incCounter()
          Increment counter
 void setConstraint(Constraint constraint)
          Sets constraint
 void setDescription(String description)
          Sets description
 void setName(String name)
          Sets name
 int size()
          Returns number of assignments in the set
static int xor(int a, int b)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssignmentSet

public AssignmentSet()

AssignmentSet

public AssignmentSet(Assignment[] assignments)

AssignmentSet

public AssignmentSet(Collection assignments)
Method Detail

createAssignmentSet

public static AssignmentSet createAssignmentSet(long iteration,
                                                Collection assignments,
                                                double ageing)
Create set of assignments from the list of Assignments, Values or (assigned) Variables


incCounter

public void incCounter()
Increment counter


getCounter

public int getCounter()
Returns counter


getSet

public Vector getSet()
Returns set of assignments


getName

public String getName()
Returns name


setName

public void setName(String name)
Sets name


getDescription

public String getDescription()
Returns description


setDescription

public void setDescription(String description)
Sets description


getConstraint

public Constraint getConstraint()
Returns constraint


setConstraint

public void setConstraint(Constraint constraint)
Sets constraint


contains

public boolean contains(Assignment assignment)
Returns true if it contains the given assignment


contains

public boolean contains(AssignmentSet assignmentSet)

contains

public boolean contains(Value value)
Returns true if it contains the given assignment


contains

public boolean contains(Variable variable)
Returns true if it contains the given assignment (assigned variable)


contains

public boolean contains(Collection assignments)

addAssignment

public void addAssignment(Assignment assignment)
Adds an assignment


addAssignment

public void addAssignment(long iteration,
                          Value value,
                          double ageing)
Adds an assignment


getAssignment

public Assignment getAssignment(Value value)
Returns assignment that corresponds to the given value (if it is present in the set)


size

public int size()
Returns number of assignments in the set


equals

public boolean equals(Object o)
Compares two assignment sets -- name, size and content (assignments) has to match.

Overrides:
equals in class Object

xor

public static int xor(int a,
                      int b)

hashCode

public int hashCode()
Overrides:
hashCode in class Object