Boost logo

Boost Users :

From: Adel Essafi (adel.essafi_at_[hidden])
Date: 2004-03-27 05:13:57


hi list
i am developping a scheduling algorithm usig boost graph library.
I want to update the list of the ready tasks. for that , i develop a
function

template <class Vertex,class Graph> file://this tests if all parent of
vertex v are scheduled
                                      // i.e v is a ready task

bool isReady(const Vertex v,const Graph g){
  typedef typename property_map<Graph, vertex_first_name_t>::const_type
NamePA;
  NamePA name = get(vertex_first_name, g);
  typedef typename boost::property_traits<NamePA>::value_type NameType;
// typename boost::property_map<Graph, vertex_index_t>::type id =
get(vertex_index, g);

  NameType src_name;
  boost::graph_traits<Graph>::vertex_iterator vi;

  for (vi=in_edges(v,g).first; // XXXXXXXX
       vi!=in_edges(v,g);
       ++vi){
   /// if (name[*vi]==false) return false;
    }
  return true;

  }

and I call it from
template <class Graph>
void allocate1(Graph &g,vector<MACHINE> &m){
  typedef typename property_map<Graph, vertex_first_name_t>::type NamePA;
  NamePA name = get(vertex_first_name, g);
  typedef typename boost::property_traits<NamePA>::value_type NameType;
  typename boost::property_map<Graph, vertex_index_t>::type id =
get(vertex_index, g);
  typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex;

  NameType src_name;
  boost::graph_traits<Graph>::vertex_iterator vi;
  typedef list<vertex> vlist;
  vlist readyTasks;
  cerr << "Machine number :" << m.size() << endl;
  ///////////// initialising the ready tasks list
  for (vi=vertices(g).first;vi!=vertices(g).second;++vi){
    if (in_degree(*vi,g)==0)

         readyTasks.push_back(*vi);
         cerr << "pushing vertex "<<id[*vi]<<endl;
         }
    }
  ///////////
  for(vlist::iterator it=readyTasks.begin();
      it!=readyTasks.end();
      ++it){
          name[*it].isScheduled(); file://the task has been scheduled
          for (vi=vertices(g).first;vi!=vertices(g).second;++vi){
          vertex temp=*vi;
          if (isReady<vertex,Graph>(temp,g)==true) {
                readyTasks.push_back(*vi);
                cerr << "pushing vertex "<<id[*vi]<<endl;
            }
          }
        }
}

but the compiler (g++ 3.X on linux) returns me an error ( saying that it
cannot find attribute .. and points me on line XXXXXXX)
please, do you see any error in isReady() function.
thanks
adel


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net