Skip to content
Snippets Groups Projects
Select Git revision
  • f0db5fbf877ac312fb51926fb83aab4321c8830a
  • master default protected
  • abid-master-patch-16387
  • feature/ufscc-emptiness-check
  • v0.4.1
  • v0.4.1
  • v0.4.0
  • v0.3
  • v0.2
  • v0.1
10 results

Modular_Obs_Graph.cpp

Blame
  • Modular_Obs_Graph.cpp 5.69 KiB
    
    /********              Graph.cpp     *******/
    #include"Modular_Obs_Graph.h"
    //#include<conio.h>
    bdd * Temp;//tableau intermdiaire pour calculer la taille (nb bdd) du graphe
    /*********                  setInitialState    *****/
    
    void Modular_Obs_Graph::setInitialState(Modular_Class_Of_State *c)
    {
    	currentstate=initialstate=c;
    
    }
    /*----------------------find()----------------*/
    Modular_Class_Of_State * Modular_Obs_Graph::find(Modular_Class_Of_State* c)
    {
    	bool arret;
    	for(Modular_Obs_Graph_Nodes::const_iterator i=GONodes.begin();!(i==GONodes.end());i++)
    	{
    		//if((c->blocage!=(*i)->blocage)||(c->boucle!=(*i)->boucle))
    		//{
    			arret=false;
    			for(unsigned int k=0;((k<(c->State).size())&&(!arret));k++)
    				if(!(c->State[k]==(*i)->State[k]))
    					arret=true;
    			if(!arret)
    				return *i;
    		//}
    	}
    		return NULL;
    }
    /*----------------------find2()----------------*/
    //version modulaire on vrifie la projection
    Modular_Class_Of_State * Modular_Obs_Graph::find2(Modular_Class_Of_State* c, Set SRConcernes)
    {
    	bool arret;
    	for(Modular_Obs_Graph_Nodes::const_iterator i=GONodes.begin();!(i==GONodes.end());i++)
    	{
    		//if((c->blocage!=(*i)->blocage)||(c->boucle!=(*i)->boucle))
    		//{
    			arret=false;
    			for(unsigned int k=0;((k<(c->State).size())&&(!arret));k++)
    				if(!(SRConcernes.find(k)==SRConcernes.end()))
    					if(!(c->State[k]==(*i)->State[k]))
    						arret=true;
    			if(!arret&&(c->blocage==(*i)->blocage)&&(c->boucle==(*i)->boucle))
    				return *i;
    		//}
    	}
    		return NULL;
    }
    /*-----------------------AddARc2----------------*/
    void Modular_Obs_Graph::addArc(Modular_Class_Of_State* Pred,Modular_Class_Of_State* Suc,const char* t)
    {
    	//cout<<"ici addArc entre "<<*Pred<<" et "<<*Suc<<endl;
    	Modular_Edge arc=Modular_Edge(Suc,t);
    	Modular_Edge cra=Modular_Edge(Pred,t);
    	if(Pred->Successors.find(arc)==Pred->Successors.end())
    	{
    		//cout<<"OK \n";
    		Pred->Successors.insert(Pred->Successors.begin(),arc);
    		Suc->Predecessors.insert(Suc->Predecessors.begin(),cra);
    		nbArcs++;
    	}
    	//else
    	//	cout<<"KO \n";
    	//int toto;cin>>toto;
    }
    /*----------------------insert() ------------*/
    void Modular_Obs_Graph::insert(Modular_Class_Of_State *c)
    {