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-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
15 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
16 * </p>
17 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
18 * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
19 * @author <a href="https://dittlab.tudelft.nl">Wouter Schakel</a>
20 */
21 // TODO: rename MentalTaskRegulator as in paper? (also sub-classes)
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-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
40 * <br>
41 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
42 * </p>
43 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
44 * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
45 * @author <a href="https://dittlab.tudelft.nl">Wouter Schakel</a>
46 */
47 class SummativeTaskManager implements TaskManager
48 {
49 /** {@inheritDoc} */
50 @Override
51 public void manage(final Set<Task> tasks, final LanePerception perception, final LaneBasedGtu gtu,
52 final Parameters parameters) throws ParameterException, GtuException
53 {
54 for (Task task : tasks)
55 {
56 double taskDemand = task.calculateTaskDemand(perception, gtu, parameters);
57 task.setTaskDemand(taskDemand);
58 }
59 }
60 }
61
62 }