1 package org.opentrafficsim.road.gtu.lane.perception.mental; 2 3 import java.util.Set; 4 5 import org.opentrafficsim.base.parameters.ParameterException; 6 import org.opentrafficsim.base.parameters.Parameters; 7 import org.opentrafficsim.core.gtu.GTUException; 8 import org.opentrafficsim.road.gtu.lane.LaneBasedGTU; 9 import org.opentrafficsim.road.gtu.lane.perception.LanePerception; 10 11 /** 12 * A task manager controls which task has priority and as a result how anticipation reliance is divided over different tasks. 13 * <p> 14 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 15 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>. 16 * <p> 17 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 30 jan. 2019 <br> 18 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a> 19 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 20 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a> 21 */ 22 public interface TaskManager 23 { 24 /** 25 * Manage tasks. 26 * @param tasks Set<Task>; tasks 27 * @param perception LanePerception; perception 28 * @param gtu LaneBasedGTU; gtu 29 * @param parameters Parameters; parameters 30 * @throws ParameterException if a parameter is missing or out of bounds 31 * @throws GTUException exceptions pertaining to the GTU 32 */ 33 void manage(Set<Task> tasks, LanePerception perception, LaneBasedGTU gtu, Parameters parameters) 34 throws ParameterException, GTUException; 35 36 /** 37 * Manages a set of tasks without considering anticipation reliance. 38 * <p> 39 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. 40 * <br> 41 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>. 42 * <p> 43 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 30 jan. 2019 <br> 44 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a> 45 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 46 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a> 47 */ 48 class SummativeTaskManager implements TaskManager 49 { 50 /** {@inheritDoc} */ 51 @Override 52 public void manage(final Set<Task> tasks, final LanePerception perception, final LaneBasedGTU gtu, 53 final Parameters parameters) throws ParameterException, GTUException 54 { 55 for (Task task : tasks) 56 { 57 double taskDemand = task.calculateTaskDemand(perception, gtu, parameters); 58 task.setTaskDemand(taskDemand); 59 } 60 } 61 } 62 63 }