1.1 --- a/lemon/csp.h Wed Mar 07 12:00:59 2007 +0000
1.2 +++ b/lemon/csp.h Wed Mar 07 13:32:12 2007 +0000
1.3 @@ -59,42 +59,49 @@
1.4
1.5 typedef SimplePath<Graph> Path;
1.6
1.7 - Graph &_g;
1.8 + private:
1.9 +
1.10 + const Graph &_g;
1.11 Tolerance<double> tol;
1.12
1.13 - CM &_cost;
1.14 - DM &_delay;
1.15 + const CM &_cost;
1.16 + const DM &_delay;
1.17
1.18 class CoMap
1.19 {
1.20 - CM &_cost;
1.21 - DM &_delay;
1.22 + const CM &_cost;
1.23 + const DM &_delay;
1.24 double _lambda;
1.25 public:
1.26 typedef typename CM::Key Key;
1.27 typedef double Value;
1.28 - CoMap(CM &c,DM &d) :_cost(c), _delay(d), _lambda(0) {}
1.29 + CoMap(const CM &c, const DM &d) :_cost(c), _delay(d), _lambda(0) {}
1.30 double lambda() const { return _lambda; }
1.31 void lambda(double l) { _lambda=l; }
1.32 Value operator[](Key &e) const
1.33 {
1.34 return _cost[e]+_lambda*_delay[e];
1.35 }
1.36 - } _co_map;
1.37 + };
1.38 +
1.39 + CoMap _co_map;
1.40
1.41
1.42 Dijkstra<Graph, CoMap> _dij;
1.43 +
1.44 + public:
1.45 +
1.46 ///\e
1.47
1.48 ///\e
1.49 ///
1.50 - ConstrainedShortestPath(Graph &g, CM &ct, DM &dl)
1.51 + ConstrainedShortestPath(const Graph &g, const CM &ct, const DM &dl)
1.52 : _g(g), _cost(ct), _delay(dl),
1.53 - _co_map(ct,dl), _dij(_g,_co_map) {}
1.54 + _co_map(ct, dl), _dij(_g,_co_map) {}
1.55
1.56
1.57 ///Compute the cost of a path
1.58 - double cost(const Path &p)
1.59 + double cost(const Path &p) const
1.60 {
1.61 double s=0;
1.62 // Path r;
1.63 @@ -103,7 +110,7 @@
1.64 }
1.65
1.66 ///Compute the delay of a path
1.67 - double delay(const Path &p)
1.68 + double delay(const Path &p) const
1.69 {
1.70 double s=0;
1.71 for(typename Path::EdgeIt e(p);e!=INVALID;++e) s+=_delay[e];