Boost logo

Boost Users :

From: Adel Essafi (adel.essafi_at_[hidden])
Date: 2004-06-04 01:08:21

hi list
I am developping a scheduling algorithm using boost When probleme is
that I want to use the adresses of boost nodes. I have writen this code.
then I put the node number 2 in the ready tasks list and the iterator
make the next iteration , I found that the node number 3 is in the ready
any advice will be helpful

void allocate2(Graph &g,vector<MACHINE> &m,fstream &f){

  ///////////////////////////// declarations
  cerr << "in function allocate 2 " << endl;
  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;
  typename boost::graph_traits<Graph>::vertex_iterator vi;

  list<vertex*> readyTasks;
  ///////////////////////// initialisation /////////////////////
  for (vi=vertices(g).first;vi!=vertices(g).second;++vi){
        if (in_degree(*vi,g)==0){
             vertex v = *vi;

  for (list<vertex*>::iterator it=readyTasks.begin();
       vertex *temp = *it;
       cerr << name[*temp].Id()<< endl;

       vertex *head=readyTasks.front();
       vector<int> times(m.size());
       //////////////// determine the best allocations time
       for (int i=0;i<m.size();i++){
       /////////////// the minimum
       int min = *min_element(times.begin(),times.end());
       cerr << "min = "<<min<<endl;
       for(int j=0;j<m.size();j++){
           if(times[j]==min) macs.push_back(j);
        int Nmacs=macs.size();
        vector<int> penal(Nmacs);
        ////////////////// get pinalities
        int x=0;
        for (list<int>::iterator it=macs.begin();
                  int nummac = *it;
                  if (m[nummac].type()) penal[x]=m[nummac].getPenal(min);
                  else penal[x]=100000;
        ///////////////// get the best machine
        int minPenal = *min_element(penal.begin(),penal.end());
        //////////////// select machine
        int par=0;
        for (;(par<macs.size())&&(penal[par]!=minPenal);par++);

       for (vi=vertices(g).first;vi!=vertices(g).second;++vi){
          vertex current = *vi;
          cerr << "traitement du noeud "<<name[current].Id()<< endl;
          if (isReady(current,g)){ ////////// si la tache est prete
                   cerr << "\ttraitement du noeud pret
"<<name[current].Id()<< endl;
                   bool trouv=false;
                   for (list<vertex*>::iterator
                      vertex *currentRt = *itr;
                      cerr << "\t\ttraitement de la tache
"<<name[*currentRt].Id()<< endl;
                   if (!trouv){ //tache inexistante
                              cerr << "\tpush vertex "<<

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at