net.sf.cpsolver.ifs.constant
Class ConstantModel<V extends Variable<V,T>,T extends Value<V,T>>

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Model<V,T>
      extended by net.sf.cpsolver.ifs.constant.ConstantModel<V,T>
Direct Known Subclasses:
TimetableModel

public class ConstantModel<V extends Variable<V,T>,T extends Value<V,T>>
extends Model<V,T>

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.2 (Iterative Forward Search)
Copyright (C) 2006 - 2010 Tomas Muller
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 .

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(V variable)
          Adds a variable to the model
 void afterAssigned(long iteration, T value)
          Called after a value is assigned to its variable.
 void afterUnassigned(long iteration, T value)
          Called after a value is unassigned from its variable.
 void beforeAssigned(long iteration, T value)
          Called before a value is assigned to its variable.
 void beforeUnassigned(long iteration, T value)
          Called before a value is unassigned from its variable.
 List<V> constantVariables()
          List of constant variables
 boolean hasConstantVariables()
          True, if the model contains at least one constant variable.
 boolean isConstant(V variable)
          True, if the given variable is constant.
 void removeVariable(V variable)
          Removes a variable from the model
 
Methods inherited from class net.sf.cpsolver.ifs.model.Model
addConstraint, addCriterion, addGlobalConstraint, addModelListener, assignedVariables, bestUnassignedVariables, clearBest, conflictConstraints, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, getBestPerturbations, getBestUnassignedVariables, getCriteria, getCriterion, getExtendedInfo, getInfo, getInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, getTotalValue, getTotalValue, globalConstraints, inConflict, init, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, removeConstraint, removeCriterion, removeCriterion, removeGlobalConstraint, removeModelListener, restoreBest, restoreBest, saveBest, toString, unassignedHardConstraints, unassignedVariables, variables, variablesWithInitialValue, weaken
 
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 List<V> constantVariables()
List of constant variables


hasConstantVariables

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


isConstant

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


addVariable

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

Overrides:
addVariable in class Model<V extends Variable<V,T>,T extends Value<V,T>>

removeVariable

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

Overrides:
removeVariable in class Model<V extends Variable<V,T>,T extends Value<V,T>>

beforeAssigned

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

Overrides:
beforeAssigned in class Model<V extends Variable<V,T>,T extends Value<V,T>>

beforeUnassigned

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

Overrides:
beforeUnassigned in class Model<V extends Variable<V,T>,T extends Value<V,T>>

afterAssigned

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

Overrides:
afterAssigned in class Model<V extends Variable<V,T>,T extends Value<V,T>>

afterUnassigned

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

Overrides:
afterUnassigned in class Model<V extends Variable<V,T>,T extends Value<V,T>>


Copyright © 2014 UniTime LLC. All Rights Reserved.