IBM ILOG Dispatcher User's Manual > Developing Dispatcher Applications > Developing Your Own First Solution Heuristics > Using the Dispatcher First Solution Framework > Creating the decision tracer class

You can monitor events happening while building the first solution using decisions. A decision tracer can be attached to a decision maker object. The decision maker object will call the virtual member functions of the tracer objects to notify certain events. For example, each time a decision is chosen, the tracer object is notified. Dispatcher also provides a default tracer that does nothing. Subclassing from the default tracer IloDefaultDecisionTracerI only requires the definition of the member functions you want to trace, not all of them.

In this example, you use the default tracer to define only the notifyChosen trace member function.

class PDPDecisionTracerI : public IloDefaultDecisionTracerI {
  IloInt _nbChosen;
public:
  PDPDecisionTracerI(IloDispatcher dsp)
    : IloDefaultDecisionTracerI(dsp),
      _nbChosen(0) {}

  virtual void notifyChosen(const IloFSDecisionI * d) {
    ++_nbChosen;
    cout << _nbChosen << "> chosen: " << (*d) << endl;
  }
};