This package GPM_Model describes the specialized classed for GPM_Core package used in GPM_Gui packages.
This package is the core package for GUI interface.
It enables to generate graph from :
- the init graph file
- the pattern graph file
- the transformer graph file
- the rules graph file.
The main class of the package is GPM_ModelRun class.
To use the program (see Program's help ) , type
somme examples:
Program's help
gpm_model.exe [options] make [args] where:
- options={–optionName=optionValue}
- args= [test | run | rewriting | isomorph ]
Options are :
- For help
- help : print this help, no value
- Data args:
- path : where to find the needed files
- data for rewriting graph
- init: file name of the initial graph (init.txt by default)
- nRules : number of rules (1 by default)
- pattern_i : file name of the pattern graph of the rule i (pattern.txt by default)
- transform_i : file name of the transformer graph of the rule i (transform.txt by default)
- rule_i : file name of rules description of the rule i (transform.txt by default)
- iterationsNumber: number of iterations of the rewriting graph
- data for testing isomorphism between graph
- graph1 : file name of the graph 1
- graph2 : file name of the graph 2
- output args:
- output : output path
- prefix : prefix of the output files
- verbose : if empty, print on the screen, otherwise print on indicated file
- verbose-mode : (error,warning,debug)
Args are
- test : make the primary tests
- run : execute the rewriting graph : generate graph files with prefix in output path
- rewriting : execute the rewriting graph : generate graph files with prefix in output path
- isomorph test if the 2 graphs are isomorph
The graph file format is as follow:
2 idN Type variableName=value
4 idE sourceId targetId EDGE
where :
- N is the number of vertices
- P is the number of edges
- idN is the identity the the vertex
- idE is the identity the the edge
- Type is the type of vertex either NODE or PORT
- variableName is the variable name mCoord, state for example
- value is the value of the variable:
- for a string variable, put the value in "" for example "+"
- for a real, integer, put the value as usual
- for a boolean, set the value as true or false
For example,
2 0 NODE mCoord=[0;0;0] state=0
5 3 NODE mCoord={[0;1;0]} state=1
The rules format is as follow:
1 #list of ids of vertices of pattern graph to remove
4 #list of ids of edges of pattern graph to remove
7 #list of edges between Pattern graph & Transform graph to add
11 groupNodeIds=varName1[+varName2]
13 groupPortIds=varName1[+varName2]
14 #mapping rules for pattern vertex
16 IsUpToAutomorphism=true
17 boolean_condition_r(pattern graph variables)
20 TvariableName_id=fct(pattern graph_variable,transform graph variables defined before the rules)
21 PvariableName_id=fct(pattern graph_variable)
where :
- N is the number of pattern vertex Ids to remove from the mapping pattern graph into large graph
- id_i is the id of the vertex to remove
- P is the number of pattern edge Ids to remove form the mapping pattern graph into large graph
- id_j is the id of the edge to remove
- Q is the number of adges to add form pattern graph vertex to transform graph vertex
- source_k is the source vertex from the pattern graph of the edge to add between pattern & transform graph
- target_k is the target vertex from the transform graph of the edge to add between pattern & transform graph
- groupeNodeIds is the variable to build the id of the node used for the maching to select & speed up the pattern graph mapping search. It consists in the adding of the value of the variable name.
- groupPortIds is the variable to build the id of the port used for the maching to select & speed up the pattern graph mapping search. It consists in the adding of the value of the variable name.
- R is the number of the mapping rules which can be either
- IsUpToAutomorphism=true | false for dis/en-able the permuation of the same pattern graph mapping
- a boolean expression depending on variables of pattern graph to be true to validate a mapping
- Q is the number of rules to update the state of pattern or transform vertices of the graph of the form:
- varName_{T,P}_id=fct(varName_{T,P}_id) where
- varName is a variable name of the vertex
- T is the letter to indicate the vertex belongs to the transform graph
- P is the letter to indicate the vertex belongs to the pattern graph
- id is the id of the vertex.
- fct i a function depinding on pattern vertices or transformer vertices.
- note that the order of the rules in important to re-use a preceeding computing variable value.
For example,
1 #list of ids of vertices of pattern graph to remove
3 #list of ids of edges of pattern graph to remove
5 #list of edges between Pattern graph & Transform graph to add
14 #mapping rules for pattern vertex
19 T_0=rotation(P_3-P_0,-PI/3)+2*P_3
20 T_1=rotation(P_3-P_0,PI/3)+2*P_3
To compute the rewriting graph whith 3 rules & 3 iterations, execute the command:
1 gpm_model.exe --verbose-mode=debug --path=./data --output=./output --prefix=plant --init=plant-init.txt --iterationsNumber=3 --verbose=./output/plant.log --nRules=3 --rule_1=plant-rule01.txt --pattern_1=plant-pattern01.txt --transform_1=plant-transform01.txt --rule_2=plant-rule02.txt --pattern_2=plant-pattern02.txt --transform_2=plant-transform02.txt --rule_3=plant-rule03.txt --pattern_3=plant-pattern03.txt --transform_3=plant-transform03.txt make run