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-2020 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 //TODO: rename MentalTaskRegulator as in paper? (also sub-classes)
23 public interface TaskManager
24 {
25 /**
26 * Manage tasks.
27 * @param tasks Set<Task>; tasks
28 * @param perception LanePerception; perception
29 * @param gtu LaneBasedGTU; gtu
30 * @param parameters Parameters; parameters
31 * @throws ParameterException if a parameter is missing or out of bounds
32 * @throws GTUException exceptions pertaining to the GTU
33 */
34 void manage(Set<Task> tasks, LanePerception perception, LaneBasedGTU gtu, Parameters parameters)
35 throws ParameterException, GTUException;
36
37 /**
38 * Manages a set of tasks without considering anticipation reliance.
39 * <p>
40 * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
41 * <br>
42 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
43 * <p>
44 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 30 jan. 2019 <br>
45 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
46 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
47 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
48 */
49 class SummativeTaskManager implements TaskManager
50 {
51 /** {@inheritDoc} */
52 @Override
53 public void manage(final Set<Task> tasks, final LanePerception perception, final LaneBasedGTU gtu,
54 final Parameters parameters) throws ParameterException, GTUException
55 {
56 for (Task task : tasks)
57 {
58 double taskDemand = task.calculateTaskDemand(perception, gtu, parameters);
59 task.setTaskDemand(taskDemand);
60 }
61 }
62 }
63
64 }