COIN-OR::LEMON - Graph Library

Changeset 2401:7f20ec638bc2 in lemon-0.x


Ignore:
Timestamp:
03/07/07 14:32:12 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3232
Message:

Data hiding
Const members

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/csp.h

    r2391 r2401  
    6060    typedef SimplePath<Graph> Path;
    6161   
    62     Graph &_g;
     62  private:
     63   
     64    const Graph &_g;
    6365    Tolerance<double> tol;
    6466
    65     CM &_cost;
    66     DM &_delay;
     67    const CM &_cost;
     68    const DM &_delay;
    6769
    6870    class CoMap
    6971    {
    70       CM &_cost;
    71       DM &_delay;
     72      const CM &_cost;
     73      const DM &_delay;
    7274      double _lambda;
    7375    public:
    7476      typedef typename CM::Key Key;
    7577      typedef double Value;
    76       CoMap(CM &c,DM &d) :_cost(c), _delay(d), _lambda(0) {}
     78      CoMap(const CM &c, const DM &d) :_cost(c), _delay(d), _lambda(0) {}
    7779      double lambda() const { return _lambda; }
    7880      void lambda(double l)  { _lambda=l; }
     
    8183        return _cost[e]+_lambda*_delay[e];
    8284      }
    83     } _co_map;
     85    };
     86
     87    CoMap _co_map;
    8488   
    8589   
    8690    Dijkstra<Graph, CoMap> _dij;
     91
     92  public:
     93   
    8794    ///\e
    8895   
    8996    ///\e
    9097    ///
    91     ConstrainedShortestPath(Graph &g, CM &ct, DM &dl)
     98    ConstrainedShortestPath(const Graph &g, const CM &ct, const DM &dl)
    9299      : _g(g), _cost(ct), _delay(dl),
    93         _co_map(ct,dl), _dij(_g,_co_map) {}
     100        _co_map(ct, dl), _dij(_g,_co_map) {}
    94101   
    95102
    96103    ///Compute the cost of a path
    97     double cost(const Path &p)
     104    double cost(const Path &p) const
    98105    {
    99106      double s=0;
     
    104111
    105112    ///Compute the delay of a path
    106     double delay(const Path &p)
     113    double delay(const Path &p) const
    107114    {
    108115      double s=0;
Note: See TracChangeset for help on using the changeset viewer.