choco.cp.solver.search.task
Class SetTimes

java.lang.Object
  extended by choco.kernel.solver.branch.AbstractBranchingStrategy
      extended by choco.kernel.solver.branch.AbstractIntBranchingStrategy
          extended by choco.kernel.solver.branch.AbstractLargeIntBranchingStrategy
              extended by choco.cp.solver.search.task.SetTimes
All Implemented Interfaces:
BranchingStrategy, IntBranching

public class SetTimes
extends AbstractLargeIntBranchingStrategy

A search designed to minimize makespan. The search is not complete, so don't try a solveAll.

Author:
Arnaud Malapert

Field Summary
protected  IStateInt[] flags
          The flags which indicates the last starting time of non selectable task.
protected  IStateBitSet nselect
          The subset of non selectable tasks.
protected  IStateBitSet select
          The subset of selectable tasks.
protected  TaskVarSelector selector
          select a task.
protected  gnu.trove.TObjectIntHashMap<TaskVar> taskIndexM
          map of index
protected  List<TaskVar> tasksL
          The tasks list.
 
Fields inherited from class choco.kernel.solver.branch.AbstractBranchingStrategy
LOG_DECISION_MSG_ASSIGN, LOG_DECISION_MSG_REMOVE, LOG_DOWN_MSG, LOG_UP_MSG, manager
 
Fields inherited from interface choco.kernel.solver.branch.BranchingStrategy
LOGGER
 
Constructor Summary
SetTimes(Solver solver, List<TaskVar> tasks, Comparator<ITask> comparator)
           
SetTimes(Solver solver, List<TaskVar> tasks, Comparator<ITask> comparator, long seed)
           
SetTimes(Solver solver, List<TaskVar> tasks, TaskVarSelector selector)
          The Constructor.
 
Method Summary
 boolean finishedBranching(IntBranchingDecision decision)
          Finished branching.
 String getDecisionLogMessage(IntBranchingDecision decision)
          The logging message associated with the current decision.
 void goDownBranch(IntBranchingDecision decision)
          select a remaining task with the heuristic and assign its earliest starting time.
 void goUpBranch(IntBranchingDecision decision)
          set the task not selectable.
 void initBranching()
          This method is called before launching the search. it may be used to intialiaze data structures or counters for instance.
 Object selectBranchingObject()
          Select branching object.
 void setFirstBranch(IntBranchingDecision decision)
          compute the first decision by setting a branching value or modifying the branching object
 void setNextBranch(IntBranchingDecision decision)
          compute the next decision by setting a branching value or modifying the branching object
 
Methods inherited from class choco.kernel.solver.branch.AbstractIntBranchingStrategy
getDefaultAssignMsg, getDefaultAssignOrForbidMsg
 
Methods inherited from class choco.kernel.solver.branch.AbstractBranchingStrategy
getManager, getNextBranching, initConstraintForBranching, setNextBranching, setSolver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flags

protected final IStateInt[] flags
The flags which indicates the last starting time of non selectable task.


select

protected final IStateBitSet select
The subset of selectable tasks.


nselect

protected final IStateBitSet nselect
The subset of non selectable tasks.


tasksL

protected final List<TaskVar> tasksL
The tasks list.


taskIndexM

protected final gnu.trove.TObjectIntHashMap<TaskVar> taskIndexM
map of index


selector

protected final TaskVarSelector selector
select a task.

Constructor Detail

SetTimes

public SetTimes(Solver solver,
                List<TaskVar> tasks,
                Comparator<ITask> comparator)

SetTimes

public SetTimes(Solver solver,
                List<TaskVar> tasks,
                Comparator<ITask> comparator,
                long seed)

SetTimes

public SetTimes(Solver solver,
                List<TaskVar> tasks,
                TaskVarSelector selector)
The Constructor.

Parameters:
selector - the heuristic
solver - based solver
tasks - the selectables
Method Detail

initBranching

public void initBranching()
Description copied from class: AbstractBranchingStrategy
This method is called before launching the search. it may be used to intialiaze data structures or counters for instance.

Overrides:
initBranching in class AbstractBranchingStrategy

finishedBranching

public boolean finishedBranching(IntBranchingDecision decision)
Finished branching.

Parameters:
decision - the last decision applied
Returns:
true, if there is no more selectable tasks for this node.
See Also:
choco.kernel.solver.branch.IntBranching#finishedBranching(java.lang.Object, int)

setFirstBranch

public void setFirstBranch(IntBranchingDecision decision)
Description copied from interface: IntBranching
compute the first decision by setting a branching value or modifying the branching object


setNextBranch

public void setNextBranch(IntBranchingDecision decision)
Description copied from interface: IntBranching
compute the next decision by setting a branching value or modifying the branching object


selectBranchingObject

public Object selectBranchingObject()
                             throws ContradictionException
Select branching object. The branching object is a set of tasks. At each branch, it selects a task with the heuristic and it assigns its earliest starting time. Handle transition between selectable and not selectable tasks.

Returns:
the Current branching node
Throws:
ContradictionException

goDownBranch

public void goDownBranch(IntBranchingDecision decision)
                  throws ContradictionException
select a remaining task with the heuristic and assign its earliest starting time.

Parameters:
x - the x
i - the i
Throws:
ContradictionException - the contradiction exception
See Also:
choco.kernel.solver.branch.AbstractIntBranchingStrategy#goDownBranch(java.lang.Object, int)

goUpBranch

public void goUpBranch(IntBranchingDecision decision)
                throws ContradictionException
set the task not selectable.

Parameters:
decision - the decision that has been set at the father choice point
Throws:
ContradictionException - if a domain empties or a contradiction is infered

getDecisionLogMessage

public String getDecisionLogMessage(IntBranchingDecision decision)
Description copied from interface: IntBranching
The logging message associated with the current decision.

Parameters:
decision - current decision
Returns:
logging message.


Copyright © 2012. All Rights Reserved.