Supply chain complex event detection method supporting event time sequence constraint
Technical Field
The invention relates to the field of complex event processing, in particular to a supply chain complex event detection method supporting event timing constraint.
Background
The process of organizing from various perceptual sequence data to accurately mine, analyze more meaningful information from the data, and form the mining, extraction, and processing of events is complex event processing. Complex event processing has been widely used in the fields of industrial internet, finance and the like.
With the application of industrial internet technology, a large amount of time sequence data related to a supply chain can be easily acquired at each supply chain node, the time sequence data often contains information related to KPIs (Key Performance indicators) which can affect the Performance of the supply chain, and how to capture events which can affect the KPIs through the time sequence data and process the events which can cause the Performance reduction of the supply chain in time, so that the in-process control of the supply chain is realized, and the normal operation of the whole supply chain system is ensured.
The Chinese patent with publication number CN105930494A, 2016 and 09/07/2016, discloses a complex event detection method based on a multi-pattern matching model, which integrates multiple complex event detection modes to form a finite state automaton, greatly reduces the storage and search of multiple redundant automaton states and transfer edges, avoids repeated data operation matching and calculation operation, realizes the detection and matching of multiple complex event detection modes by scanning once data stream, and improves the detection efficiency of complex events on massive data streams. However, this patent only describes and handles transient events and does not support enough on the temporal logical constraints between events over a period of time. In some application scenarios of the supply chain, transient events often cannot accurately describe a desired event pattern, for example, an event of "delayed delivery of a certain part of a supplier" occurs, a "supply chain scheduling system" performs scheduling, and a "delivery date of a product is guaranteed", and a front-back time sequence relationship exists between the three events, so that a time sequence logic constraint on a time period must be introduced.
Disclosure of Invention
The invention provides a supply chain complex event detection method supporting event time sequence constraint, and solves the problem of supply chain complex event detection.
In order to solve the technical problems, the technical scheme of the invention is as follows:
a supply chain complex event detection method supporting event timing constraints comprises the following steps:
s1: defining a supply chain event timing relationship;
s2: collecting time sequence data of supply chain nodes, and constructing a supply chain atomic event set and a composite event set;
s3: constructing a supply chain system finite state machine;
s4: constructing a complex event detection statement based on a finite state machine;
s5: and detecting the supply chain event stream according to the defined complex event detection statement.
Preferably, the step S1 defines a supply chain event timing relationship, specifically:
defining the occurrence or duration segment of a supply chain event as determined by the starting and ending endpoints and their lengths, the time of the supply chain event being divided into time instants and time intervals according to the length of the time segment;
supply chain event EiIs expressed as [ T ]i,s,Ti,e]Wherein, Ti,sIs the start time, Ti,eIs the end time, if Ti,s=Ti,eIf the starting time and the ending time are equal, the event is a transient event;
to represent the timing relationships of supply chain events having time intervals in the supply chain, the following eight relationships are employed to represent the timing constraints of supply chain event Y and supply chain event X:
before (Y, X): if TY,e<TX,sY precedes X;
after (Y, X): if TY,e>TX,sY is after X;
contains (Y, X): if TY,s<TX,sAnd TY,e>TX,eY comprises X;
overlaps (Y, X): if TY,s<TX,sAnd TY,e<TX,eY and X overlap;
meet (Y, X): if TY,e=TX,sY ends, just X begins;
during (Y, X): if TY,s=TX,sAnd TY,e<Tx,eX, Y begin at the same time and Y ends early;
finished (Y, X): if TY,s<TX,sAnd TY,e=TX,eY starts first, and X and Y end simultaneously;
equals (Y, X) if TY,s=TX,sAnd TY,e=TX,eY, X begin at the same time and end at the same time.
Preferably, the step S2 of collecting the supply chain node time series data specifically includes but is not limited to:
utilizing the product information read by the reader-writer, the position and configuration information of the reader-writer and the timestamp;
associating supply chain location information including plant, equipment and warehouse information;
the relation supply chain operation information comprises corresponding processing procedures or working sections, or warehouse-out, warehouse-in and sale;
and associating supply chain schedule information including a material serial number, a process or work section number, planned completion time, processing time and actual completion time.
Preferably, the step S2 constructs a supply chain atomic event set and a composite event set, specifically:
an atomic event refers to the calibration of a supply chain management system for a workpiece or product in production, inventory, or sale at a certain time, using Epri=<eventid,eventtype,value,time_interval>Event _ ID is an event ID, which is a unique identifier of an event; event _ type is the type of event; value is the corresponding attribute value when the event occurs; time _ interval is a binary group of the occurrence time of an event, and comprises a starting time point and an ending time point;
the composite event is a new event which meets the condition and is obtained by carrying out composite operation on the atomic event through a time interval characteristic function on the basis of the atomic event, wherein the time interval characteristic function F comprises but is not limited to sum, average avg, variance var, maximum max, minimum min operation or a combination of the operations.
Preferably, the supply chain system finite state machine in step S3 includes:
a finite set of supply chain states s;
a set of input events { event }, where events can be atomic events and composite events;
a state transition function that outputs a set of transition states for each given state s and one or more events belonging to { event };
a state s0 in { s } as a starting state;
s, as the end state.
Preferably, the complex event detection statement constructed based on the finite state machine in step S4 includes a description of the complex event detection statement, a construction of an attribute constraint, and a construction of a timing constraint.
Preferably, the complex event detection statement description specifically includes:
the method comprises the following steps of converting interested event description into a finite state machine query statement, determining the event type which needs to be contained in a sequence to be detected by identifying a conditional clause in an event description structure in the conversion process, and describing the interested event by adopting the following statement form:
ON event-expression
WHEN system-state
[BEFORE,CONTAINS,OVERLAPS,MEET,DRUING,FINISHED,EQUALS]time-expression
WHERE property-expression
DO action-express
Trigger event
Transfer system-new-state
the semantic meanings are as follows: when the event described by the event-expression event expression meets the specified time sequence constraint time-expression, the system is in the specified system state system-state, AND the attribute expression of the event is met, triggering the response action defined by the response expression, AND outputting the event, if the state of the system is changed, changing the state of the system into a new state system-new-state, AND using logical operators such as AND, OR, NOT AND the like in the event expression time-expression AND the attribute expression property-expression, wherein the event-expression is an atomic event AND a composite event generated in a supply chain; system-state refers to the state in which the supply chain system is in during its lifecycle, which is defined by the human pre-definition of all possible state sets according to the management requirements.
Preferably, the structure of the attribute constraint specifically includes:
in the detection statement, the property-expression after the WHERE keyword may be combined by a plurality of boolean expressions to describe the property value constraint included in the event, and the property-expression is decomposed into a single boolean expression according to the logical operator, WHERE each boolean expression represents the check of one property value or time interval characteristic of the event.
Preferably, the timing constraint is configured to:
in the description of the complex event detection statement, the time-expression of the timing constraint may include a plurality of boolean expressions expressing timing relationships to describe the timing constraint included in the event, the time-expression is decomposed into a single timing constraint expression according to logical operators, and each timing constraint expression may require timing between 2 events.
Preferably, the event stream in step S5 is that as the supply chain system runs, the supply chain system continuously generates atomic events and composite events, the generated events are continuously added to the event instance buffer pool, so as to form an event stream, and according to a predefined complex event detection statement, the event stream is detected and, when a complex event instance satisfying the attribute constraint and the timing constraint is detected, the actions scheduled by the system are generated, the complex event instance is also put into the event instance buffer pool, to synthesize a potentially more complex event, the detected complex event will be stored in the complex event instance database in the form of < ComplexEventID, ComplexEventInstance >, where ComplexEventID is the complex event instance ID, ComplexEventInstance will record the trigger atom/complex event instance that generated the complex event, and detecting specific values of each attribute condition and time sequence condition in the detection statement of the complex event.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
the invention aims at the detection of complex events of a supply chain, not only supports the description of time interval events, but also supports the detection of the constraint between event time sequences, and can accurately detect the events with the time sequence relation between the front and the back.
Drawings
FIG. 1 is a schematic flow chart of the method of the present invention.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the patent;
for the purpose of better illustrating the embodiments, certain features of the drawings may be omitted, enlarged or reduced, and do not represent the size of an actual product;
it will be understood by those skilled in the art that certain well-known structures in the drawings and descriptions thereof may be omitted.
The technical solution of the present invention is further described below with reference to the accompanying drawings and examples.
Example 1
The embodiment provides a supply chain complex event detection method supporting event timing constraints, as shown in fig. 1, including the following steps:
s1: defining a supply chain event timing relationship;
s2: collecting time sequence data of supply chain nodes, and constructing a supply chain atomic event set and a composite event set;
s3: constructing a supply chain system finite state machine;
s4: constructing a complex event detection statement based on a finite state machine;
s5: and detecting the supply chain event stream according to the defined complex event detection statement.
In step S1, defining a supply chain event timing relationship, specifically:
defining occurrence or duration segment of supply chain event, which is determined by starting and ending two end points and length thereof, according to length of time segment, time of supply chain event can be divided into time and time interval, for example, finishing time of workpiece is 11/12/2020 and 15/30/26 s; the number of workpieces completed in 11, 12 and 2020 of the time interval is 24;
supply chain event EiIs expressed as [ T ]i,s,Ti,e]Wherein, Ti,sIs the start time, Ti,eIs the end time, if Ti,s=Ti,eIf the starting time and the ending time are equal, the event is a transient event;
the occurrence of events in the supply chain often has a time-series relationship, such as a product delivery delay event, after a supplier delays the supply for one week. Through the checking of the time sequence relation between the events, a basis can be provided for the detection of the complex events of the supply chain. To represent the timing relationships of supply chain events having time intervals in the supply chain, the following eight relationships are employed to represent the timing constraints of supply chain event Y and supply chain event X:
before (Y, X): if TY,e<TX,sY precedes X;
after (Y, X): if TY,e>TX,sY is after X;
contains (Y, X): if TY,s<TX,sAnd TY,e>TX,eY comprises X;
overlaps (Y, X): if TY,s<TX,sAnd TY,e<TX,eY and X overlap;
meet (Y, X): if TY,e=TX,sY ends, just X begins;
during (Y, X): if TY,s=TX,sAnd TY,e<TX,eX, Y begin at the same time and Y ends early;
finished (Y, X): if TY,s<TX,sAnd TY,e=TX,eY starts first, and X and Y end simultaneously;
equals (Y, X) if TY,s=TX,sAnd TY,e=TX,eY, X begin at the same time and end at the same time.
The seven timing constraints described above can be utilized in event detection to examine the timing relationship between supply chain events, thereby providing a basis for complex event detection with timing relationships.
The step S2 of collecting the supply chain node time series data specifically includes but is not limited to:
product information, reader position and configuration information and timestamps read by readers such as RFID and the like;
associating supply chain location information including plant, equipment and warehouse information;
the relation supply chain operation information comprises corresponding processing procedures or working sections, or warehouse-out, warehouse-in and sale;
and associating supply chain schedule information including a material serial number, a process or work section number, planned completion time, processing time and actual completion time.
In step S2, a supply chain atomic event set and a composite event set are constructed, specifically:
an atomic event refers to the calibration of a supply chain management system for a workpiece or product in production, inventory, or sale at a certain time, using Epri=<eventid,eventtype,value,time_interval>Event _ ID is an event ID, which is a unique identifier of an event; event _ type is the type of event; value is the corresponding attribute value when the event occurs; time _ interval is a binary group of the occurrence time of an event, and comprises a starting time point and an ending time point;
the composite event is a new event which meets the condition and is obtained by carrying out composite operation on the atomic event through a time interval characteristic function on the basis of the atomic event, wherein the time interval characteristic function F comprises but is not limited to sum, average avg, variance var, maximum max, minimum min operation or a combination of the operations.
The supply chain system finite state machine in step S3 includes:
a finite set of supply chain states s;
a set of input events { event }, where events can be atomic events and composite events;
a state transition function that outputs a set of transition states for each given state s and one or more events belonging to { event };
a state s0 in { s } as a starting state;
s, as the end state.
The finite state machine of the supply chain system is constructed by 3 steps:
1) and (3) system logic arrangement: analyzing the working process of the concerned supply chain system, converting the logical relation of the actual work into a time sequence logical function according with the rule of the finite state machine, stripping different working states of the system, defining the input and output variables of the finite state machine, classifying and numbering the states according to the logical relation of the system, describing by the description method, and establishing the basis of the finite state machine.
2) Structure optimization: after the system is described by the above description method, what is needed is to simplify the structure of the finite state machine, merge states having similar meanings and similar state transition rules and having the same input and output in the state transition diagram, and obtain the simplest state transition directed diagram.
3) Designing software: and carrying out state coding according to the obtained state transition directed graph, selecting a proper trigger, and then carrying out software design according to system logic.
The complex event detection statement constructed based on the finite state machine in the step S4 includes a description of the complex event detection statement, a construction of an attribute constraint, and a construction of a timing constraint.
The description of the complex event detection statement specifically includes:
the method comprises the following steps of converting interested event description into a finite state machine query statement, determining the event type which needs to be contained in a sequence to be detected by identifying a conditional clause in an event description structure in the conversion process, and describing the interested event by adopting the following statement form:
ON event-expression
WHEN system-state
[BEFORE,CONTAINS,OVERLAPS,MEET,DRUING,FINISHED,EQUALS]time-expression
WHERE property-expression
DO action-express
Trigger event
Transfer system-new-state
the semantic meanings are as follows: when the event described by the event-expression event expression meets the specified time sequence constraint time-expression, the system is in the specified system state system-state, AND the attribute expression of the event is met, triggering the response action defined by the response expression, AND outputting the event, if the state of the system is changed, changing the state of the system into a new state system-new-state, AND using logical operators such as AND, OR, NOT AND the like in the event expression time-expression AND the attribute expression property-expression, wherein the event-expression is an atomic event AND a composite event generated in a supply chain; system-state refers to the state in which the supply chain system is in during its lifecycle, which is defined by the human pre-definition of all possible state sets according to the management requirements.
The structure of the attribute constraint specifically comprises:
in the detection statement, the property-expression after the WHERE keyword may be combined by a plurality of boolean expressions to describe the property value constraint included in the event, and the property-expression is decomposed into a single boolean expression according to the logical operator, WHERE each boolean expression represents the check of one property value or time interval characteristic of the event. For example, the number of ex-warehouse events >100AND ex-warehouse events, destination, beijing, represents that only events of which the ex-warehouse destination is beijing AND the number of ex-warehouse commodities is greater than 100 are of interest.
The structure of the timing constraint specifically includes:
in the description of the complex event detection statement, the time-expression of the timing constraint may include a plurality of boolean expressions expressing timing relationships to describe the timing constraint included in the event, the time-expression is decomposed into a single timing constraint expression according to logical operators, each timing constraint expression may require timing between 2 events, for example, in combination with the attribute constraint and the timing constraint, assuming that the part is finished as an e-event, "both part a and part b are used for assembling the same product," the finished event of part a being later than that of part b "may be expressed as: the WHERE ea. target product eb. target product After (ea, eb), WHERE ea represents the completion event of the workpiece a, eb represents the completion event of the workpiece b
In step S5, the event stream is an event stream formed by continuously generating atomic events and composite events by the supply chain system along with the operation of the supply chain system and continuously adding the generated events to the event instance buffer pool, and according to predefined complex event detection statements, the event stream is detected and, when a complex event instance satisfying the attribute constraint and the timing constraint is detected, the actions scheduled by the system are generated, the complex event instance is also put into the event instance buffer pool, to synthesize a potentially more complex event, the detected complex event will be stored in the complex event instance database in the form of < ComplexEventID, ComplexEventInstance >, where ComplexEventID is the complex event instance ID, ComplexEventInstance will record the trigger atom/complex event instance that generated the complex event, and detecting specific values of each attribute condition and time sequence condition in the detection statement of the complex event.
The same or similar reference numerals correspond to the same or similar parts;
the terms describing positional relationships in the drawings are for illustrative purposes only and are not to be construed as limiting the patent;
it should be understood that the above-described embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.