org.cpsolver.ifs.example.jobshop

## Class Machine

- java.lang.Object
- - org.cpsolver.ifs.model.Constraint<Operation,Location>
  - - org.cpsolver.ifs.example.jobshop.Machine

- All Implemented Interfaces:
    Comparable<Constraint<Operation,Location>>

      public class Machine
      extends Constraint<Operation,Location>

  Machine constraint.
  Each machine contians a given set of operations (variables). A machine constraint is satisfied, if all operations on it do not overlap in time.
  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/.

- - ### Field Summary

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

      `iConstraintListeners, iId`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Machine(int machineNumber)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `computeConflicts(Assignment<Operation,Location> assignment, Location location, Set<Location> conflicts)` Adds conflicting operations into the set of conflicts.
    `int` | `getMachineNumber()` Get machine number
    `String` | `getName()` Name of the machine (e.g.
    `boolean` | `inConflict(Assignment<Operation,Location> assignment, Location location)` True if there is an operation from the machine which violates with the given assignment.
    `boolean` | `isConsistent(Location value1, Location value2)` True if the two assignments (placement of opeartions of the machine in time) violates each other.
    `String` | `toString()` string representation -- for debuging and printing purposes

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

      `addConstraintListener, addVariable, assigned, assignedVariables, compareTo, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, isHard, removeConstraintListener, removeVariable, setModel, unassigned, variables`

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

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

- - ### Constructor Detail

    - #### Machine

          public Machine(int machineNumber)

      Constructor
      Parameters:
        `machineNumber` - machine number

  - ### Method Detail

    - #### getMachineNumber

          public int getMachineNumber()

      Get machine number
      Returns:
        machine number

    - #### computeConflicts

          public void computeConflicts(Assignment<Operation,Location> assignment,
                                       Location location,
                                       Set<Location> conflicts)

      Adds conflicting operations into the set of conflicts.
      Specified by:
        `computeConflicts` in class `Constraint<Operation,Location>`
      Parameters:
        `assignment` - current assignment
        `location` - value to be assigned to its variable
        `conflicts` - resultant set of conflicting values

    - #### inConflict

          public boolean inConflict(Assignment<Operation,Location> assignment,
                                    Location location)

      True if there is an operation from the machine which violates with the given assignment.
      Overrides:
        `inConflict` in class `Constraint<Operation,Location>`
      Parameters:
        `assignment` - current assignment
        `location` - given value
      Returns:
        true if there is a conflict with other assigned variables of the constraint

    - #### isConsistent

          public boolean isConsistent(Location value1,
                                      Location value2)

      True if the two assignments (placement of opeartions of the machine in time) violates each other.
      Overrides:
        `isConsistent` in class `Constraint<Operation,Location>`
      Parameters:
        `value1` - a value
        `value2` - a value
      Returns:
        true if the constraint is ok with the assignment

    - #### toString

          public String toString()

      string representation -- for debuging and printing purposes
      Overrides:
        `toString` in class `Object`

    - #### getName

          public String getName()

      Name of the machine (e.g. M10 where 10 is the machine number)
      Overrides:
        `getName` in class `Constraint<Operation,Location>`
      Returns:
        constraint name