net.sf.cpsolver.ifs.constant
Class ConstantModel

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Model
      extended by net.sf.cpsolver.ifs.constant.ConstantModel
Direct Known Subclasses:
TimetableModel

public class ConstantModel
extends Model

Extension of the model with constant variables. Such variables are excluded from the solver process, however, they can be included in constraints. Such model can allow us to build a solution on top of another solution (e.g., committed classes in the course timetabling). Constant variable has to implement interface ConstantVariable, returning ConstantVariable.isConstant() true.

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

Field Summary
 
Fields inherited from class net.sf.cpsolver.ifs.model.Model
iAssignedVariables, iPerturbVariables, iUnassignedVariables, sDoubleFormat, sPercentageFormat, sTimeFormat
 
Constructor Summary
ConstantModel()
           
 
Method Summary
 void addVariable(Variable variable)
          Adds a variable to the model
 void afterAssigned(long iteration, Value value)
          Called after a value is assigned to its variable.
 void afterUnassigned(long iteration, Value value)
          Called after a value is unassigned from its variable.
 void beforeAssigned(long iteration, Value value)
          Called before a value is assigned to its variable.
 void beforeUnassigned(long iteration, Value value)
          Called before a value is unassigned from its variable.
 Vector constantVariables()
          List of constant variables
 boolean hasConstantVariables()
          True, if the model contains at least one constant variable.
 boolean isConstant(Variable variable)
          True, if the given variable is constant.
 void removeVariable(Variable variable)
          Removes a variable from the model
 
Methods inherited from class net.sf.cpsolver.ifs.model.Model
addConstraint, addGlobalConstraint, addModelListener, assignedVariables, bestUnassignedVariables, clearBest, conflictConstraints, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, getBestPerturbations, getBestUnassignedVariables, getExtendedInfo, getInfo, getInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, getTotalValue, getTotalValue, globalConstraints, inConflict, init, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, removeConstraint, removeGlobalConstraint, removeModelListener, restoreBest, saveBest, toString, unassignedHardConstraints, unassignedVariables, variables, variablesWithInitialValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstantModel

public ConstantModel()
Method Detail

constantVariables

public Vector constantVariables()
List of constant variables


hasConstantVariables

public boolean hasConstantVariables()
True, if the model contains at least one constant variable.


isConstant

public boolean isConstant(Variable variable)
True, if the given variable is constant.


addVariable

public void addVariable(Variable variable)
Adds a variable to the model

Overrides:
addVariable in class Model

removeVariable

public void removeVariable(Variable variable)
Removes a variable from the model

Overrides:
removeVariable in class Model

beforeAssigned

public void beforeAssigned(long iteration,
                           Value value)
Called before a value is assigned to its variable. Constant variables are excluded from (re)assignment.

Overrides:
beforeAssigned in class Model

beforeUnassigned

public void beforeUnassigned(long iteration,
                             Value value)
Called before a value is unassigned from its variable. Constant variables are excluded from (re)assignment.

Overrides:
beforeUnassigned in class Model

afterAssigned

public void afterAssigned(long iteration,
                          Value value)
Called after a value is assigned to its variable. Constant variables are excluded from (re)assignment.

Overrides:
afterAssigned in class Model

afterUnassigned

public void afterUnassigned(long iteration,
                            Value value)
Called after a value is unassigned from its variable. Constant variables are excluded from (re)assignment.

Overrides:
afterUnassigned in class Model