summaryrefslogtreecommitdiff
path: root/SA_POP/PlanHeuristics.h
blob: 941e60089cfe405d55085c897a2c5d6237caf070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// -*- C++ -*-
// $Id$

//=============================================================================
/**
 * @file  PlanHeuristic.h
 *
 * This file contains the class definitions for the encapsulations of
 * algorithms corresponding to planning/scheduling substeps.
 *
 * @author  John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
 */
//=============================================================================

#ifndef SA_POP_PLAN_STEP_H_
#define SA_POP_PLAN_STEP_H_

#include "SA_POP_Types.h"
#include "PlanStrategy.h"

namespace SA_POP {

  // Forward declaration of Planner.
  class Planner;

  /**
   * @class CondStrategy
   *
   * @brief CondStrategy abstract base class for a PlanHeuristic that
   *        chooses an open condition in the plan to satisfy next.
   */
  class CondStrategy {
  public:
    /// Constructor.
    /**
     * @param planner  Planner object to use.
     */
    CondStrategy (SA_POP::Planner *planner)
      : planner_ (planner) { };

    /// Destructor.
    virtual ~CondStrategy (void) { };

    /// Choose the next open condition to satisfy.
    /**
     * @param open_conds  Open conditions in the plan.
     *
     * @return  Next open condition to satisfy.
     */
    virtual Condition choose_cond (const OpenCondMap &open_conds) = 0;

  protected:
    /// Pointer to Planner object.
    SA_POP::Planner *planner_;
  };

  /**
   * @class TaskStrategy
   *
   * @brief TaskStrategy abstract base class for a PlanHeuristic that
   *        chooses an ordering of tasks for the choice to satisfy an
   *        open condition.
   */
  class TaskStrategy {
  public:
    /// Constructor.
    /**
     * @param planner  Planner object to use.
     */
    TaskStrategy (SA_POP::Planner *planner)
      : planner_ (planner) { };

    /// Destructor.
    virtual ~TaskStrategy (void) { };

    /// Choose the (ordering of) task(s) to satisfy an open condition.
    /**
     * @param open_cond  Open condition to satisfy.
     *
     * @return  Sorted list of tasks that satisfy given condition.
     */
    virtual TaskList choose_task (Condition open_cond) = 0;

  protected:
    /// Pointer to Planner object.
    SA_POP::Planner *planner_;
  };

  /**
   * @class ImplStrategy
   *
   * @brief ImplStrategy abstract base class for a PlanHeuristic that
   *        chooses an ordering of implementations to try for a given
   *        task instance.
   */
  class ImplStrategy {
  public:
    /// Constructor.
    /**
     * @param planner  Planner object to use.
     */
    ImplStrategy (SA_POP::Planner *planner)
      : planner_ (planner) { };

    /// Destructor.
    virtual ~ImplStrategy (void) { };

    /// Choose the (ordering of) task implementation(s) for a task instance.
    /**
     * @param task_inst  Task instance for which to choose implementations.
     *
     * @return  Ordered list of implementations for the given task instance.
     */
    virtual TaskImplList choose_impl (TaskInstID task_inst) = 0;

  protected:
    /// Pointer to Planner object.
    SA_POP::Planner *planner_;
  };

};  /* SA_POP namespace */

#endif /* SA_POP_PLAN_STEP_H_ */