[Lemon-commits] deba: r3233 - lemon/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Wed Mar 7 14:32:12 CET 2007
Author: deba
Date: Wed Mar 7 14:32:12 2007
New Revision: 3233
Modified:
lemon/trunk/lemon/csp.h
Log:
Data hiding
Const members
Modified: lemon/trunk/lemon/csp.h
==============================================================================
--- lemon/trunk/lemon/csp.h (original)
+++ lemon/trunk/lemon/csp.h Wed Mar 7 14:32:12 2007
@@ -59,42 +59,49 @@
typedef SimplePath<Graph> Path;
- Graph &_g;
+ private:
+
+ const Graph &_g;
Tolerance<double> tol;
- CM &_cost;
- DM &_delay;
+ const CM &_cost;
+ const DM &_delay;
class CoMap
{
- CM &_cost;
- DM &_delay;
+ const CM &_cost;
+ const DM &_delay;
double _lambda;
public:
typedef typename CM::Key Key;
typedef double Value;
- CoMap(CM &c,DM &d) :_cost(c), _delay(d), _lambda(0) {}
+ CoMap(const CM &c, const DM &d) :_cost(c), _delay(d), _lambda(0) {}
double lambda() const { return _lambda; }
void lambda(double l) { _lambda=l; }
Value operator[](Key &e) const
{
return _cost[e]+_lambda*_delay[e];
}
- } _co_map;
+ };
+
+ CoMap _co_map;
Dijkstra<Graph, CoMap> _dij;
+
+ public:
+
///\e
///\e
///
- ConstrainedShortestPath(Graph &g, CM &ct, DM &dl)
+ ConstrainedShortestPath(const Graph &g, const CM &ct, const DM &dl)
: _g(g), _cost(ct), _delay(dl),
- _co_map(ct,dl), _dij(_g,_co_map) {}
+ _co_map(ct, dl), _dij(_g,_co_map) {}
///Compute the cost of a path
- double cost(const Path &p)
+ double cost(const Path &p) const
{
double s=0;
// Path r;
@@ -103,7 +110,7 @@
}
///Compute the delay of a path
- double delay(const Path &p)
+ double delay(const Path &p) const
{
double s=0;
for(typename Path::EdgeIt e(p);e!=INVALID;++e) s+=_delay[e];
More information about the Lemon-commits
mailing list