The present invention relates to a state chart execution device for generating and executing data of a state chart.
In recent years, a user interface device such as a touch panel, voice recognition, or spatial gesture recognition has been put to practical use. Furthermore, as represented by a car navigation system, a multimodal application combining a plurality of the user interface devices has been developed. As one of methods for designing a multimodal interface efficiently combining a plurality of user interface devices, a state chart (or state machine) has been widely used conventionally.
For example, Non-Patent Literature 1 describes state chart XML (SCXML) which is an extensible markup language (XML) description method of a state chart. In addition, Non-Patent Literature 2 describes a drawing rule of a state chart in unified modeling language (UML).
In addition, various methods for efficiently executing a designed state chart as a program have been proposed conventionally. For example, Patent Literature 1 describes a method for executing a state chart expressed by a table, and describes determining priority order of state transition on the basis of a result of executing a state chart. In addition, Patent Literature 2 describes a method for dynamically executing a state chart by using an associative array.
In a conventional method, there is a problem when a state chart having a hierarchical structure and an enormous number of states is executed on a computer, an execution speed is lowered because a data structure of the state chart is not optimized.
For example, Patent Literature 1 describes a method for determining, for each state of a state chart expressed by a table, order of transition to another state and event establishment order, on the basis of a state transition history for each state and an event establishment history for each event when the state chart is executed. However, Patent Literature 1 does not describe how to optimally arrange data on a memory of a computer by using the transition order and the establishment order. In addition, Patent Literature 1 only describes a table type state chart, and does not describe a method for determining priority of a transition destination in a state chart having a parallel state and a hierarchical state and optimally executing the state chart.
In addition, Patent Literature 2 describes that data of a state chart is held as a dynamic tree structure in order to specify the position of state data on a memory from a character string of a corresponding state name. However, in a case where a tree is constituted dynamically, when the number of states becomes enormous, a cache hit ratio decreases because related pieces of state data may be arranged at remote positions from each other on the memory, and state chart executing processing may be slow. In addition, in processing of state transition, there is no little need for processing of searching for state data by a binary tree, and therefore processing time becomes longer as the number of states increases.
The present invention has been achieved in order to solve the above problems, and an object of the present invention is to execute a state chart at high speed.
A state chart execution device according to the present invention includes: a processor to execute a program; and
a memory to store the program which, when executed by the processor, performs processes of,
converting state chart information on a state chart expressing state transition into binary data; and
executing processing of the state chart on a basis of the binary data, in which
the processes further include: reading the state chart information and generating pieces of data constituting the state chart; calculating relevance between the pieces of data constituting the state chart; binarizing the pieces of data constituting the state chart; calculating an array of the pieces of data constituting the state chart on a basis of the relevance calculated by the relevance calculation unit; an offset setting unit for setting an offset indicating a position of each of the pieces of data binarized in a case where the binarized pieces of data are arranged in the array calculated; and integrating the pieces of data each of which has been binarized and for each of which the corresponding offset has been set in the array calculated to obtain the binary data.
According to the present invention, by calculating an array of pieces of data on the basis of relevance between the pieces of data constituting a state chart and generating binary data in which a corresponding offset has been set for each of the pieces of data, the state chart can be executed at high speed on the basis of this binary data.
Hereinafter, in order to describe the present invention in more detail, an embodiment for carrying out the present invention will be described with reference to the attached drawings.
The state chart execution device 101 is connected to an external apparatus 102. The external apparatus 102 is, for example, an in-vehicle device such as a car navigation system and includes a user interface device such as a touch panel, voice recognition, or space gesture recognition. The external apparatus 102 receives a user's instruction using the user interface device and transmits the instruction to the state chart execution device 101 as event information. In addition, the external apparatus 102 receives a command from the state chart execution device 101 and operates in accordance with the command.
In step ST1, the state chart information reading unit 11 reads state chart information 103 and generates data constituting a state chart.
Here, the state chart information 103 includes information such as a state and state transition constituting a state chart. In addition, the state chart information 103 may include additional information at the time of design, such as a usage frequency of each piece of data constituting a state chart, priority of state transition intentionally set by a designer, and design history. The state chart information 103 is created by a designer and is a data file of a state chart executed by the external apparatus 102.
Note that the state chart is synonymous with a state transition diagram and a state machine diagram.
Hereinafter, the first embodiment will be described by exemplifying the state chart information 103 described in the SCXML format, but the description format is not limited thereto.
Data constituting a state chart is defined as information of each element, such as an initial state, a state, state transition, a parallel state, or history, described in the state chart information 103 and constituting the state chart.
For example, transition data in SCXML is defined to refer to information of an attribute and a child element, described in a <transition> tag. In the example of SCXML illustrated in
Transition data 1
For example, state data in SCXML is defined to refer to information of an attribute and a child element, described in a <state> tag. In the SCXML example illustrated in
State data 1
In step ST2, the relevance calculation unit 12 calculates relevance between pieces of data constituting a state chart on the basis of the state chart information 103 read by the state chart information reading unit 11.
Here, the relevance is defined. When two pieces of data are highly likely to be accessed closely in time at the time of execution of a state chart, the relevance between the pieces of data is assumed to be high. On the contrary, when two pieces of data are highly likely to be accessed remotely in time, the relevance between the pieces of data is defined to be low.
In the first embodiment, relevance calculation methods (1) to (5) are exemplified.
Relevance calculation method (1): relevance calculation based on rule
The relevance calculation unit 12 calculates relevance between pieces of data constituting a state chart on the basis of the following rules (1) to (6).
Rule (1): Relevance between transition data and state data of a transition destination is set to 1.
Rule (2): Relevance between pieces of data having a parent-child relationship is set to 3.
Rule (3): Relevance between pieces of state data in a parallel state is set to 2.
Rule (4): Relevance between self-transitioning state data and transition data is set to 4.
Rule (5): Relevance between pieces of data that do not fall under rules (1) to (4) is set to 0.
Rule (6): Relevance between an initial state and transition destination data of the initial state is set to 1.
The relevance in the above rules is an integer value of 0 to 4, but is not limited thereto, and may be a real value appropriately set by a user.
A table of relevance illustrated in
Another example of the state chart will be illustrated.
From the state chart illustrated in
Hereinafter, for description, for example, state data having a state name st will be referred to as “state data st”, and transition data having an event name ev will be referred to as “transition data ev”.
Relevance calculation method (2): relevance calculation based on usage frequency
The relevance calculation unit 12 may calculate relevance between pieces of data using information on a usage frequency related to each transition state.
For example, it is assumed that voice dialogue for an in-vehicle device such as a car navigation system is designed with a state chart and user's questions are designed and classified into the following three types.
Classification (1): user's simple and short command or a question which a car navigation system can answer with “Yes” or “No”.
Question examples: “Start a car navigation system”, “End navigation”, “Turn to the right here?”, and “Is there a roadside station nearby?”
Classification (2): a question to which a car navigation system is expected to return a complicated and long answer
Question example: “What is a recommended restaurant? I want to eat ramen or curry now.”
Classification (3): Error processing
Example: Processing at the time of rare occurrence of an error such as failure in starting a voice recognition device
On the basis of the above classifications (1) to (3), for example, a processing flow of voice dialogue in the state chart of
Here, it is assumed that information that classification (1) is frequently used, classification (2) is moderately used, and classification (3) rarely occurs is obtained in advance. The information on the usage frequency may be set manually by a user or may be determined from a tendency of a large amount of dialogue data by the relevance calculation unit 12.
The relevance calculation unit 12 determines relevance between pieces of data as described below on the basis of the information on the usage frequency.
The relevance calculation unit 12 calculates relevance between pieces of data other than the above data on the basis of the rules, and obtains a table of relevance illustrated in
Relevance calculation method (3): relevance calculation based on the degree of guidance
There is a case in which an in-vehicle device such as a car navigation system desirably guides user's actions when teaching the user how to use the device, a route, or the like. In this case, relevance between pieces of data related to a state transition having a highly degree of desire for guidance (hereinafter referred to as “degree of guidance”) may be relatively increased.
For example, a case is considered in which a car navigation system searches for a nearby restaurant by voice dialogue with a user, obtains the following three types of search results on the basis of fuel consumption cost, and presents the three types of search results to the user as options.
Option (1) Restaurant A: fuel consumption cost 1 associated with travel from current position
Option (2) Restaurant B: fuel consumption cost 5 associated with travel from current position
Option (3) Restaurant C: fuel consumption cost 10 associated with travel from current position
On the basis of the above options (1) to (3), for example, a processing flow of voice dialogue in a case where the flow is applied to the state chart of
The relevance calculation unit 12 determines relevance between pieces of data as described below on the basis of the degree of guidance.
Relevance calculation method (4): relevance calculation based on modification date and time of state chart
The relevance calculation unit 12 may calculate relevance between pieces of data on the basis of modification date and time of a state chart at the time of design. For example, since most recently modified data is considered to be an important processing flow in a final design stage, the relevance thereof is set to a higher value than other data.
The state chart illustrated in
Relevance calculation method (5): relevance calculation based on modification frequency of state chart
The relevance calculation unit 12 may calculate relevance between pieces of data on the basis of a modification frequency of a state chart at the time of design.
In the example of
The relevance calculation unit 12 may calculate the relevance using any one of relevance calculation methods (1) to (5), or may calculate the relevance by combining two or more of the methods.
In step ST3, the individual data binarization unit 13 binarizes each piece of data generated by the state chart information reading unit 11. In addition, the individual data binarization unit 13 determines the size of each piece of the binarized data.
Here, a case where the state chart information 103 is described in the SCXML format illustrated in
In the state chart information 103, information of initial state data st1 is described in the portion illustrated in
(1) Offset to state data with id=“st1”
The offset is a starting position of corresponding data in binary data 104 generated in later step ST6. Here, the offset is an integer value, and the data size is assumed to be 4 bytes. For this reason, the data size of the binarized header data is 4 bytes.
Since a value is substituted for the offset of the above (1) in later step ST5, in step ST3, the individual data binarization unit 13 substitutes 0 as an integer value in a pseudo manner.
In the state chart information 103, information of transition data 1 is described in the portion illustrated in
(1) Character string representing “ev1” of event
(2) Offset to state data having id=“st2” as alternative to character string of target
Here, since it is assumed that the data size of one character is 2 bytes, the data size of the character string representing “ev1” in the above (1) is 6 bytes. The offset of the above (2) is an integer value of 4 bytes. Therefore, the total data size of binarized transition data 1 is 10 bytes.
In addition, since a value is substituted for the offset of the above (2) in later step ST5, in step ST3, the individual data binarization unit 13 substitutes 0 as an integer value in a pseudo manner.
In the state chart information 103, information of state data 1 is described in the portion illustrated in
(1) Character string representing “st1” of id
(2) Offset to transition data 1
As in transition data 1, since the data size of one character is also assumed to be 2 bytes in state data 1, the data size of the character string representing “st1” in the above (1) is 6 bytes. The offset of the above (2) is an integer value of 4 bytes. Therefore, the total data size of binarized state data 1 is 10 bytes.
In addition, since a value is substituted for the offset of the above (2) in later step ST5, in step ST3, the individual data binarization unit 13 substitutes 0 as an integer value in a pseudo manner.
The individual data binarization unit 13 also binarizes information of transition data 2 and state data 2 included in the state chart information 103 in a similar manner to the above.
Here, although the case where the transition information (<transition>) is included in a child element of the state information (<state>) has been described, in addition thereto, other information may be included as the state information. For example, in the case of SCXML, <onentry> and <onexit> that are child elements of the <state> tag are defined, and the individual data binarization unit 13 may binarize <onentry> and <onexit> appropriately. Similarly, in SCXML, a <script> tag which is a child element of the <transition> tag or the like may be binarized appropriately.
In step ST4, on the basis of the relevance between pieces of data calculated by the relevance calculation unit 12, the optimal array calculation unit 14 calculates a one-dimensional array of individual pieces of data so as to arrange pieces of data having high relevance as close as possible to each other, that is, an optimal permutation.
In the first embodiment, the optimal array calculation methods (1) to (3) are exemplified.
Optimal array calculation method (1): use of relevance between adjacent pieces of data
The optimal array calculation unit 14 calculates total relevance obtained by summing up relevance between adjacent pieces of data when individual pieces of data constituting a state chart are arranged in a one-dimensional array, and determines a permutation of data having maximum total relevance.
In a case where individual pieces of data are arranged in a one-dimensional array in accordance with permutation A, the total relevance is 1.
In a case where individual pieces of data are arranged in a one-dimensional array in accordance with permutation B, the total relevance is 8.
The optimal array calculation unit 14 selects permutation B having large total relevance. Although description is omitted, the optimal array calculation unit 14 enumerates all permutations that can be considered similarly or enumerates permutation candidates by stochastic sampling, calculates the total relevance thereof, and selects a permutation having maximum total relevance.
A calculation formula of the total relevance is an evaluation function for determining an optimal permutation of data.
Incidentally, in the example of
As a result, when individual one-dimensionally arranged pieces of data are expanded on a memory, related pieces of data are arranged close to each other, and therefore a cache hit ratio at the time of execution of a state chart is improved, and state transition processing can be performed at high speed. In addition, since only adjacent N relevance values are taken into consideration, the calculation amount can be suppressed in calculation of the total relevance.
Optimal array calculation method (2): use of distance and relevance between pieces of data
The optimal array calculation unit 14 may set an evaluation function so that the relevance between pieces of data decreases as a distance between the pieces of data increases, and may determine a permutation of data which maximizes the evaluation function.
An example of the evaluation function is illustrated below.
M: the number of pieces of data
E: set of permutations of pieces of data constituting state chart. The number of elements is M!.
s(i): i-th data constituting state chart
s(j): j-th data constituting state chart
r(i, j): relevance between s(j) and s(i)
d(e, i, j): distance between s(j) and s(i) when pieces of data are arranged one-dimensionally in accordance with permutation e∈E. That is, d(e, i, j) is an absolute value of a difference in offset (data starting position) between s(j) and s(i).
At this time, the optimum array calculation unit 14 sets an evaluation function as illustrated in the following formula (1). Then, the optimum array calculation unit 14 determines a permutation of data which maximizes the evaluation function, that is, an optimal data arrangement e, by using the following formula (2).
As a result, when individual one-dimensionally arranged piece of data are expanded on a memory, related pieces of data are arranged as close as possible to each other, and therefore a cache hit ratio at the time of execution of a state chart is improved, and state transition processing can be performed at high speed. In addition, since relevance between all the pieces of data is considered, it is expected that a more optimal permutation of data can be determined as compared with optimal array calculation method (1).
Optimal array calculation method (3): use of distance and relevance between pieces of data and a threshold value
The optimal array calculation unit 14 may sum up relevance between pieces of data that are separated by a distance equal to or more than a predetermined distance to take the total relevance as a cost function, and may determine a permutation of data minimizing the cost function. Here, the predetermined distance is defined as threshold value B1. For example, as threshold value B1, the block size or the line size of a cache memory of a central processing unit (CPU) is set. This makes it possible to determine a permutation of data reducing cache misses.
An example of the cost function is illustrated below.
Definition of variables
E: set of permutations of pieces of data constituting state chart
B1: the above threshold value
s(i): i-th data constituting state chart
s(j): j-th data constituting state chart
r(i, j): relevance between s(j) and s(i)
d(e, i, j): distance between s(j) and s(i) when pieces of data are arranged one-dimensionally in accordance with permutation e∈E.
X1(e): set of i and j satisfying d(e,i,j)>B1
At this time, the optimal array calculation unit 14 defines a cost function as illustrated in the following formula (3).
C(e)=Σi,j∈X1(e)r(i,j)*d(e,i,j) (3)
Alternatively, in a case where a CPU having cache memories of different block sizes is used, the optimal array calculation unit 14 may set a larger block size or line size as threshold value B2 and may define a cost function as illustrated in the following formula (4).
C(e)=αΣi,j∈X1(e)r(i,j)*d(e,i,j)+βΣi,j∈X2(e)r(i,j)*d(e,i,j) (4)
B2: threshold value satisfying B1<B2 (block size or the like of cache memory)
X2(e): set of i and j satisfying d(e,i,j)>B2
α, β: appropriate weighting factors
The optimum array calculation unit 14 determines a permutation of data which minimizes the cost function of the above formula (3) or (4), that is, an optimal data arrangement e, by using the following formula (5).
ê=argmine(C(e)) (5)
This makes it possible to minimize a pair of pieces of data that do not fit in the block size or the line size of a cache memory when individual one-dimensionally arranged piece of data is expanded on the memory. This makes it possible to reduce cache misses at the time of execution of a state chart and to perform state transition processing at high speed.
Incidentally, in a case where the evaluation function is maximized or the cost function is minimized, an increase in the number of pieces of data increases the amount of calculation and makes it difficult to determine an optimal solution of a permutation within a realistic time. Therefore, a quasi-optimal solution maximizing the evaluation function or minimizing the cost function may be determined.
The optimal array calculation unit 14 can use a probabilistic optimization method such as a genetic algorithm, as a method for determining a quasi-optimal solution. For example, the optimal array calculation unit 14 expresses a permutation of data constituting a state chart by the ordinal representation described on page 34 of the following literature, and determines a permutation maximizing the evaluation function indicated in optimal array calculation method (1) or (2) or a permutation minimizing at least one of the cost functions indicated in optimal array calculation method (3) by using a genetic algorithm.
Hitoshi Iba, “Fundamentals of Genetic Algorithms-Solving the Mystery of GA”, 1st Edition, Ohmsha, 1994, p. 34
In step ST5, the offset setting unit 15 determines an offset of each piece of data in a case where binarized pieces of data are arranged one-dimensionally in accordance with the permutation calculated by the optimal array calculation unit 14, and sets the corresponding offset in each piece of data. The offset is a starting position of corresponding data in the binary data 104.
The offset setting unit 15 arranges pieces of data constituting a state data in accordance with the order of permutation B. As a result, as illustrated in
The data size of the header data is 4 bytes, the data size of state data 1 is 10 bytes, the data size of transition data 1 is 10 bytes, the data size of state data 2 is 10 bytes, and the data size of transition data 2 is 10 bytes. Accordingly, the offset setting unit 15 calculates the offset of the header data as the 0th byte, the offset of state data 1 as the 5th byte, the offset of transition data 1 as the 15th byte, the offset of state data 2 as the 25th byte, and the offset of transition data 2 as the 35th byte.
Subsequently, the offset setting unit 15 resets each offset provisionally set to 0 in step ST3 to a corresponding calculated correct value. For example, the offset setting unit 15 sets 5, which is the offset of state data 1, as the offset of initial state data. The offset setting unit 15 sets 15 as the “offset of transition data 1” of state data 1. The offset setting unit 15 sets 25 as the “offset of state data 2” of transition data 1. Similarly, the offset setting unit 15 also sets a value as each of the offsets of state data 2 and transition data 2.
In
Therefore, in the following description, a method in which the offset setting unit 15 efficiently binarizes data by using offset array data and an index of the offset array data will be described.
The offset setting unit 15 additionally prepares offset array data and arranges pieces of data in the order of header data, the offset array data, state data 1, transition data 1, state data 2, and transition data 2.
In the offset array data, an index 0 corresponding to the offset of state data 1, an index 1 corresponding to the offset of transition data 1, an index 2 corresponding to the offset of state data 2, and an index 3 corresponding to the offset of transition data 2 are defied. Since one offset is an integer value of 4 bytes, the data size of the offset array data is 4 bytes×4=16 bytes. The offset setting unit 15 sets offset values to indexes 0 to 3 as described below.
Index 0: 21 (offset of state data 1)
Index 1: 31 (offset of transition data 1)
Index 2: 41 (offset of state data 2)
Index 3: 51 (offset of transition data 2)
Subsequently, for each of state data 1, transition data 1, state data 2, and transition data 2, the offset setting unit 15 specifies the corresponding index in the offset array data, as an alternative to the corresponding offset value.
For example, in
As described above, by using the offset array data, even in a case where the data size is changed, it is only necessary to change the offset array data. For example, in a case where the character string of state data 1 is changed from “st1” to “st1_new” to increase the number of characters, when one character is 2 bytes, the data size of state data 1 increases by 8 bytes. Therefore, in the offset array data, the offset setting unit 15 increases the offset of each of transition data 1, state data 1, and transition data 2 by 8 bytes, and changes the offset array data as follows.
Index 0: 21 (offset of state data 1)
Index 1: 39 (offset of transition data 1)
Index 2: 49 (offset of state data 2)
Index 3: 59 (offset of transition data 2)
As a result, the offset indicates a correct position of corresponding data. At this time, since the permutation of data has not been changed, it is unnecessary to change the index set for each piece of data. Therefore, it is unnecessary to rewrite the contents of each piece of data.
In step ST6, the binary data integration unit 16 integrates the pieces of data each of which has been binarized by the individual data binarization unit 13 and for each of which the offset or the offset array data has been set by the offset setting unit 15 in the array calculated by the optimal array calculation unit 14 to obtain the binary data 104, and stores the binary data 104. The binary data integration unit 16 may store the binary data 104 in a memory such as a random access memory (RAM), or may store the binary data 104 on a disk in a file format or the like.
Next, an operation of the state chart execution unit 20 will be described.
In step ST7, the binary data reading unit 21 reads the stored binary data 104. For example, in a case where the binary data 104 is stored as a binary file, the binary data reading unit 21 first secures a memory corresponding to the binary data size and stores all pieces of data constituting a state chart on the secured memory.
In step ST8, the communication unit 22 communicates with the external apparatus 102 and receives event information from the external apparatus 102. The event information indicates a character string indicating the name of an event and any data accompanying the event.
In step ST9, the state transition processing unit 23 executes state transition processing in accordance with the event character string and the accompanying data received by the communication unit 22, and the binary data 104 read by the binary data reading unit 21 in step ST7.
Here, an example of processing in steps ST7 to ST9 will be described with reference to
1. Initial Transition (Step ST7)
The binary data reading unit 21 first reads header data of the binary data 104 and accesses initial state data described in the header data. In the example of
2. Reception of Event “Ev1” (Step ST8)
Next, the communication unit 22 receives event information from the external apparatus 102. Here, it is assumed that, for example, the event character string “ev1” is received.
3. State Transition (Step ST9)
Next, the state transition processing unit 23 refers to the offset of transition data 1 of state data 1 and reads transition data 1 of the 15th byte. Since this transition data 1 includes the event name “ev1” and the event name “ev1” is the same as the previously received event character string “ev1”, the state transition processing unit 23 transits to state data 2 of a transition destination. Specifically, the state transition processing unit 23 accesses data of the 25th byte set as the offset of state data 2 of the transition destination. As a result, the state transition processing unit 23 transits to state “st2” described in state data 2.
Since the offset of the transition destination data is set to 25 bytes, when the state transition processing unit 23 makes a state transition, the state transition processing unit 23 can access next transition information without requiring search processing.
Meanwhile, when the event name of transition data 1 is not the same as the received event character string, the state transition processing unit 23 remains in state “st1”.
4. Reception of Event “Ev2” and Accompanying Data (Step ST8)
Next, the communication unit 22 receives the event character string “ev2” and data value 1==10 accompanying the event character string “ev2” from the external apparatus 102.
5. State Transition (Step ST9)
Next, the state transition processing unit 23 accesses transition data 2 and judges whether or not the event name “ev2” of transition data 2 is the same as the received event character string “ev2”. Here, since the event name of transition data 2 is the same as the received event character string, the state transition processing unit 23 proceeds to next guard condition judgement. When the event name of transition data 2 is not the same as the received event character string, the state transition processing unit 23 remains in state “st2”.
6. Guard Condition Judgement and Action Execution (Step ST9)
Next, the state transition processing unit 23 compares a guard condition character string described in transition data 2 with a guard condition character string of the accompanying data received from the external apparatus 102, and judges whether the guard condition character string is true or false. When the guard condition character string is true, the state transition processing unit 23 executes an action described in the action data and transitions to a next state. Here, since the received accompanying data is value 1==10, the guard condition character string described in
Meanwhile, when the guard condition character string is false, the state transition processing unit 23 remains in state “st2”.
In this manner, the state chart execution unit 20 repeats reception of an event character string in step ST8 and state transition processing in step ST9.
Next, an example of a hardware configuration of the state chart execution device 101 will be described.
Each of functions of the binary data generation unit 10 and the state chart execution unit 20 in the state chart execution device 101 is implemented by a processing circuit. That is, the state chart execution device 101 includes a processing circuit for converting the state chart information 103 on a state chart expressing state transition into the binary data 104 and executing processing of the state chart on the basis of the binary data 104. The processing circuit may be dedicated hardware as illustrated in
As illustrated in
The functions of the binary data generation unit 10 and the state chart execution unit 20 may be collectively implemented by the one processing circuit 1001 or may be implemented by a plurality of the processing circuits 1001.
As illustrated in
Here, the CPU 1005 may be, for example, a processing device, a computing device, a microprocessor, a microcomputer, or a system large-scale integration (LSI).
In addition, the CPU 1005 may include a plurality of cache memories such as a primary cache memory and a secondary cache memory. When implementing the function of the binary data reading unit 21, the CPU 1005 reads the binary data 104 and expands the binary data 104 on a cache memory.
To the memory 1006, for example, a nonvolatile or volatile semiconductor memory such as RAM, read only memory (ROM), a flash memory, erasable programmable ROM (EPROM), or electrically EPROM (EEPROM), a magnetic disk, a flexible disk, an optical disc, a compact disc, a mini disc, or a digital versatile disc (DVD) corresponds.
Note that some of the functions of the binary data generation unit 10 and the state chart execution unit 20 may be implemented by dedicated hardware, and some of the functions may be implemented by software or firmware. For example, the function of the state chart execution unit 20 can be implemented by the processing circuit 1001 as dedicated hardware, and the function of the binary data generation unit 10 can be implemented by reading out and executing a program stored in the memory 1006 by the CPU 1005.
The state chart information 103 input to the binary data generation unit 10 and the binary data 104 generated by the binary data generation unit 10 are stored in, for example, the HDD 1002. Note that this is only an example, and the state chart information 103 and the binary data 104 may bestoted in the memory 1006 such as a DVD.
The communication unit 22 in the state chart execution device 101 corresponds to an input interface device 1003 and an output interface device 1004. The input interface device 1003 receives information from the external apparatus 102. The output interface device 1004 transmits information to the external apparatus 102.
Like the state chart execution device 101, the external apparatus 102 may be dedicated hardware or a CPU for executing a program stored in a memory.
The processing circuit 1001 or the CPU 1005 constituting the state chart execution device 101 may implement not only the function of the state chart execution device 101 but also the function of the external apparatus 102. For example, a CPU of a car navigation system may implement each of the functions of the state chart execution device 101 and the external apparatus 102. Alternatively, for example, a CPU of a computer may implement the function of the binary data generation unit 10, and a CPU of a car navigation system may implement each of the functions of the state chart execution unit 20 and the external apparatus 102.
As described above, the state chart execution device 101 according to the first embodiment includes the binary data generation unit 10 for converting the state chart information 103 on a state chart expressing state transition into the binary data 104 and the state chart execution unit 20 for executing processing of the state chart on the basis of the binary data 104. The binary data generation unit 10 includes: the state chart information reading unit 11 for reading the state chart information 103 and generating pieces of data constituting the state chart; the relevance calculation unit 12 for calculating relevance between the pieces of data constituting the state chart; the individual data binarization unit 13 for binarizing the pieces of data constituting the state chart; the optimal array calculation unit 14 for calculating an array of the pieces of data constituting the state chart on the basis of the relevance calculated by the relevance calculation unit 12; the offset setting unit 15 for setting an offset indicating a position of each of the pieces of data binarized by the individual data binarization unit 13 in a case where the binarized pieces of data are arranged in the array calculated by the optimal array calculation unit 14; and the binary data integration unit 16 for integrating the pieces of data each of which has been binarized by the individual data binarization unit 13 and for each of which the offset has been set by the offset setting unit 15 in the array calculated by the optimal array calculation unit 14 to obtain the binary data 104. This makes it possible to obtain the binary data 104 in which the data structure of a state chart is optimized. The state chart execution unit 20 can execute a state chart at high speed on the basis of the binary data 104.
Specifically, the optimal array calculation unit 14 calculates an array so as to arrange pieces of data having high relevance close to each other on the basis of the relevance calculated by the relevance calculation unit 12.
The optimal array calculation unit 14 determines a permutation of data so as to optimize the evaluation function or the cost function, and it is thereby possible to arrange pieces of data having high relevance close to each other on a memory. As a result, when the state chart execution unit 20 executes a state chart, improvement in a cache hit ratio of the CPU and reduction in cache misses are expected, and therefore the processing of the state chart is expected to be performed at high speed.
In addition, the binary data generation unit 10 binarizes the state chart information 103, and the binary data 104 is arranged in a continuous memory area to cause no memory fragmentation. As a result, performance of memory allocation processing by the binary data reading unit 21 at high speed and improvement in a cache hit ratio at the time of execution of a state chart by the state transition processing unit 23 are expected.
The offset setting unit 15 sets an offset for each of pieces of data constituting a state chart. The state chart execution unit 20 includes: the binary data reading unit 21 for reading the binary data 104; the communication unit 22 for receiving event information from the external apparatus 102; and the state transition processing unit 23 for accessing data at a position indicated by the offset set in the binary data 104 when executing state transition processing of the state chart in accordance with the event information received by the communication unit 22.
By the data access using the offset, the state transition processing unit 23 can directly access state data of a transition destination when executing state transition processing. For this reason, processing of searching for state data with a character string of a state name does not occur, and it is possible to perform the state transition processing at high speed.
The binary data generation unit 10 can also calculate relevance between pieces of data constituting not only a state chart in table expression but also a state chart having a hierarchical state or a parallel state, and convert the relevance into a one-dimensional array to obtain the binary data 104.
Note that any component in the embodiment can be modified, or any component in the embodiment can be omitted within the scope of the present invention.
Since the state chart execution device according to the present invention executes a state chart at high speed, the state chart execution device is suitable for a state chart execution device used for an external apparatus including a user interface device such as a touch panel, voice recognition, or space gesture recognition.
10: Binary data generation unit, 11: State chart information reading unit, 12: Relevance calculation unit, 13: Individual data binarization unit, 14: Optimal array calculation unit, 15: Offset setting unit, 16: Binary data integration unit, 20: State chart execution unit, 21: Binary data reading unit, 22: Communication unit, 23: State transition processing unit, 101: State chart execution device, 102: External apparatus, 103: State chart information, 104: Binary data, 1001: Processing circuit, 1002: HDD, 1003: Input interface device, 1004: Output interface device, 1005: CPU, 1006: Memory
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/JP2016/082430 | 11/1/2016 | WO | 00 |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2018/083729 | 5/11/2018 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
8244545 | Paek et al. | Aug 2012 | B2 |
10235140 | Avadhanula | Mar 2019 | B2 |
20070233497 | Paek et al. | Oct 2007 | A1 |
20130138593 | Miller et al. | May 2013 | A1 |
Number | Date | Country |
---|---|---|
11-24907 | Jan 1999 | JP |
Entry |
---|
Sunitha E. V. and Philip Samuel, Automatic Code Generation From UML State Chart Diagrams, IEEE, 2019, retrieved online on Jan. 29, 2022, pp. 8591-8608. Retrieved from Internet <URL: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8600324>. (Year: 2018). |
“State Chart XML (SCXML): State Machine Notation for Control Abstraction”, W3C Recommendation Sep. 1, 2015, [Online], World Wide Web Consortium, Internet <URL: https://www.w3.org/TR/scxml/>, total 42 pages. |
“Unified Modeling Language (UML) Version 2.5”, Mar. 2015, [Online], Object Management Group, Internet <URL: http://www.omg.org/spec/UML/2.5/>, total 794 pages. |
Iba, “Fundamentals of Genetic Algorithms—Solving the Mystery of GA”, 1st Edition, Ohmsha, 1994, p. 32-34. |
Gorniak et al., “Probabilistic Grounding of Situated Speech using Plan Recognition and Reference Resolution,” ICMI '05 Proceedings of the 7th international conference on Multimodal interfaces, Trento, Italy, Oct. 4-6, 2005, 6 pages. |
Number | Date | Country | |
---|---|---|---|
20210286630 A1 | Sep 2021 | US |