org.cpsolver.instructor.model

## Class InstructorSchedulingModel

- java.lang.Object
- - org.cpsolver.ifs.model.Model<TeachingRequest.Variable,TeachingAssignment>
  - - org.cpsolver.instructor.model.InstructorSchedulingModel

- Direct Known Subclasses:
    Test

      public class InstructorSchedulingModel
      extends Model<TeachingRequest.Variable,TeachingAssignment>

  Instructor Scheduling Model. Variables are `TeachingRequest`, values are `TeachingAssignment`. Each teaching request has a course (see `Course`) and one or more sections (see {link `Section`}). Each assignment assigns one instructor (see `Instructor`) to a single teaching request.
  Version:
    IFS 1.3 (Instructor Sectioning)
    Copyright (C) 2016 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/.
  Author:
    Tomáš Müller

- - ### Field Summary

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

      `sDoubleFormat, sPercentageFormat, sTimeFormat`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InstructorSchedulingModel(DataProperties properties)` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAttributeType(Attribute.Type type)` Register an attribute type
    `void` | `addInstructor(Instructor instructor)` Add instructor
    `void` | `addRequest(TeachingRequest request)` Add teaching request and the related variables
    `protected static String` | `bitset2string(BitSet b)` Convert bitset to a bit string
    `protected static BitSet` | `createBitSet(String bitString)` Create BitSet from a bit string
    `Set<Attribute.Type>` | `getAttributeTypes()` Return registered attribute types
    `Map<String,String>` | `getInfo(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)` Returns information about the current solution.
    `List<Instructor>` | `getInstructors()` All instructors
    `DataProperties` | `getProperties()` Return solver configuration
    `List<TeachingRequest>` | `getRequests()` All teaching requests
    `double` | `getTotalValue(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)` Value of the current solution.
    `double` | `getTotalValue(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, Collection<TeachingRequest.Variable> variables)` Value of the current solution.
    `List<BitSet>` | `getWeeks()` The method creates date patterns (bitsets) which represent the weeks of a semester.
    `boolean` | `load(Document document, Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)` Load the problem (and its solution) from an XML format
    `Document` | `save(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)` Store the problem (together with its solution) in an XML format
    `protected static int` | `string2preference(String pref)` Convert preference string to a preference value

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

      `addConstraint, addCriterion, addGlobalConstraint, addModelListener, addVariable, afterAssigned, afterAssigned, afterUnassigned, afterUnassigned, assignedVariables, assignedVariables, beforeAssigned, beforeAssigned, beforeUnassigned, beforeUnassigned, bestUnassignedVariables, bestUnassignedVariables, clearAssignmentContexts, clearBest, conflictConstraints, conflictValues, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, createAssignmentContexts, createInheritedAssignment, createReference, getBestPerturbations, getBestUnassignedVariables, getBestValue, getCriteria, getCriterion, getDefaultAssignment, getEmptyAssignment, getExtendedInfo, getExtendedInfo, getInfo, getInfo, getInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, getTotalValue, getTotalValue, globalConstraints, inConflict, inConflict, init, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrAssignedVariables, nrUnassignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, perturbVariables, perturbVariables, perturbVariables, removeConstraint, removeCriterion, removeCriterion, removeGlobalConstraint, removeModelListener, removeReference, removeVariable, restoreBest, restoreBest, restoreBest, saveBest, saveBest, setBestValue, setDefaultAssignment, toString, toString, unassignedHardConstraints, unassignedVariables, unassignedVariables, variables, variablesWithInitialValue, weaken`

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

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

- - ### Constructor Detail

    - #### InstructorSchedulingModel

          public InstructorSchedulingModel(DataProperties properties)

      Constructor
      Parameters:
        `properties` - data properties

  - ### Method Detail

    - #### getProperties

          public DataProperties getProperties()

      Return solver configuration
      Returns:
        data properties given in the constructor

    - #### addInstructor

          public void addInstructor(Instructor instructor)

      Add instructor
      Parameters:
        `instructor` - an instructor

    - #### getInstructors

          public List<Instructor> getInstructors()

      All instructors
      Returns:
        all instructors in the model

    - #### addRequest

          public void addRequest(TeachingRequest request)

      Add teaching request and the related variables
      Parameters:
        `request` - teaching request

    - #### getRequests

          public List<TeachingRequest> getRequests()

      All teaching requests
      Returns:
        all teaching requests in the model

    - #### getAttributeTypes

          public Set<Attribute.Type> getAttributeTypes()

      Return registered attribute types
      Returns:
        attribute types in the problem

    - #### addAttributeType

          public void addAttributeType(Attribute.Type type)

      Register an attribute type
      Parameters:
        `type` - attribute type

    - #### getInfo

          public Map<String,String> getInfo(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)

      Description copied from class: `Model`
      Returns information about the current solution. Information from all model listeners and constraints is also included.
      Overrides:
        `getInfo` in class `Model<TeachingRequest.Variable,TeachingAssignment>`
      Parameters:
        `assignment` - current assignment
      Returns:
        info table

    - #### getTotalValue

          public double getTotalValue(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)

      Description copied from class: `Model`
      Value of the current solution. It is the sum of all assigned values, i.e., `Value.toDouble(Assignment)`.
      Overrides:
        `getTotalValue` in class `Model<TeachingRequest.Variable,TeachingAssignment>`
      Parameters:
        `assignment` - current assignment
      Returns:
        solution value

    - #### getTotalValue

          public double getTotalValue(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
                                      Collection<TeachingRequest.Variable> variables)

      Description copied from class: `Model`
      Value of the current solution. It is the sum of all assigned values, i.e., `Value.toDouble(Assignment)`. Only variables from the given set are considered.
      Overrides:
        `getTotalValue` in class `Model<TeachingRequest.Variable,TeachingAssignment>`
      Parameters:
        `assignment` - current assignment
        `variables` - sub-problem
      Returns:
        solution value

    - #### save

          public Document save(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)

      Store the problem (together with its solution) in an XML format
      Parameters:
        `assignment` - current assignment
      Returns:
        XML document with the problem

    - #### load

          public boolean load(Document document,
                              Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)

      Load the problem (and its solution) from an XML format
      Parameters:
        `document` - XML document
        `assignment` - current assignment
      Returns:
        true, if the problem was successfully loaded in

    - #### bitset2string

          protected static String bitset2string(BitSet b)

      Convert bitset to a bit string

    - #### createBitSet

          protected static BitSet createBitSet(String bitString)

      Create BitSet from a bit string

    - #### string2preference

          protected static int string2preference(String pref)

      Convert preference string to a preference value

    - #### getWeeks

          public List<BitSet> getWeeks()

      The method creates date patterns (bitsets) which represent the weeks of a semester.
      Returns:
        a list of BitSets which represents the weeks of a semester.