正在加载图片...
·162 智能系统学报 第12卷 回:否则转2)。 if con,is“select(a)” 2)分析该节点与子节点的关系。若不存在子 ifa∈4 then con,=true; 节点,则如果存在对应的约束关系,用约束关系生成 else con.false: 流程并返回,否则出错返回。如果存在子节点,则根 if con,is ctx 据如下规则将父节点的实现转换为子节点的实现, check if there exist fact fac;and con;=fac 生成细化的子流图。①若存在明确的时序关系规 con;=true; 定,则按照时序关系的要求去生成细化的子流图:② else con;false; 若该节点与子节点的关系为包含关系,则按照AND while Lpart is not a single“tue”or“false”{ 或顺序结构生成子流图:③若该节点与子节点的关 if there exist“EI AND…AND En'”in Lpart{ 系为泛化关系,则按照OR结构生成子流图:④其 if there exist a“false”in sub-expression 他情况则按照顺序结构生成子流图。 replace sub-expression with“false”; 3)依据约束规则,对生成的子流图进行校验。 else replace it with“tue”; 分别调用函数ActSelValid()对活动选取进行校验, 调用TemporalCons()对活动的时序约束进行校验。 if there exist“ElOR…OREn”in Lpart{ 若没有通过校验,则出错返回。 if there exist a“true”in sub-expression 4)检查生成的子流图是否存在子柔性活动。 replace the sub-expression with“true”; 若不存在,则返回生成的子流图,算法结束。否则, else replace it with“false'”; 对每一个子柔性活动,转算法的步骤1)。 /end while 3校验算法 if Lpart is true then//rule sc;is triggered. for each op;in Rpart 对生成的子流程通常存在着合法性检验问题。 ifop,is“NOT select(a)” 一个子流图只有符合柔性活动的设计目标和功能,满 ifa∈4 then op;=false; 足其预先定义的约束条件,才能被认为是合法的和有 else op;=true; 效的。另外,子流图在流程结构上必须要定义良好, ifop,is“select(a)” 例如不存在孤立不可到达的活动、不存在死循环等, ifa∈4 then op:=true; 对此可以采用拓扑排序进行检查。下面从以上几个 else op;=false; 方面对柔性活动细化后生成的子流图的合法性进行 //end for 检验,其中,ActSelValid()是活动选取规则检验算 while Rpart is not a single“true”or“false”{ 法,TemporalCons()是活动时序约束检验算法。 if there exist“E,AND…En”in Rpart{ 设选取的活动组成的集合为A,A={a1,a2,…, if there exist a“false'”in sub-expression an},选择约束sc可以分解为左部Lpat和右部Rpat, replace sub--expression with“false”; Lpat由上下文事实和活动选择的操作组成,Rpat为操 else replace it with“true”; 作的逻辑表达式。如Lpart=con,AND con2 OR…AND if there exist“E,OR…En”in Rpart con.,con,=ctk;Iop,ct为上下文事实,如“calculus。 if there exist a“true”in sub-expression diameter≤20mm”,op=select()I NOT select()。在算 replace sub-expression with“true”; 法ActSelValid()中,E,代表true or false else replace it with“false”; 算法1 ActSelValid() activity set A,activity selection constraints SC. /end while 输出return true if valid,false if not valid if Rpart is“false”then{ report the information of error to user; for each selection constraint sc;in SC return false;//quit decompose sc;into Lpart and Rpart; for each con;in Lpart /end of the deal of Rpart if con;is "NOT select(a)" /end of the deal of sci if a EA then con;=false; return true; else con;=true; TemporalCons()是活动时序约束检验算法,其回;否则转 2)。 2)分析该节点与子节点的关系。 若不存在子 节点,则如果存在对应的约束关系,用约束关系生成 流程并返回,否则出错返回。 如果存在子节点,则根 据如下规则将父节点的实现转换为子节点的实现, 生成细化的子流图。 ①若存在明确的时序关系规 定,则按照时序关系的要求去生成细化的子流图;② 若该节点与子节点的关系为包含关系,则按照 AND 或顺序结构生成子流图;③ 若该节点与子节点的关 系为泛化关系,则按照 OR 结构生成子流图;④ 其 他情况则按照顺序结构生成子流图。 3)依据约束规则,对生成的子流图进行校验。 分别调用函数 ActSelValid( )对活动选取进行校验, 调用 TemporalCons( )对活动的时序约束进行校验。 若没有通过校验,则出错返回。 4) 检查生成的子流图是否存在子柔性活动。 若不存在,则返回生成的子流图,算法结束。 否则, 对每一个子柔性活动,转算法的步骤 1)。 3 校验算法 对生成的子流程通常存在着合法性检验问题。 一个子流图只有符合柔性活动的设计目标和功能,满 足其预先定义的约束条件,才能被认为是合法的和有 效的。 另外,子流图在流程结构上必须要定义良好, 例如不存在孤立不可到达的活动、不存在死循环等, 对此可以采用拓扑排序进行检查。 下面从以上几个 方面对柔性活动细化后生成的子流图的合法性进行 检验,其中, ActSelValid ( )是活动选取规则检验算 法, TemporalCons( )是活动时序约束检验算法。 设选取的活动组成的集合为 A, A = {a1, a2, …, an}, 选择约束 sc 可以分解为左部 Lpart 和右部 Rpart, Lpart 由上下文事实和活动选择的操作组成,Rpart 为操 作的逻辑表达式。 如 Lpart =con1 AND con2 OR…AND conn , coni =ctxi | opi, ctx 为上下文事实,如“calculus。 diameter≤20 mm”,op = select() | NOT select()。 在算 法 ActSelValid()中,Ei代表 true or false。 算法 1 ActSelValid ( ) 输入 activity set A, activity selection constraints SC. 输出 return true if valid, false if not valid { for each selection constraint sci in SC{ decompose sci into Lpart and Rpart; for each coni in Lpart { if coni is “NOT select(a)” if a ÎA then coni = false; else coni = true; if coni is “select(a)” if a ÎA then coni = true; else coni = false; if coni is ctx check if there exist fact faci and coni = faci coni = true; else coni = false; } while Lpart is not a single “true” or “false”{ if there exist “E1 AND…AND En” in Lpart{ if there exist a “false” in sub⁃expression replace sub⁃expression with “false”; else replace it with “true”; } if there exist “E1 OR…OR En” in Lpart{ if there exist a “true” in sub⁃expression replace the sub⁃expression with “true”; else replace it with “false”; } } / / end while if Lpart is true then{ / / rule sci is triggered. for each opi in Rpart { if opi is “NOT select(a)” if a ÎA then opi = false; else opi = true; if opi is “select(a)” if a ÎA then opi = true; else opi = false; } / / end for while Rpart is not a single “true” or “false”{ if there exist “E1 AND…En ” in Rpart{ if there exist a “false” in sub⁃expression replace sub⁃expression with “false”; else replace it with “true”; } if there exist “E1 OR…En ” in Rpart{ if there exist a “true” in sub⁃expression replace sub⁃expression with “true”; else replace it with “false”; } } / / end while if Rpart is “false” then{ report the information of error to user; return false; / / quit } } / / end of the deal of Rpart } / / end of the deal of sci return true; TemporalCons( )是活动时序约束检验算法,其 ·162· 智 能 系 统 学 报 第 12 卷
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有