The Application of Concurrent Fuzzy Prolog in the Field of Modeling Flexible Manufacturing Systems C. Geiger & G. Lehrenfeld
Department of Mathematics and Computer Science University of Paderborn D-33095 Paderborn, Germany
fcgei,
[email protected] Abstract
In this paper we present the application of Concurrent Fuzzy Prolog (ConFuP) [10, 9] in the eld of modeling exible manufacturing systems. ConFuP oers the feasibility of concurrent process modeling through a set of descriptive rules based on uncertain or qualitative knowledge and enables the user to model hierarchical descriptions from a physical point of view (e.g. machines, tools, etc.) as well as from a logical one, where processes and machine states are described. Time considerations, modeling of alternative decisions and concurrency/synchronization are also supported by ConFuP. With fuzzy data types and operators (fuzzy sets, fuzzi cation, defuzzi cation) the formulation of dierent kinds of uncertainty is possible. System calls for dierent fuzzy operators, methods and strategies allow maximum
exibility.
1 Introduction Process modeling is (besides data modeling) one of the most important aspects in the CIMframework. If we want to talk about, for example CAD we have to think about an at least crude model of the design process. This process has several important characteristics [8]:
The design process is embedded in an environment process and controlled by a higher level
process, thus generating a structure of high complexity. It is most often dynamic due to the fact, that only a part of the knowledge is present at the process start and improvement in existing knowledge must be supported. Partial knowledge leads to uncertain and inconsistent formulation of design goals because of misleading interpretations. Economic conditions and desired technical exibility result often in contradictory goals. A system which should aid the user in design or manufacturing requires a certain amount of intelligence for this task. That leads to the so-called Intelligent CAD-Systems where concepts from the eld of Arti cial Intelligence (AI) help to ful ll this requirements. Especially Intelligent Knowledge Based Systems (IKBS) are used [19]. These consist mainly of four principal components: 1. A knowledge base which contains all necessary information, represented as rules, semantic nets or frames. 2. An inference mechanism which manipulates the stored knowledge (e.g. forward/backward chaining, nonmonotonic or fuzzy reasoning). 3. A user interface to handle communication with the user. 4. A knowledge acquisition module to assist the development of the knowledge base
The rst two components form the kernel of IKBS. AI techniques for design problems must therefore include reasoning with qualitative/uncertain data, multiple context, creating/validating design solutions, modeling concurrency, etc. [19]. This leads to the demand for a language which can handle complex descriptions, uncertain data and dynamic process behavior in an ecient and easy way. There exist several models which deal with these problems and we think a promising concept is ConFuP [10, 9]. ConFuP combines the parallel semantic of Concurrent Prolog (CP) [20] with the fuzzy semantic of Support Logic Programming (SLOP) [2]. Thus, ConFuP is a concurrent logic programming language which oers a parallel process model and a fuzzy semantic. The application of concurrent logic programming languages like CP and FCP, a subset of CP, in the eld of system modeling is well known [4, 6, 5], just as the application of SLOP as AI language particular suited for knowledge base applications involving uncertainty in various forms, including fuzzy logic and nonmonotonic reasoning[1, 2, 17]. In section 2 and 3 we give a short introduction in Fuzzy Logic and ConFuP. Section 4 shows the application of modeling exible manufacturing systems.
2 Fuzzy Logic and its Applications The modeling of human knowledge and reasoning requires the formulation of uncertainty in its various forms. Beneath the well known approach of quantitative probability various approaches have been developed during the last decades because there appeared situations where probability seems to be less suitable, e.g. when linguistic uncertainty appears or the needed basic data for probability is missed. Most of these theories are special cases of Zadeh's fuzzy set theory [21], so we give a short description of his basic ideas. Additionally we mention the most important application of this theory, fuzzy control. The interested reader is referred to [23, 15] for more details.
2.1 Fuzzy Logic
In classical set theory an element x of the universe is member of a set F or it is not. The characteristic function F maps from to the two-element set f0; 1g, indicating the membership x 2 F. Zadeh [21] extends this mapping to the interval [0; 1] and de nes a function which measures the grade of membership of each x 2 in a set F. F, characterized through its membershipfunction F , is then called a fuzzy set over . The more the membershipvalue of a given element reaches 1, the more this element is a member of F. Fuzzy sets can be viewed as sets with elastic bounds.
0.8
med 0.4
high
low 0
50
100 km/h
Figure 1: ?? Linguistische Variable Geschwindigkeit A special case of fuzzy sets are the so-called linguistic variables which model unexact linguistic knowledge. Consider, for example, the variable speed over the domain 0::100 km/h and its occurrences speed = flow; med; highg. Every occurrence is modeled by a fuzzy set indicating the membershipdegree of a precise speed s to the occurrences. The exact value s = 50 km/h might have a degree low (50) = 0:4, med (50) = 0:8 and high (50) = 0:0. The extension of a sets characteristic function to a membership function requires an extension of the existing set operations. This extension is also de ned via the membership functions. The
rst suggestions are due to Zadeh [21]. He uses maximum for union, minimum for intersection and complement for negation as indicated in g. 2
A uB
B
A
C
u
A
B
C
Figure 2: Operations on fuzzy sets These operators are not the only valid operations on fuzzy sets. Other authors de ne dierent operations during the past decades (cf. [15, 23]). The use of a speci c operator is often context{ sensitive or \author{sensitive" but all de ned operators include the binary (conventional) case. Zadeh extends his idea of fuzzi cation to an \extension principle" which generalizes crisp mathematical concepts to fuzzy sets. One application is the extension of binary logic to the so{called uncertain logics. This means the endeavor of developing binary logic in the direction of human thinking which is often vague or uncertain. The most common form of knowledge representation is the rule based approach and an inference mechanism (e.g. modus ponens: (A ^ A ) B) ) B). If we extend the truth values to an interval [0; 1], allow A and B to be fuzzy concepts (e.g. linguistic variables) or relax the identity of the fact A and A as condition part in the rule to similarity, we get dierent kinds of \fuzzy" logics [23, 22]. As a consequence of truth values between 0 and 1 the inference mechanism which calculates the truth value of A ) B with the values of A and B has to be extended similar to the previously described extension of set operations. Analogue, there exist several inference mechanism, see [23, 15]. With these inferences and a knowledge base which allows the modeling of fuzzy sets it is possible to build expert systems which can handle uncertain concepts. Thus uncertain human knowledge can be modeled and processed eciently, applications in the eld of medical sciences, strategic planning, earth quake detection etc. show the usefulness of this approach [23].
2.2 Fuzzy Control
With this approximated reasoning method it is possible to model control processes very eciently. Fuzzy control (FC) is the major eld of applications in fuzzy set theory [18, 23] and is realized by processing uncertain production rules of the form if [condition] then [action]. The main idea of FC is to model the (often inexact) knowledge of the human expert, who controls a complex process instead of a precise (often dicult) mathematical description. E.g., most people drive cars without knowing much about the engine and the dicult mechanism which moves a car. They control it with the knowledge of vague rules of the form 'if speed is low and distance to next car is big then acceleration may be strong`. This idea is used for the control of complex processes when a mathematical description is missing, inecient or only a rapid prototype is needed. A fuzzy control step consists of 3 principal steps: fuzzi cation, inference and defuzzi cation.
Fuzzi cation: The input to a control process is most often a crisp value but the rules in the
knowledge base are fuzzy. The membership of the crisp value in the corresponding fuzzy sets has to be computed. Inference: Outgoing from the input fuzzi cation all matching rules are considered and the resulting action is calculated. If more than one rule is red, the resulting action is often a combination of several fuzzy sets.
Defuzzi cation: For control output a crisp value is required. There exist several methods to
calculate a crisp value out of several given fuzzy sets (center of area, mean of maximum) [23, 18].
The following examples illustrates a fuzzy control step for car driving. Consider the rules R1: R2:
speed=LOW & dist=BIG then acc=STRONG , speed=MED & dist=MED then acc=MED
and the crisp input values SPD=50 km/h for speed and DST=750 m for distance. The fuzzy control step might look like gure 3. speed = S_MED & dist = D_MED then acc = A_MED 1.0 0.8
1.0
1.0
MED
0.6
MED
0
SPD= 50
0
100 km/h
0.6
med
MED DST = 750
0
m
m/s2
speed = S_LOW & dist = D_BIG then acc = A_STRONG 1.0 1.0
1.0 0.7
LOW
BIG STRONG 0.3
0.3 0
SPD= 50
100 km/h
0
DST = 750
m
0
m/s2
STRONG 1.0
crisp value : 0.3
MED
X
0
m/s2
Figure 3: fuzzy control step First the membershipvalue of the exact speed SPD and distance DST is calculated for every rule. If both values are nonzero the rule is red an produces the corresponding output for acceleration. In case of rule 1 SPD yields a value of 0.8 in the set S MED and DST yields 0.6 in D MED. This results in a fuzzy set A MED for acceleration. The max-min inference is used here. In this method the nal output membership function for each rule is the fuzzy set in the conclusion after cutting its degree of membership values at the minimum degree of the corresponding premise fuzzy sets [23]. The results of each red rule are combined by union, which is modeled by the maximum operator. In case of rule 1, A MED is therefore valued with 0.6 while the calculation of rule 2 results in a fuzzy set A STRONG with degree 0.3 The resulting fuzzy sets for acceleration has to be transformed in a crisp value as input for the control process. Here the center{of{area method is used for the defuzzi cation of the resulting fuzzy sets. Existing approaches show that this form of control is sometimes (not every time !) an attractive alternative to conventional control theory [16, 14].
3 ConFuP In this section we give an overview about the syntax and the computation model of ConFuP.
3.1 Guarded Support Horn Clauses
ConFuP is a combination of the concurrent logic programming language CP [20], with the fuzzy semantic of support pairs [1, 2]. In contrast to other approaches of fuzzy logic languages [7] ConFuP joins a concurrent logic language and its process oriented semantic with the feasibility of describing uncertainty. In this approach we can easily handle in nite computations. This is necessary because of the in nite nature of physical systems (e.g. fuzzy-controller). The language incorporates guarded-command indeterminism, data- ow like synchronization, a commitment mechanisms and fuzzy inference. A ConFuP program is a nite set of Guarded Support Horn Clauses (GSHC). H G ; :::; Bm} [Sn ; Sp ] 0 Sn Sp 1 (m; n 0) 1; G2{z; :::; Gn} j B 1 ; B2{z |{z} | | Head
Guards
Body
| {z }
SupportPair
The operator `j' which separates the guard from the body, is called the commit operator. The head H and B's de ne processes with arguments. The components of the guard de ne test conditions related to constraints that the head's arguments should satisfy. Declaratively, the commit operator is read just like a conjunction: H is true if the G's and B's are true. The abstract computation model of ConFuP is established by process interpretation of the goals forming the resolvent. The goals are regarded as an asynchronous process network. The concurrent processes communicate and synchronize via shared logical variables according to an asynchronous communication model. Shared logical variables thus form interprocess communication channels. ConFuP provides the designer with a mechanism to delay process reductions until sucient information is gathered. The synchronization construct for achieving that is the read only operator, denoted by '?', attached to a variable, e.g. X?. A process having a X? cannot instantiate X, and is suspended until it receives the value of X from a process in which appears X without '?'. As a result of a successful reduction step, the body part B1 ; B2 ; :::; Bm spawn a local subnetwork replacing the reduced process within the global process network. In order to nd an enabling clause, all the clauses of a program procedure may be tried in parallel. When there are several clauses applicable at once, the commit operator `j' acts as a control primitive ensuring that clause selection is carried out in a mutual exclusive manner. The potential for parallelism oered by clause selection might be considered as some form of restricted OR-parallelism.
3.2 Fuzzy Semantic
The fuzzy semantic in ConFuP is realized by adding several constructs which are strongly in uenced by Baldwins SLOP [1, 2]. The GSHC's are valued with support pairs. In case of the selection of the GSHC C this decision is necessarily supported to degree Sn and possibly to degree Sp , whereas Sn ? Sp measures the unsureness in the support of the selection. If the support pair is omitted the default support [1; 1] is attached to the clause and in the case of a single value [a], the clause is supported with [a; a]. Baldwin interprets the support pair as a kind of group vote. We use this view to interpret the support of a GSHC as the vote of a population for the use of the considered GSHC. Remember that in Concurrent Prolog a clause is applicable if uni cation succeeds and the guard predicates are ful lled. If the rule is chosen there is no backtracking like in conventional PROLOG. In ConFuP this decision is supported by two values which are interpreted as upper and lower bounds of the populations will to select this clause. A support [0:7; 0:9] attached to a clause C : A G j B is interpreted that 70 % of a group of experts would chose this rule if it is applicable, 10 % would not choose it and 20 % are unsure. With dierent types of population, dierent types of uncertainty can be interpreted (vague, possibilistic, probabilistic) [9]. With the support pairs we have a tool to choose between several parallel proof paths. If there are several applicable rules the `best` solution is chosen by a user-de ned strategy (i.e. the solution with maximum necessary support).
3.3 Fuzzy Sets
To represent linguistic variables a new data type fuzzy set is added to ConFuP. To specify a fuzzy set F a domain and a characteristic function F must be de ned. In ConFuP a fuzzy set is a
six-tuple F = (X1 ; X2; : : :; X6 ) of points for which the following conditions hold. 1.) X1 :x X2 :x : : : X6 :x and 2.) 0 = X1 :y X2 :y X3 :y = X4 :y X5 :y X6 :y = 0 Because of most practical applications are using simple triangles as characteristic functions our representation is sucient. Every triangle and trapezoidal shape can be modeled by six points. In the next example a linguistic variable Waiting Time is de ned by two fuzzy sets. The fuzzy sets WT-short and WT-long, building the linguistic variable, are shaped as triangles. 1
WT−short
WT−long
0 1
2
3
4
5
6
7
8
9
10
_set(WT−short,domain(WT),[(0,0)(4,1)(4,1)(4,1)(4,1)(7,0)]) _set(WT−long,domain(WT),[(3.0)(6,1)(6,1)(6,1)(6,1)(10,0)])
By using six points for the de nition of a fuzzy set the programmer has a greater exibility for shaping a characteristic function. Specially self-learning fuzzy systems can be realized by reshaping a characteristic function through manipulating some of the six points. This representation is a good compromise between expressiveness and eciency.
3.4 Semantic Uni cation
Introducing a new data type fuzzy set leads to an extension of syntactic uni cation to a semantic uni cation [2]. Two cases must be considered: a) the uni cation of two fuzzy sets and b) the uni cation of a crisp value with a fuzzy set. Case a) can be understood as a comparison of two fuzzy concepts1 . To reduce a goal ?- p(WT-long) with a fact p(WT-short) the two fuzzy sets WT-short and WT-long have to be uni ed. A support pair must be computed which describes how good one fuzzy set " ts" to another. First of all the domains (here WT) must be equal, otherwise the uni cation fails. Now two values, the possibility (WT ?longjWT ?short) = supx2 min(WT?long (x); WT?short (x)) and the necessity IN(WT ? long jWT?short) = 1?(WT? longjWT ? short), have to be computed. These values are a degree to which the fuzzy concept WT ?long ts to the given fuzzy concept WT ?short. In our example the uni cation of WT ?long and WT ? short is supported by [0.166,0.666] ( gure 4). The following properties are valid [3]: (P jD) = (DjP) but IN(P jD) 6= IN(DjP) (P jD) IN(P jD) always holds if D is a crisp value x0 then it follows: (P jx0) = IN(P jx0) = P (x0 ) and (x0jP) = P (x0), IN(x0jP) = 0. In contrast to syntactic uni cation the semantic uni cation is not commutative. This must be considered by the development of applications. In the case of modeling fuzzy controller it is desirable to get the pair [P (x0 ); P (x0 )] as result of the uni cation x0 U P. To get this the -operator is de ned. The application to a fuzzy set leads to a so called -fuzzy set. The uni cation of a crisp value x0 with a -fuzzy set yields to a support of [P (x0 ); P (x0)]. See appendix A for the uni cation algorithm. 1
We use the method of fuzzy pattern matching [3].
Possibility = 0.666
WT−long 1
0.5 WT−short
WT−long
0 1
2
3
4
5
6
7
8
9
10
Necessity = 1 − 0.834 = 0.166
Figure 4: Uni cation of WT ? short and WT ? long
3.5 System Calls
A tool for system modeling and prototyping should allow maximum exibility. Therefore in ConFuP the user can choose between several methods for conjunction, inference, defuzzi cation, clause selection, etc. by specifying the favored methods in a system le header. A typical header with the most important methods might look like this (default values are used): CONJUNCTION DEFUZZY CLAUSE-SELECT INFERENCE
= = = =
MULTIPLIKATION CENTER-OF-AREA MAX-NEC-SUPPORT SLOP.
The support of a conjunction of predicates is realized by the multiplication of the corresponding support values. The center{of{area method is used for defuzzi cation and if there are alternative rules for resolution the one with maximum necessary support is taken. If a rule is chosen for resolution with a goal the supports of body and rule must be inferred to get a support for the goal. In SLOP ([2]) this is achieved for A : ?B [a; b] and B [e; f] by A [a e; 1 ? (1 ? b) e]. The inference is notated by i .
3.6 The Resolution Process
The main idea of ConFuP's resolution is the creation of supported subresolvents where the applicability of rules is tested. This test is supported to a certain degree depending on the rule support and the uni cation support. Partial results of this test (e.g. the ful llment of a single predicate) are modeled through the support of the corresponding subresolvent (resolvent support ). Given a goal A, the resolution in ConFuP consists mainly of 4 steps. A resides in the initial resolvent R0, called root resolvent . Every resolvent is initially valued with [1; 1]. This support describes the state of the current calculation in the resolvent.
Create in parallel for every rule i : A0 : ?GjB [r; s] which head A0 uni es with A a subre-
solvent Ri which consists of the guard(s) G. The rule support [r; s] is attached to the edge between Ri and R0. If fuzzy sets are involved in the uni cation process, Ri is initially valued with the uni cation support, otherwise with [1; 1] (support of conventional uni cation). If a subgoal in Ri is satis ed with a support [a; b], this support is conjunctively combined with the corresponding resolvent support.
If the subresolvent is empty the resolvent support describes the support of the guard test.
In order to get the support of the complete proof path (solution support ) this support has to be combined with the rule support by an inference operation. The solution support of all parallel created subresolvents is considered by a user-de ned strategy and the 'best' rule is chosen. The resolution is carried on with this one. The resolution process is described in more detail through the following example. We use the default values for the various methods, A as the initial goal. 1. 2.
A1 :- G1, G2 | B1. [0.8] A2 :- ... G1. [0.8,0.9] G2. [0.9]
B1.
The uni cation A u A1 succeeds in [0:9; 1] and the proof path for rule 2 may have a solution support of [0:4; 0:8]. The resolvent R0 consists of the initial goal A. 1. Create for every rule i which clause head uni es with A a subresolvent Ri. Ri consists of all guards of rule i (in case of rule 1, R1 =fG1; G2g). The rule support is attached to the edge and the support of the semantic uni cation [0:9; 1] is the initial resolvent support of R1 (cf. picture 5). [1,1] R0
A
[0.8]
... [0.9,1]
R1
G1
G2
Figure 5: resolution process with satis ed guard G1 2. G1 is satis ed with [0:8; 0:9] and G2 with [0:9; 0:9](= [0:9]). The nal resolvent support for R1 is therefore [0:9 0:8 0:9; 1 0:9 0:9] = [0:648; 0:81]. 3. This nal support is inferred with the rule support [0:8] (via SLOP-inference), thus resulting in a solution support of [0:8] i [0:648; 0:81] = [0:5184; 0:8704]. 4. Other possible proof paths are considered. The application of rule 2 would lead to solution support of [0:4; 0:8]. The selection strategy (max. nec. support) chooses rule 1 for resolution (cf. picture 6). 5. The goal A in the resolvent R0 is replaced by B1 and this replacement is supported with [0:5184; 0:8704]. This value is conjunctive combined with the resolvent support of R0. The resolution process is applied on all body goals in the resolvent.
3.7 Built{In{Predicates
PROLOG uses built{in{predicates to gain more functionality. We use several built{in{predicates for modeling fuzzy control and self{modifying concepts. Due to space limitations we give only a short overview of ConFuP's predicates.
[1,1] R0
*i
[0.8]
[1,1] R0
A
A
[0.518,0.8704]
...
[0.4,0.8]
[0.648,0.81] R1
[0.518,0.8704] R0
B1
Figure 6: resolution process with considered parallel proof paths
In fuzzy control all red production rules are considered. Their results are combined and a
crisp value is nally calculated. In ConFuP this is achieved by the predicates bagof/3 and . collects all solutions of a given goal in a structure (similar predicate as in PROLOG). uses this structure and calculates a crisp value corresponding to the prede ned strategy for defuzzi cation. For self-modifyingconcepts we de ne predicates for modifying fuzzy sets (get fs/3,set fs/3, mod fs/3) and rule supports (get sp/3,set sp/3,mod sp/3). See [9] for more details. defuzzy/2 bagof/3 defuzzy/2
4 Modeling Flexible Manufacturing Systems As an example for multi-staged process modeling we consider exible manufacturing systems (FMS), one of the most complex systems in computer integrated manufacturing (CIM). FMS are an extensions of conventional manufacturing systems which increase the eciency of the manufacturing process by using highly automated production units (NC/CNC-machines) which are linked by a computerized material handling system making it possible for dierent products to follow diverse routes through the system. Most methods developed in the operation research eld (scheduling, resource allocation, optimal routing, etc.) may be useful to handle the various problems which occur when modeling FMS; however, due to the interdependence of these (often dynamical) problems and the existing uncertainty in some data, the design of an optimal FMS is one of the most dicult problems in the CIM-area. The decision process is decentralized and allows directly participating co{workers (experts) to in uence the results of the production process by using their speci c knowledge. Preconditions and planning data have a great amount of uncertainty and the decisions on basis of the workers experience knowledge are more linguistic in nature, thus a satisfying knowledge representation is needed. There exist approaches in the literature [23, 22] which show the usefulness of solving some of the above mentioned problems with fuzzy technology (fuzzy linear programming, fuzzy petri{nets, fuzzy rule bases, etc.). In this paper we concentrate on rule based approaches in the eld of FMS [9]. One problem in the CIM{area is the ecient description and modeling of exible manufacturing systems from a physical point of view as well as from a logical one. The inherent parallelism and the expressive power of LP predestine concurrent logic programming languages like Concurrent Prolog for modeling of these systems. Dotan et al. show in [4, 6, 5] that many important aspects of these
systems like hierarchical descriptions, timing considerations, product ow, alternative decisions, scheduling, etc. can be described in FCP, a subset of CP, in an easy and natural way. However, uncertain knowledge can not be represented in FCP. ConFuP allows a combination of these ideas, thus achieving greater exibility in the design of FMS. Figure 4 shows a simple FMS consisting of three machines A; B and C, where the incoming available jobs are scheduled by a release scheduling and inside the FMS by a machine scheduling strategy.
available jobs I2 I
I3 I4
I1
Wa
Ir
? release schedule
?
Wc1
FMS
A machine schedule Wc
B Wb
C
O
Wc2
system
Figure 7: A simple FMS with two 'input'-machines The system consists of the set of available jobs and the FMS. If the FMS is able to process a new job the most important job is released into it. The FMS contains two 'input'-machines A and B (e.g. two machines which are able to process a new incoming job). Which one of these will be used for a new job is decided by the machine scheduling strategy. After this processing and a waiting time (for example, drying after a coloring process) the job is inserted in the waiting queue of machine c, which is the nal machine and produces the output O. In this paper we focus on the two problems release scheduling and machine scheduling 2 . The whole system is modeled by the proposed algorithm. Release scheduling: If the FMS requires a new job the most important job is selected from the set of available jobs and released into the machine. There exist many criteria for importance, often structured in a hierarchy [13]. We concentrate here on two of these, the slack time ST (based on the dierence between the jobs due date and the remaining operation time) and the processing time until the next manual xturing FT. These criteria are described by uncertain expressions because the measured values may not be exact or the exact formulation leads to a rule base which cannot be computed eciently. In order to model these values independent from a given problem, these criteria are modeled as proportionality factors. Slack Time (ST) The absolute slack time of a job i, STi , is de ned by the due date di, the actual time of decision t, the remaining operation time (on the fastest machines) OTi and a factor , which describes the expected number of activitys, which can be done in parallel. This leads to an absolute slack time ASTi = (di ? t) ? OTi . The relative slack time STi is then calculated by dividing the absolute slack time by the remaining operation time, STi = AST OT . A slack time of 3.3 min means that a job can wait 3.3 minutes for processing per 1 minute of operation. Figure 8 shows the slack time and its occurrences critically, short and ok which are modeled by fuzzy sets. xture time The values of xture time are evaluated empirically [22]. Due to space limitations we give only a graphical description in gure 8. The xture time FT is de ned by fuzzy sets for long and short . i i
2
The described scheduling strategies are taken from [13, 22] and no originality is claimed for them.
Criteria for releasing a job I (out of a set of jobs) into the FMS are slack time and xture time yielding the priority also measured linguistically with fuzzy sets. We de ned slack time=fST critically, ST short, ST ok g, xture time =fFT long, FT short g and model priority =fP high, P med, P low g. The IF [ST] AND [FT] THEN [PR]-rules for computing the priority are elements of the cartesian product fST critically, ST short, ST ok g fFT long, FT short g fP high, P med, P low g and are weighted by a support pair. Here we use Sn = x = Sp , indicated by [x] for modeling the sensibleness of rules. The rule base for the release scheduling looks like follows. if if if if if if
ST ST ST ST ST ST
= = = = = =
ST ST ST ST ST ST
critically critically short short ok ok
and and and and and and
FT FT FT FT FT FT
= = = = = =
FT FT FT FT FT FT
1.0
P P P P P P
= = = = = =
P P P P P P
[1:0] [0:8] [1:0] [0:7] [0:4] [1:0]
high high med med med low
1.0 critically
0
long then short then long then short then long then short then
short
3.0
6.0
ok
8.0
short
relative slack time
0
long
0.2
0.4
fixture time
Figure 8: Fuzzy sets for relative slack time and xture time
Machine scheduling: If job J is released in the FMS the machine route of this job has to be developed. We concentrate on the jobs processing time PT = fPT large, PT med, PT small g on each machine, the length of the machines waiting queue WQ = fWQ long, WQ short g and on the jobs priority P calculated by the release scheduling as criteria for the resulting demand D = fD high, D med, D low g of a machine for a given job. The modeling of the criterias occurrences and the rule base is similar to the release scheduling and we omit a detailed description here.
4.1 Modeling of a FMS in ConFuP
In this section the described FMS is modeled in ConFuP{notation. Due to space limitations we omit the de nition of the fuzzy sets. 1.
2.
system(I, O?) :-| release_schedule(I?, J), fms(J?, O).
2.1
release_schedule(I, [X|Xs]) :-| eval(I?, I2), select(I2?, X, I3), release_schedule(I3?, Xs). release_schedule([],[]).
3.1
eval([J|Js], [pri(J?, P?) | JP?]) :-|
% spawn system
% calc. priority % X is maximum, I3 = I2 - X % recursive call
3.2 3.3
get_slack(J?, St), get_fixt(J?, Ft), bagof(H, prule(St?, Ft?, H), L), defuzzy(L?,P), eval(Js?, JP). eval([],[]). eval(X,_) :- var(X)|.
4.1 4.2 4.3 4.4 4.5 4.6
prule(my-ST_Critically, prule(my-ST_Critically, prule(my-ST_Short, prule(my-ST_Short, prule(my-ST_Ok, prule(my-ST_Ok,
5.
select (In, Elem?, Out) :-| calc_max(In?, pri(Elem,Max)), copy_list(In?, Max?, Out).
6.
calc_max ( [pri(E1,P1) | Is], M ) :-| search_list(Is?, M, pri(E1?,P1?)).
7.1 7.2
search_list ([], X, X). search_list ([pri(I1,I2) | search_list(Is?, search_list ([pri(I1,I2) | search_list(Is?,
7.3
8.1 8.2 8.3 8.4 9.
my-FT_Long, my-FT_Short, my-FT_Long, my-FT_Short, my-FT_Long, my-FT_Short,
P_High). P_High). P_Med). P_Med). P_Low). P_Low).
% get crisp values % collect fuzzy rules % calc crisp result
[1.0] [0.8] [1.0] [0.7] [0.4] [1.0]
% fuzzy production rules
% select maximum
% search for max Is], X, pri(E,Max) ) :- I2 >= Max | X, pri(I1,I2)). Is], X, pri(E,Max) ) :- I2 < Max | X, pri(E,Max)).
copy_list ( [pri(X,R) | Xs], copy_list(Xs, Rem, copy_list ( [pri(X,R) | Xs], copy_list(Xs,Ys). copy_list ( [pri(X,R) | Xs], copy_list ( [],[] ).
Rem, [X|Ys] ) :- R \= Rem | Ys). R, Ys ) :- R==Rem | % copy list without max [X | Ys] ) :- copy_list(Xs,Ys).
fms(Ir, Out?) :-| machine_schedule(Ir?, Wa, Wb), machine(a,Wa?,Outa), wait(10, Outa?, Wc1), machine(b,Wb?,Outb), wait(12, Outb?, Wc2), merge(Wc1?, Wc2?, Wc), machine(c, Wc?, Out).
% % % % %
model FMS with machine scheduling machine A waiting of A ... B
%...
C
10.1 machine_schedule([J|Js], Wa, Wb) :-| calc_demand(J?, a, Da), % calc demand for A calc_demand(J?, b, Db), % calc demand for B get_max_demand_machine(J?, Da?, Db?, Wa, Wb, Js?). % get max 10.2 machine_schedule([],[],[]). 11.
calc_demand(J, M, D?) :-| get_proc_time(M?, J?, Pt), % get crisp values get_queue_len(M?, Wt), get_prior(J?, Pr), bagof(D, drule(M, Pt?, Wt?, Pr?, D), S), % fuzzy strategy defuzzy(S?, D). % defuzzy to crisp result
12.1 drule(_, my-PT_Large, my-WQ_Short, my-P_High, D_High). [1.0] 12.2 drule(_, my-PT_Large, my-WQ_Short, my-P_Med, D_High). [0.4]
% rule base
... 12.n drule(_, my-PT_Small, my-WQ_Long,
my-P_Low,
D_Low).
13.1 get_max_demand_machine(I, Da, Db, [I|Wa], Wb, Tail) :Da >= Db | machine_schedule(Tail?, Wa, Wb). 13.2 get_max_demand_machine(I, Da, Db, Wa, [I|Wb], Tail) :Da < Db | machine_schedule(Tail?, Wa, Wb).
14.1 14.2 14.3 14.4
machine(_,[],[]). machine(a,[X|T],[a(X)|S]) :-| machine(a,T?,S). machine(b,[X|T],[b(X)|S]) :-| machine(b,T?,S). machine(c,[X|T],[c(X)|S]) :-| machine(c,T?,S).
15.1 wait(Time, [Job|Js], W) :-| clock(0, Time, Ok), list_insert(Ok?, Job?, W, Wt), wait(Time?, Js?, Wt). 15.2 wait(Time,[],[]).
[0.1] % get maximum demand
% process jobs in machines % A, % B and % C % waiting process
16.1 clock(Ck, Time, Ok) :-| % modeling of time Ck \= Time | Nk := Ck+1, clock(Nk?, Time, Ok). 16.2 clock(C,C,true). 17.1 17.2 17.3 17.4
merge([X|Xs], Y, [X|Out]) :-| merge(Y?, Xs?, Out). merge(X, [Y|Ys], [Y|Out]) :-| merge(Ys?, X?, Out). merge([],X,X). merge(X,[],X).
18.
list_insert(true, Job, [Job|W], W).
% fair merge
4.2 Description of the Algorithm
In clause 1 the system is described by the two processes release scheduling(...) and fms(...). Through the input channel I new jobs arrive and wait for the release scheduling. Note, that the direction of communication from system(I,...) to release scheduling(I?,...) is managed by the ?{operator. If the release scheduling has chosen the most important job J, this one is released in the FMS. The release scheduling is described in more detail below. A processed job is released from the FMS through the output channel O. The FMS-process (clause 9) consists of the machine scheduling, the waiting time and three processes for machines a; b and c. The machine scheduling is described below, thus we concentrate on the rest here. The two 'incoming' machines a and b process their waiting queues (clause 14) and the selected jobs and put processed ones in the queue of machine c after they wait the speci ed time. We model this by two output queues Wc1 and Wc2 which are fairly merged (clause 17) into Wc, if they contain elements. Machine c processes its waiting queue Wc and produces the output O.
4.2.1 Release Scheduling
The release scheduling is modeled in clause 2. For every available job in list I the priority is evaluated and stored in list I2. The select(...){clause (15) selects the element with maximum priority out of list I2 (clauses 6,7), stores it in X and copies the list without X in list I3 (clauses 5,8). The release scheduling is recursively invoked with the result list I3. The evaluation (clause 3) consists of the computation of the (exact) slack time (St) and xture time (Ft) for each job J on top of the input list [J jJs]. If these values are computed, the bagofpredicate is evaluated over all rules which match slack{ and xture time. The clauses in 4.x
describe the fuzzy production rules. The sensibleness of each rule is modeled by a support pair [x]. Notice that we have to unify the crisp values St and Ft with fuzzy sets (critcally; : : :) to compute the membership (fuzzi cation). This calculation is done by the -operator as described in the former section. Both membership values for slack time and xture time are combined with the rule support (e.g. [0.8] for clause 4.2) by the speci ed inference method yielding a support for the resulting priority. These values (fuzzy set and support) are stored in a list-like structure S and other rules are considered. If all solutions are found the defuzzy-process computes a crisp value P out of structure S. The parallel processes of bagof(...) and defuzzy(...) are synchronized by the ?{Operator. The priority P and the job J are stored and the next job is evaluated by the recursive call of clause 3.1.
4.2.2 Machine Scheduling
If the most important job is released in the FMS, the demand of each machine which is able to process this job is computed and the job is inserted in the machines waiting queue (clause 10). The mechanism of bagof and defuzzy is similar to the previous described procedure and we give only a short description. If a new job J arrives in the FMS the demand of each machine, which can process this job is computed (clause 11). If process time, queue length and priority of each job/machine are calculated, the uncertain rules (clauses 12.x) are processed similar to the release scheduling. The resulting demands Da; Db are compared in the get max demand machine{clause. The job is inserted in the corresponding queue thus yielding two new queues Wa and Wb. With these the machine scheduling is repeated if new jobs arrive in the FMS. The recursive call of machine schedule(...) is done in clause 13:x.
4.3 Other Concepts for Sophisticated Modeling
With the concept of the commit{operator as a \point of no return", we have a tool to evaluate alternative solutions in parallel (or{parallelism) before the commitment and chose the best one irreversibly after committing. This can be used to model the knowledge of several experts with dierent knowledge bases and to choose the best one according to a speci c situation ([9]). Another possible extension is the use of ConFuP's built{in predicates for modifying the rule base. If we consider the small FMS{example described in this paper it is possible to measure the eciency of each machine by considering the trash it produces. This eciency is modeled in the rule base by support pairs. If the trash of a machine with a high demand for a new job increases, an intelligent strategy is changing the corresponding support pair, thus achieving a lower demand. Even if a machine breaks down this intelligent strategy seems to be a promising concept.
5 Conclusion and Future Work We presented the application of ConFuP in the eld of modeling exible manufacturing systems. With the combination of a concurrent logic language with fuzzy concepts we combine the expressive power of logic languages with a method to describe \fuzzy" knowledge in its various forms (linguistic, uncertain, vague, probabilistic). With the process oriented model a system can be described on the physical layer under consideration of concurrency. On the logical layer some kinds of uncertainty can be integrated to allow the easy formulation of sophisticated control strategies. With ConFuP the designer has a tool for rapid prototyping of highly complex concurrent systems like FMS, fuzzy control systems or project plans. Our future work is divided mainly in two parts: Based on a sequential implementation of ConFuP in C++ we are going to implement the language on a massive-parallel transputer system with 1024 nodes. Outgoing from the experience for a distributed implementation of FCP [12, 11] on a multi-transputer network up to 1024 nodes, a parallel fuzzy WAM (Warren Abstract Machine) has to be de ned. Secondly we are focusing our research to the eld of modeling applications in the CIM-framework as pointed out in section 4.3
References
[1] J.F. Baldwin. Support logic programming. In A. Jones et al., editor, Fuzzy Sets Heory and Applications, chapter Support Logic Programming, pages 133{170. D. Reidel Publishing Company, 1986. [2] J.F. Baldwin. Evidential support logic programming. Fuzzy Sets and Systems, 24:1{26, 1987. [3] M. Cayrol, H. Farreny, and H. Prade. Fuzzy pattern matching. Kybernetes, 11:103 { 116, 1982. [4] Y. Dotan and B. Arazai. Concurrent logic programming as a hardware description tool. IEEE Transaction on Computers, 39(1):72 { 88, 1990. [5] Y. Dotan and B. Arazi. Using at concurrent prolog in system modeling. IEEE Transaction on Software Engineering, 17(5):493 { 512, 1991. [6] Y. Dotan and D. Ben-Arieh. Modeling exible manufacturing systems: The concurrent logic programming approach. IEEE Transactions on Robotics and Automation, 7(1):135 { 148, 1991. [7] Didier Dubois, Jer^ome Lang, and Henri Prade. Fuzzy sets in approximate reasoning, part2: Logical approaches. fuzzy Sets and Systems, 40:203{244, 1991. [8] J. Encarnacao and E.G. Schlechtendahl. Computer Aided Design: Fundamentals and System Architectures, chapter 3, Modelling of the Design Process, pages 37 { 87. Springer-Verlag, 1983. [9] C. Geiger. ConFuP- Concept of a parallel logic programming language with fuzzy semantics. diploma thesis, University of Paderborn, November 1993. (in german). [10] C. Geiger, G. Lehrenfeld, and V. Wiechers. ConFuP-A Concurrent Logic Language with Fuzzy Semantics. In B. Reusch, editor, Fuzzy Logik: Theorie und Praxis, pages 121 {130. Springer, June 1993. [11] Uwe Glasser, Gerd Hannsen, Michael Karcher, and Georg Lehrenfeld. A distributed implementation of at concurrent prolog on multi-transputer environments. In Proceedings of the First International Conference of the Austrian Center for Parallel Computation, Berlin, 1991. Springer-Verlag. [12] Uwe Glasser and Georg Lehrenfeld. A distributed implementation of at concurrent prolog on transputer architectures. In Proceedings of the UNESCO Conference on Parallel Computing in Engineering and Engineering education, pages 181{185, 1990. [13] G.W. Hintz and H.-J. Zimmermann. A method to control exible manufacturing systems. European Journal of Operational Research, 41:21{334, 1989. [14] K. Hirota. Survey of industrial applications of fuzzy control in japan. In Proc. IJCAI - 91 Workshop on Fuzzy Control, pages 18 { 20, Sidney,1992. [15] G.J Klir and T.A. Folger. Fuzzy Sets, Uncertainty, and Information. Prentice Hall, Englewood Clis, New Jersey, 1988. [16] E.H. Mamdani. Twenty years of fuzzy control: Experiences gained and lessons learnt. In IEEE International Conference on Fuzzy Systems. IEEE, 1993. [17] T.P. Martin and J.F. Baldwin. An abstract mechanism for handling uncertainty. In Zadeh L. A. Bouchon-Meunier B., Yager R. R, editor, Uncertainty in Knowledge Bases, pages pp. 126 { 135. Springer, 1990. [18] W. Pedrycz. Fuzzy Control and Fuzzy Systems. Research Studies Press ltd., 1989. [19] J.E. Pham and E. Tacgin. Arti cial Intelligence in Design, chapter 1, Techniques for Intelligent Computer-Aided Design, pages 5 { 26. Springer-Verlag, 1991. [20] Ehud Shapiro. Concurrent prolog: A progress report. IEEE Computer, 19(8):44{58, 1986. [21] L.A. Zadeh. Fuzzy sets. Information and Control, 8:338 { 353, 1965. [22] H.-J. Zimmermann. Fuzzy Technologie: Principles, Tools, Potentials. VDI Verlag, 1993. (in german). [23] Hans-Jurgen Zimmermann. Fuzzy Set Theory | and Its Applications. Kluwer Academic Publishers, 2nd, revised edition, 1991.
A Semantic Uni cation in ConFuP The uni cation in concurrent prolog diers from the usually used uni cation in PROLOG, because uni cation with read{only structures has to be considered. We extend this uni cation, as described in [20], to the fuzzy concepts used in ConFuP. In this paper we describe only these new cases; if the uni cation succeed in the traditional sense, a resulting support of [1; 1] is assumed. The support{pair [IN(S j T); (S j T)] results from the semantic uni cation as described previously, T (S) is the membership value of S in fuzzy set T.
Input: Two terms S and T . Output: Most general unifier mgu
von
S
and
T
with a support pair
S = [Sn ; Sp ]
or fail.
ST
CONFUP UNIFY( , )
f
if
::: ::: if
S
=
T
and
S ,T
are not fuzzy sets
% conventional read-only-unification
S
is a fuzzy set then case of fuzzy set: if S T % check domains then IN else fail number: % consider as a special fuzzy set S S other: fail if is a fuzzy set and is not a fuzzy set then if is a number then T else fail if is a -fuzzy set % special case for modeling fuzzification then if is a number then T T else fail if and have the same significance functor/n then
T
=
mgu := fg; S := [ (S j T); (S j T)]
mgu := fg; S := [ (T); (T)]
T
S S mgu := fg; S := [0; (S)]
T
S mgu := fg; S := [ (S); (S)]
S
T
T
mgu := fg; S := [1; 1]
for i=1 to n do (u, S') CONFUP UNIFY(i.th argument in
:= mgu := mgu [ u; S := S ^ S 0
else fail return(mgu, S)
g
S,
i.th argument in
T
)
B An Abstract Interpreter for ConFuP The informal description of the resolution process is described more exactly by an abstract interpreter similar to [20]. ? is the most general uni er in read{only uni cation.
Input:
P = K1 ; : : :; Kn G in the
A ConFuP-program and an initial goal l
Output: G?
consisting of resolvent .
R
deadlock deadlock
[S ; S ]
with support . n p or (G is an instance of G (substitution and proved by , else )
?
P
n
clauses
used on G),
R [In; Ip ])
RESOLVE( ,
f
R
[In ; Ip]
support( ) := While
R 6= ;
% resolve with initial resolvent support
[In ; Ip]
do % resolvent not empty
Choose
A2R
H := fHij(Hi
Gi1; : : :; GinjBi1; : : :; Bim ) = Ki 2 P and H A ^ arity(Hi) = arity(A) g
functor( i) = functor( ) % corresponding clauses
( , 0 n p ) := TRY( , ) % choose best clause N with mgu
N ?; [R ; R ]
if TRY() fails, then
R := R nfAg
K
AH
0
exit
% replace goal
R := R [ fBN 1 ; : : :; BNm g
% by body predicates
8 G 2 R : R = (RnfGg) [ fG0 ?g R
R ^ [Rn; Rp]
support( ) := support( ) od If
g
R 6= ;
then
and support ,
deadlock
[Rn; Rp ]
The try{function looks like follows.
Input: testgoal A and a set of clauses H with matching arity and functor. Output: Number rn of the chosen rule and solution support [Ln; Lp] or fail A H)
TRY( ,
f
H = ; then fail Hj 2 H do
If For all begin loop:
choose
Hj 2 H
j ?; [Un; Up ]j )
(
A Hj )
= CONFUP UNIFY( ,
if the unification fails, goto begin loop and choose a new create subresolvent evaluate edge
j0 ?; [R0n; R0p])
(
[Ln; Lp ]j
:=
R ? R0
Hj
R0 = fGj 1; : : :; Gjmg [Kn ; Kp]j
with
j
:= support( )
% support clause
j
R0j ?; [Un; Up ]j )
:= RESOLVE(
[Kn ; Kp ]j i [R0n; R0p]j
od
N; ?; [R00n; R00p ])
(
Hi; [Ln; Lp ]; i0 ?)
:= selection strategy(
over all
i
N; ?; [R00n; R00p ]) g
return (
In this interpreter the strategy for clause selection is omitted because it is left to the user.