Patent Description:
With development of artificial intelligence technologies, various intelligent devices are widely applied. For example, an intelligent device may be a robot that may call, once finding a person falling on the ground, the person's family member.

Currently, a robot may execute various types of tasks, for example, execute an image processing task, a speech recognition task, and a task of dialing a phone number. Specific processing of executing a task by the robot may be: The robot may pre-store a correspondence between triggering information and a task, the robot may detect different triggering information by using various components (for example, a photographing component and a voice obtaining component), and each time when the robot detects triggering information by using a component, the robot may determine, based on the pre-stored correspondence between triggering information and a task, a task corresponding to the triggering information, and then may execute the task. For example, when the robot detects, by using the photographing component, triggering information "A person falls on the ground", the robot may execute the task of dialing a phone number.

<CIT> discloses a mobile robotic apparatus configured with an adaptive controller and a sensor component. The sensor component is characterized by an aperture/field of view and provides information associated with objects within the field-of-view. <CIT> discloses an intelligent response method of user equipment and the user equipment. The intelligent response method of the user equipment comprises the steps of detecting current vital sign information of a user; and obtaining a current user state corresponding to the user according to the vital sign information and making a corresponding response according to the user state and a default rule. <CIT> discloses an artificial intelligence system integrating light, machinery, electricity, and information and formed by a hardware system and a software program. The modules of the hardware system is distributed or embedded into the main body or the surface of the limbs of the robot body or inside the robot body according to the design and the specific functions. The software program corresponding to the specific function of the robot operates in the hardware system.

In a process of implementing this application, the inventor finds that the prior art has at least the following problem:.

In many cases, triggering information detected by using different components may correspond to a same task. For example, when a person falls on the ground, the robot may detect triggering information "A person falls on the ground" by using the photographing component, or may detect triggering information "A person falls on the ground" by using the voice obtaining component. In this case, the triggering information detected by the two components corresponds to a same event (a person falls on the ground), that is, correspond to a same task. Based on the manner in which the robot executes a task, in this case, the robot may execute the corresponding task twice for the same event corresponding to the two pieces of triggering information, leading to resource waste.

To resolve a problem of resource waste, implementations of this application provide a method and an apparatus for executing a task by an intelligent device. The technical solutions are as follows:.

According to a first aspect, a method for executing a task by an intelligent device is provided. The method includes: determining, based on at least one piece of triggering information when an intelligent device detects the at least one piece of triggering information, at least one to-be-processed event triggered by the at least one piece of triggering information, where the at least one to-be-processed event is different from each other, the triggering information is outside information detected by the intelligent device by using a sensor, and the event is an event that happens outside and that is determinable for the intelligent device when the intelligent device detects the triggering information; selecting, for each determined event and from at least one task corresponding to the event, a target task corresponding to the event, where the task is a processing manner available to the intelligent device for the event that happens outside; and executing the target task corresponding to each event.

In the solution in this implementation of this application, each time when the intelligent device detects the at least one piece of triggering information, the intelligent device may combine all detected triggering information to determine the at least one to-be-processed event that is different from each other and that is triggered by all the triggering information. Triggering information detected by a robot is not in one-to-one correspondence with an event, and different triggering information may trigger a same event. The detected at least one piece of triggering information may be detected at the same time, or may be detected within relatively short preset duration. After the triggered event is determined, the target task corresponding to each event may be determined, so that the intelligent device can execute the target task corresponding to each event. In this way, the robot combines the detected triggering information to determine events that are different from each other, so as to prevent a corresponding task from being executed twice for a same event corresponding to different triggering information, thereby preventing resource waste.

The determining, based on at least one piece of triggering information when an intelligent device detects the at least one piece of triggering information, at least one to-be-processed event triggered by the at least one piece of triggering information includes: determining, when the intelligent device detects the at least one piece of triggering information, a to-be-processed event triggered by each piece of detected triggering information; and performing deduplication processing on all determined events, to obtain the at least one to-be-processed event triggered by the at least one piece of triggering information.

In the solution in this implementation of this application, when the intelligent device detects the at least one piece of triggering information, for each piece of triggering information, the intelligent device may determine the event triggered by the triggering information, and then may delete a repeated event of the events triggered by the triggering information, and determine, as the at least one to-be-processed event triggered by the at least one piece of triggering information, remaining events that are different from each other of the events triggered by the triggering information. The determining, when the intelligent device detects the at least one piece of triggering information, an event triggered by each piece of detected triggering information includes: when the intelligent device detects the at least one piece of triggering information, classifying each piece of detected triggering information based on a pre-trained classification model and each event in an event set, and determining the event corresponding to each piece of triggering information.

In the solution in this implementation of this application, each time when the intelligent device detects the at least one piece of triggering information, the intelligent device may use each of the at least one piece of triggering information as an input of a neural network algorithm (a classifier), classify each piece of triggering information by using the neural network algorithm (that is, by using a training network), and determine a category corresponding to the triggering information (that is, determine the event triggered by the triggering information). Each category in the neural network algorithm may be each event in a set of events that can be recognized by the robot, as shown in <FIG>. After the category of each piece of triggering information is determined, a repeated event may be deleted, to obtain the event triggered by the at least one piece of triggering information.

In a possible implementation, the selecting, for each determined event and from at least one task corresponding to the event, a target task corresponding to the event includes: for each determined event, selecting, from the at least one task corresponding to the event and based on a selection probability of each of the at least one task corresponding to the event, the target task corresponding to the event.

In the solution in this implementation of this application, after determining the at least one triggered event, for each of the at least one event, the intelligent device may determine, based on a correspondence between an event, a task, and a selection probability, the at least one task corresponding to the event, and then may randomly select, from a plurality of tasks and based on the selection probability corresponding to each determined task, the target task corresponding to the event. The selection probability represents a possibility that a corresponding task is selected.

In a possible implementation, the method further includes: when a satisfaction degree value entered for execution of a first task of a target task corresponding to a first event is received, adjusting, based on the entered satisfaction degree value, a selection probability of the first task corresponding to the first event.

In the solution in this implementation of this application, a human-computer interaction interface (a visible graphical interface and a touch manner) may be disposed on the intelligent device, and a user may make manual intervention by using the human-computer interaction interface. Specifically, each time after the intelligent device executes the target task corresponding to the triggered event (which may be referred to as the first event), that is, after the intelligent device executes a target task corresponding to an event or when the intelligent device executes a target task corresponding to an event, the user may enter, based on a satisfaction degree of the user, a satisfaction degree value for current execution of the first task of the target task corresponding to the event, and the intelligent device may receive the satisfaction degree value (which may be represented by s, and s may be a value greater than <NUM> and less than <NUM>) that is entered by the user for execution of the first task corresponding to the first event by the intelligent device. In this case, the intelligent device may adjust the selection probability of the first task corresponding to the first event. In addition, the intelligent device may further adjust a selection probability of an event other than the first event of all events corresponding to the first task. In this way, when the user expects the device to process an event in a processing manner, the user may enter a relatively high satisfaction degree value for a target task executed by the intelligent device, so that the intelligent device can increase a selection probability of the target task corresponding to the event, and the intelligent device keeps adapting to a habit of the user.

In a possible implementation, the method further includes: determining, based on pre-stored importance and urgency that are corresponding to each event in the event set, importance and urgency that are corresponding to each of the at least one event; and determining, for each event, a priority of the event based on the determined importance and urgency that are corresponding to the event, where the executing the target task corresponding to each event includes: executing, based on the priority of each event in descending order of priorities, the target task corresponding to each event.

In the solution in this implementation of this application, the intelligent device may pre-store the importance and urgency that are corresponding to each event in the event set. After determining the at least one triggered event, the intelligent device may determine, from the pre-stored importance and urgency that are corresponding to events in the event set, the importance and urgency that are corresponding to each of the at least one event, and then may determine, for each event, the priority of the event based on the determined importance and urgency that are corresponding to the event. For example, a sum of the importance and urgency that are corresponding to the event may be calculated, and the calculated sum may be used as the priority of the event. After determining the priority of each event, the intelligent device may execute, in descending order of priorities, the target task corresponding to each event. In this way, when a plurality of events need to be processed, the intelligent device may preferentially process a more important and urgent event.

In a possible implementation, the determining, for each event, a priority of the event based on the determined importance and urgency that are corresponding to the event includes: for each event, obtaining an actual cost and an expected cost of previous execution of a task corresponding to the event; determining, based on the actual cost and the expected cost of the previous execution of the task corresponding to the event, an expected cost required for current execution of the target task corresponding to the event; and determining the priority of the event based on the determined importance and urgency that are corresponding to the event and the determined expected cost required for the current execution of the target task corresponding to the event.

In the solution in this implementation of this application, each time after the intelligent device executes a task corresponding to each event in the event set, that is, each time after the intelligent device processes the event, the intelligent device may record an actual cost of current execution of the task corresponding to the event. The actual cost may be energy (for example, electric power or central processing unit usage) or time consumed for executing the task corresponding to the event, or may be a combination of energy and time. After determining at least one currently-triggered event, the intelligent device may obtain, for each event, the actual cost and the expected cost of the previous execution of the task corresponding to the event, and then may determine the expected cost required for the current execution of the target task corresponding to the event. After obtaining the expected cost and corresponding importance and urgency, the robot may determine the priority of the event.

In a possible implementation, the determining, based on pre-stored importance and urgency that are corresponding to each event in the event set, importance and urgency that are corresponding to each of the at least one event includes: determining, based on a pre-stored importance-urgency matrix and an event corresponding to each position in the importance-urgency matrix, the importance and urgency that are corresponding to each of the at least one event, where each position in the importance-urgency matrix represents importance and urgency of the event corresponding to the position.

In the solution in this implementation of this application, the intelligent device may pre-store the importance-urgency matrix. Positions in the importance-urgency matrix correspond to different events, each position represents the importance and urgency of the event corresponding to the position, and the matrix may be referred to as an Eisenhower Decision Matrix (Eisenhower Decision Matrix, EDM). After determining the at least one event, the intelligent device may determine, from the importance-urgency matrix, importance and urgency that are corresponding to a position of each of the at least one event in the importance-urgency matrix.

In a possible implementation, the method further includes: for each event in the event set, determining, based on pre-stored corresponding probabilities of the event in positions in the importance-urgency matrix, a position corresponding to a largest probability as a position corresponding to the event.

In the solution in this implementation of this application, the intelligent device may preset the corresponding probabilities of each event in the positions in the importance-urgency matrix. The probability may be a value having a preset quantity of digits, and a sum of the corresponding probabilities of each event in the positions in the importance-urgency matrix is <NUM>. For each event in the event set, when determining the position of each event in the importance-urgency matrix, the intelligent device may determine the largest probability from the corresponding probabilities of the event in the positions in the importance-urgency matrix, and then may determine the position corresponding to the largest probability as the corresponding position of the event in the importance-urgency matrix.

In a possible implementation, the method further includes: when an instruction for adjusting a position corresponding to a second event from a first position to a second position is received, obtaining an excitation factor corresponding to each position in the importance-urgency matrix for the adjustment instruction, where an excitation factor corresponding to the second position is largest, and an excitation factor corresponding to the first position is smallest; calculating, based on the obtained excitation factor corresponding to each position in the importance-urgency matrix and corresponding probabilities of the second event in the positions in the importance-urgency matrix, new corresponding probabilities of the second event in the positions in the importance-urgency matrix; and determining, based on the new corresponding probabilities of the second event in the positions in the importance-urgency matrix, the second position corresponding to a new largest probability as the position corresponding to the event.

In the solution in this implementation of this application, the intelligent device may pre-store the excitation factor Kij corresponding to each position in the importance-urgency matrix. For different adjustment instructions, excitation factors corresponding to each position in the importance-urgency matrix are different. For an event whose position is adjusted, an excitation factor corresponding to a position after adjustment is largest, an excitation factor corresponding to a position before adjustment is smallest, and an excitation factor corresponding to another position is between the largest and the smallest. When the user adjusts the position corresponding to the second event from the first position to the second position, the intelligent device may receive the instruction for adjusting the position corresponding to the second event from the first position to the second position. In this case, the intelligent device may obtain the excitation factor corresponding to each position in the importance-urgency matrix for the adjustment instruction, and then may adjust, by using the excitation factor corresponding to each position, a corresponding probability of the second event in each position in the importance-urgency matrix, to obtain the new corresponding probabilities of the second event in the positions in the importance-urgency matrix (that is, obtain the corresponding probabilities of the second event in the positions in the importance-urgency matrix after position adjustment). After obtaining the new corresponding probabilities of the second event in the positions in the importance-urgency matrix, the intelligent device may determine, based on the new corresponding probabilities of the second event in the positions in the importance-urgency matrix, the second position corresponding to the new largest probability as the position corresponding to the event.

In a possible implementation, the method further includes: when an instruction for adjusting a position corresponding to a second event from a first position to a second position is received, determining a corresponding probability of the second event in the first position in the importance-urgency matrix as a new corresponding probability of the second event in the second position, and determining a corresponding probability of the second event in the second position in the importance-urgency matrix as a new corresponding probability of the second event in the first position; and determining, based on new corresponding probabilities of the second event in the positions in the importance-urgency matrix, the second position corresponding to a new largest probability as the position corresponding to the event.

In the solution in this implementation of this application, when receiving the instruction for adjusting the position corresponding to the second event from the first position to the second position, the intelligent device may adjust only the corresponding probabilities of the second event in the first position and the second position, and does not adjust probabilities corresponding to the other positions. Specifically, when the instruction for adjusting the position corresponding to the second event from the first position to the second position is received, the corresponding probability of the second event in the first position in the importance-urgency matrix may be determined as the new corresponding probability of the second event in the second position, and the corresponding probability of the second event in the second position in the importance-urgency matrix may be determined as the new corresponding probability of the second event in the first position. In other words, the intelligent device may interchange the probability of the second event in the first position and the probability of the second event in the second position before adjustment, and determine the interchanged probabilities as the new corresponding probability of the second event in the first position after adjustment and the new corresponding probability of the second event in the second position after adjustment. New probabilities of the second event in the other positions after adjustment are the same as the probabilities of the second event in the other positions before adjustment. After the new corresponding probabilities of the second event in the positions in the importance-urgency matrix are obtained, the second position corresponding to the new largest probability may be determined as the position corresponding to the event.

In a possible implementation, the method further includes: when the second event is a to-be-processed event, re-determining, based on importance and urgency that are corresponding to the second position in the importance-urgency matrix, a priority corresponding to the second event.

In the solution in this implementation of this application, as described above, after the at least one triggered event and the target task corresponding to each event are determined, the target task corresponding to each of the at least one event may be added to a current task queue, and after the target task is executed, the target task may be deleted from the current task queue. Based on this case, when a target task corresponding to the second event is in the current task queue, the second event may be determined as a to-be-processed event. In other words, the to-be-processed event may include an event being processed. In addition, the to-be-processed event may alternatively not include an event being processed.

When the second event is a to-be-processed event, the intelligent device may re-calculate, based on the foregoing method for determining a priority of an event, the priority corresponding to the second event. Further, the intelligent device may execute, based on the re-calculated priority, the target task corresponding to the second event. For a case in which the to-be-processed event includes an event being processed, when the re-calculated priority is decreased, execution of the target task corresponding to the event may be suspended, and a target task corresponding to an event having a higher priority is executed.

According to a second aspect, an apparatus for executing a task by an intelligent device is provided. The apparatus includes at least one module, and the at least one module is configured to implement the method for executing a task by an intelligent device in the first aspect.

According to a third aspect, an intelligent device is provided. The intelligent device includes a processor, a memory, and a sensor. The processor is configured to execute an instruction stored in the memory, and the processor implements, by executing the instruction, the method for executing a task by an intelligent device in the first aspect.

According to a fourth aspect, a computer readable storage medium is provided. The computer readable storage medium stores at least one instruction, at least one segment of program, a code set, or an instruction set. The at least one instruction, the at least one segment of program, the code set, or the instruction set is loaded and executed by a processor, to implement the method for executing a task by an intelligent device in the first aspect or any possible implementation of the first aspect.

Technical effects obtained in the second to the fourth aspects of the implementations of this application are similar to the technical effects obtained by using the technical means corresponding to the first aspect, and details are not described herein again.

Beneficial effects of the technical solutions provided in the implementations of this application are as follows:.

In the implementations of this application, when the at least one piece of triggering information is detected, the at least one to-be-processed event corresponding to the at least one piece of triggering information is determined based on the at least one piece of triggering information, where the determined at least one event is different from each other. For each of the determined at least one event, the target task corresponding to the event is selected from the at least one task corresponding to the event. The target task corresponding to each event is executed. In this way, the robot combines the detected triggering information to determine events that are different from each other, so as to prevent a corresponding task from being executed twice for a same event corresponding to different triggering information, thereby preventing resource waste.

Implementations of this application provide a method for executing a task by an intelligent device. The method is performed by an intelligent device that can execute various types of tasks. The intelligent device may be a robot that can execute various types of tasks. The solutions are described in detail subsequently by using an example in which the intelligent device is a robot. Other cases are similar thereto, and are not described.

The intelligent device may include a processor <NUM> and a memory <NUM>, and the processor <NUM> may be connected to the memory <NUM>, as shown in <FIG>. The processor <NUM> may include one or more processing units. The processor <NUM> may be a general purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), or the like, or may be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), another programmable logic device, or the like. Specifically, a program may include program code, and the program code includes a computer operation instruction. The intelligent device may further include the memory <NUM>. The memory <NUM> may be configured to store a software program and a module, and the processor <NUM> reads the software program and the module that are stored in the memory <NUM>, to execute a task. In addition, the intelligent device may further include a receiver <NUM> and a transmitter <NUM>. The receiver <NUM> and the transmitter <NUM> may be separately connected to the processor <NUM>, and the transmitter <NUM> and the receiver <NUM> may be collectively referred to as a transceiver. The transmitter <NUM> may be configured to send a message or data. The transmitter <NUM> may include but is not limited to at least one amplifier, a tuner, one or more oscillators, a coupler, an LNA (Low Noise Amplifier, low noise amplifier), a duplexer, and the like. In addition, the intelligent device may further include a sensor <NUM>. There may be a plurality of sensors <NUM>. The sensor <NUM> may be connected to the processor <NUM>. The sensor <NUM> may be configured to detect triggering information.

The following describes, in detail with reference to specific implementations, a processing procedure shown in <FIG>. Content may be as follows:
Step <NUM>. When at least one piece of triggering information is detected, determine, based on the at least one piece of triggering information, at least one to-be-processed event triggered by the at least one piece of triggering information, where the determined at least one event is different from each other.

The triggering information may be information that is detected by a robot and that is used to trigger the robot to determine an event, or may be outside information detected by using a sensor. The event may be an event that can be recognized by the robot. To be specific, the event is an event that happens outside and that can be determined by the robot when the robot detects the triggering information.

During implementation, various types of components (for example, a photographing component and a voice obtaining component) may be disposed on the robot, and the robot may detect the triggering information by using the various types of components. Each time when the robot detects the at least one piece of triggering information, the robot may combine all detected triggering information to determine the at least one to-be-processed event that is different from each other and that is triggered by all the triggering information. The triggering information detected by the robot is not in one-to-one correspondence with the event, and different triggering information may trigger a same event. The detected at least one piece of triggering information may be detected at the same time, or may be detected within relatively short preset duration. For example, when a person falls on the ground, the person may utter voice information. In this case, the voice obtaining component of the robot may detect the voice information, perform speech recognition on the voice information, and detect triggering information "A person falls on the ground". In addition, the photographing component of the robot may further take an image that a person falls on the ground, and therefore generate triggering information "A person falls on the ground". After detecting the two pieces of triggering information, the robot may combine the two pieces of triggering information to determine that a to-be-processed event triggered by the two pieces of triggering information is "A person falls on the ground".

Optionally, the determined at least one event may be a remaining event after a repeated event is deleted. Correspondingly, a processing procedure of step <NUM> may be as follows: when the robot detects the at least one piece of triggering information, determining an event triggered by each piece of detected triggering information; and performing deduplication processing on all determined events, to obtain the at least one to-be-processed event triggered by the at least one piece of triggering information.

Specifically, the robot may pre-store a correspondence between triggering information and an event, and when detecting the at least one piece of triggering information, may determine, based on the correspondence, the event corresponding to each piece of triggering information. When the determined events include same events, the robot may delete a repeated event, so that the eventually determined events are different from each other. In addition, when the determined events include an event in a to-be-processed event list, the event may be deleted. To be specific, when detecting the at least one piece of triggering information, the robot may determine, based on the at least one piece of triggering information and the event in the to-be-processed event list, the at least one to-be-processed event triggered by the at least one piece of the triggering information. The determined at least one event is different from each other.

Optionally, the robot may determine, by using a classification model, the event triggered by each piece of triggering information. Correspondingly, a processing procedure may be as follows: when the intelligent device detects the at least one piece of triggering information, classifying each piece of detected triggering information based on a pre-trained classification model and each event in an event set, and determining the event corresponding to each piece of triggering information.

During implementation, when the at least one piece of triggering information is detected, the at least one event that is different from each other and that is triggered by the at least one piece of triggering information may be obtained by using the pre-trained classification model (for example, a neural network algorithm). The neural network algorithm may include a visible input neuron, one or more layers of hidden neurons, and a visible output neuron. Each visible input neuron may be a plurality of pieces of detected triggering information. The visible output neuron may be a triggered event. Connection between neurons is wireless mesh (mesh) interconnection, and may be specifically implemented by using a hidden Markov model (HMM) network or overlapping restricted Boltzmann machines (RBM).

In this implementation of this application, the neural network algorithm may serve as a classifier. In other words, each time when the robot detects the at least one piece of triggering information, the robot may use each of the at least one piece of triggering information as an input of the neural network algorithm (the classifier), classify each piece of triggering information by using the neural network algorithm (that is, by using a training network), and determine a category corresponding to the triggering information (that is, determine the event triggered by the triggering information). Each category in the neural network algorithm may be each event in a set of events that can be recognized by the robot, as shown in <FIG>. After the category of each piece of triggering information is determined, a repeated event may be deleted, to obtain the event triggered by the at least one piece of triggering information. In addition, an amount of triggering information that can be recognized by the robot is far greater than a quantity of recognizable events. For example, each time when the robot detects triggering information "Light off", "Turn the light off", or "Turn off the light", the robot may determine that the triggered event is "Turn off the light".

In addition, the robot may include a plurality of working agents and a central processing unit. The central processing unit may communicate with the working agents. Each agent may be a unit that can execute a task relatively independently, and usually has an independent sensor, an independent computing unit, and related software. For example, the robot may include a visual working agent, a voice working agent, a communications working agent, and the like. In this application, the triggering information detected by the robot may be a message sent by each working agent. The message may include a message generation time point, a working agent identifier, a message generation position, and a message body (the message body may be a phrase formed by characters). After generating the message, each agent may send the message to the central processing unit, so that the central processing unit performs processing of step <NUM>.

Step <NUM>. Select, for each determined event and from at least one task corresponding to the event, a target task corresponding to the event.

The target task may be a task selected when the event is processed this time.

During implementation, the robot may store at least one task corresponding to each event in the event set, and each event in the event set is an event that can be recognized by the robot. In other words, each event may correspond to one or more processing manners (tasks), and different events may correspond to a same task. After the at least one triggered event is determined, the at least one triggered event may be added to the to-be-processed event list. In addition, for each of the at least one event, the robot may determine, from the pre-stored at least one task corresponding to each event in the event set, the at least one task corresponding to the event, and then may determine, from the at least one corresponding task, the target task corresponding to the event. The at least one task may be a processing manner that can be used for processing the event. For example, for an event "A person falls on the ground", a corresponding task may be dialing a preset phone number, making a video call, or the like. Specifically, the robot may randomly determine, from the at least one corresponding task and based on a preset randomization algorithm, the target task corresponding to the event, that is, determine a processing manner used for processing the event this time, as shown in <FIG>. A processing procedure of the step may be specifically implemented by using a Markov decision network. The triggered event may be used as an input of the Markov decision network, and the target task corresponding to each event is an output of the Markov decision network. The Markov decision network generally includes two categories of neurons, namely, a status neuron (reflecting arrangement and an activation status of the event set) and an action neuron (the action neuron may be in full connection, or may be in mesh connection).

Optionally, each task corresponding to each event may correspond to a selection probability. Further, the robot selects, based on a selection probability, the task corresponding to the event. Correspondingly, a processing procedure of step <NUM> may be as follows: for each of the determined at least one event, selecting, from the at least one task corresponding to the event and based on the selection probability of each of the at least one task corresponding to the event, the target task corresponding to the event.

During implementation, in addition to the at least one task corresponding to each event in the event set, the robot may further store the selection probability corresponding to each task, that is, may store a correspondence between an event, a task, and a selection probability. Different events may correspond to a same task. When a same task corresponds to different events, corresponding selection probabilities may be the same or may be different, as shown in Table <NUM>. In addition, a sum of selection probabilities of all events corresponding to each task may further be <NUM>.

After determining the at least one triggered event, for each of the at least one event, the robot may determine, based on the correspondence, the at least one task corresponding to the event, and then may randomly select, from a plurality of tasks and based on the selection probability corresponding to each determined task, the target task corresponding to the event. The selection probability represents a possibility that a corresponding task is selected. For example, the at least one task corresponding to the event <NUM> is a task a and a task b, a selection probability corresponding to the task a is <NUM>, and a selection probability corresponding to the task b is <NUM>. Then, the robot may determine a target task in a manner of generating a random number from <NUM> to <NUM>. To be specific, when the generated random number is one of <NUM> to <NUM>, the task a may be determined as the target task, and when the generated random number is <NUM>, the task b may be determined as the target task.

In addition, when the event is triggered, if the determined target task definitely includes a task, a selection probability of the task corresponding to the event is <NUM>. To be specific, in this case, if the event is triggered, the target task that is determined by the robot and that corresponds to the event certainly includes the task. For example, a target task corresponding to an event "Hear a voice calling for help or an abnormal voice" may include "Move to a place" and "Make a video call with a family member", and the target task corresponding to the event "Find a person falling on the ground" may include "Recognize an identity" and "Make a video call with a family member", as shown in <FIG>.

Optionally, when using the robot, the user may adjust, through manual intervention, a selection probability of each task corresponding to an event. Correspondingly, a processing procedure may be as follows: when a satisfaction degree value entered for execution of a first task of a target task corresponding to a first event is received, adjusting, based on the entered satisfaction degree value, a selection probability of the first task corresponding to the first event.

The first event may be any one of events that have been processed by the robot.

During implementation, a human-computer interaction interface (a visible graphical interface and a touch manner) may be disposed on the robot, and a user may make manual intervention by using the human-computer interaction interface. Specifically, each time after the robot executes the target task corresponding to the triggered event (which may be referred to as the first event), that is, after the robot executes a target task corresponding to an event or when the robot executes a target task corresponding to an event, the user may enter, based on a satisfaction degree of the user, a satisfaction degree value for current execution of the first task of the target task corresponding to the event, and the robot may receive the satisfaction degree value (which may be represented by s, and s may be a value greater than <NUM> and less than <NUM>) that is entered by the user for execution of the first task corresponding to the first event by the robot. In this case, the robot may adjust the selection probability of the first task corresponding to the first event. In addition, the robot may further adjust a selection probability of an event other than the first event of all events corresponding to the first task. Specifically, after obtaining the satisfaction degree value s entered by the user, the robot may calculate, according to the formula (<NUM>), an excitation value ΔΩa of a selection probability of the first event (which may be represented by a) corresponding to the first task, calculate, according to the formula (<NUM>), a new selection probability of the first event a corresponding to the first task, and calculate, according to the formula (<NUM>), a new selection probability <MAT> of another event corresponding to the first task: <MAT> <MAT> <MAT> where i may be any integer between <NUM> and z, z is a quantity of all events corresponding to the first task, Ωa represents a selection probability of the event a corresponding to the first task before adjustment, and Ωi represents a selection probability of an event i corresponding to the first task before adjustment.

Step <NUM>. Execute the target task corresponding to each event.

During implementation, after determining the target task corresponding to each event, the robot may execute the target task corresponding to each event. The robot may include a plurality of functional modules, and each functional module may execute a task. To be specific, the robot may separately execute, by using the plurality of functional modules, each task in the target task corresponding to each event. In addition, after determining the target task corresponding to each event, the robot may add the target task of each event to a current task queue, and each time after a target task is executed, the robot may delete the target task from the current task queue, and delete an event corresponding to the target task from the to-be-processed event list. If the current task queue includes a target task that is determined previously and that corresponds to the event, adding a target task that is determined this time and that corresponds to the triggered event to the current task queue is equivalent to updating the current task queue. A list of all tasks that can be executed by the robot may include: system self-test, positioning, map construction, moving to a place, recognizing a family member, recognizing an identity, recognizing an object, recognizing a gesture, audio (voice or sound) understanding and synthesis, autonomous charging, searching for an object, fetching an object, sweeping the floor, making a video call with a person, and sending a short message service message to a person.

In addition, when the user uses the robot, a new functional module may be added to the robot (for example, corresponding hardware and a corresponding functional program may be added), and for a task that can be implemented by the newly added functional module, a corresponding selection probability may be set for a corresponding event. When using the robot, the user may further make manual intervention, so that the robot adjusts, based on the foregoing method, a selection probability that is of the task that can be implemented by the newly added functional module and that is corresponding to the corresponding event.

Optionally, after determining the at least one triggered event, the robot may determine a priority of processing each event. Correspondingly, a processing procedure may be as follows: determining, based on pre-stored importance and urgency that are corresponding to each event in the event set, importance and urgency that are corresponding to each of the at least one event; and determining, for each event, the priority of the event based on the determined importance and urgency that are corresponding to the event. Correspondingly, a processing procedure of step <NUM> may be as follows: executing, based on the priority of each event in descending order of priorities, the target task corresponding to each event.

During implementation, the robot may pre-store the importance and urgency that are corresponding to each event in the event set. After determining the at least one triggered event, the robot may determine, from the pre-stored importance and urgency that are corresponding to events in the event set, the importance and urgency that are corresponding to each of the at least one event, and then may determine, for each event, the priority of the event based on the determined importance and urgency that are corresponding to the event. For example, a sum of the importance and urgency that are corresponding to the event may be calculated, and the calculated sum may be used as the priority of the event. After determining the priority of each event, the robot may execute, in descending order of priorities, the target task corresponding to each event.

Optionally, during priority calculation, an expected cost of current execution of the target task corresponding to the event may be considered. Correspondingly, a processing procedure may be as follows: for each event, obtaining an actual cost and an expected cost of previous execution of a task corresponding to the event; determining, based on the actual cost and the expected cost of the previous execution of the task corresponding to the event, an expected cost required for current execution of the target task corresponding to the event; and determining the priority of the event based on the determined importance and urgency that are corresponding to the event and the determined expected cost required for the current execution of the target task corresponding to the event.

During implementation, each time after the robot executes a task corresponding to each event in the event set, that is, each time after the robot processes the event, the robot may record an actual cost of current execution of the task corresponding to the event, and calculate an expected cost required for next execution of a task corresponding to the event. The actual cost may be energy (for example, electric power or central processing unit usage) or time consumed for executing the task corresponding to the event, or may be a combination of energy and time.

An event a is used as an example to describe a processing procedure of determining a priority of the event a. The event a is any event in the event set. Specifically, the robot may preset an expected cost Ta,<NUM> = <NUM> of first processing of the event a, and the robot may calculate, according to the formula (<NUM>), an expected cost of each execution of a task corresponding to the event a, where i represents that the event a is processed for an ith time: <MAT> where Ta,i+<NUM> represents an expected cost required for (i+<NUM>)th-time processing of the event a, i is a positive integer greater than or equal to <NUM>, Ta,i represents an expected cost required for ith-time processing of the event a, p is a weighted value, and may be a value between <NUM> and <NUM> (for example, may be a value less than <NUM>), Δwa,i and Δta,i respectively represent energy and time actually consumed for the ith-time processing of the event a, and Δwa,i Δta,i represents an actual cost of the ith-time processing of the event a.

After an expected cost required for ith-time execution of the task corresponding to the event a is determined according to the formula (<NUM>), and importance (which may be represented by Φa) and urgency (which may be represented by Ψa) that correspond to the event a are obtained, when the event is triggered for the ith time, a priority Θa of current execution of the task corresponding to the event a may be calculated according to the formula (<NUM>): <MAT>.

After determining at least one currently-triggered event, for each event, the robot may obtain the actual cost and the expected cost of the previous execution of the task corresponding to the event, and then may determine, according to the formula (<NUM>), the expected cost required for the current execution of the target task corresponding to the event. After obtaining the expected cost and corresponding importance and urgency, the robot may determine the priority of the event according to the formula (<NUM>).

Optionally, the importance and urgency that are corresponding to each event in the event set may be obtained by using an importance-urgency matrix. Correspondingly, a processing procedure of determining the importance and urgency of each event may be as follows: determining, based on the pre-stored importance-urgency matrix and an event corresponding to each position in the importance-urgency matrix, the importance and urgency that are corresponding to each of the at least one event, where each position in the importance-urgency matrix represents importance and urgency of the event corresponding to the position.

During implementation, the robot may pre-store the importance-urgency matrix. Positions in the importance-urgency matrix correspond to different events, and each position represents the importance and urgency of the event corresponding to the position, as shown in <FIG>. The matrix may be referred to as an Eisenhower Decision Matrix (Eisenhower Decision Matrix, EDM). After determining the at least one event, the robot may determine, from the importance-urgency matrix, importance and urgency that are corresponding to a position of each of the at least one event in the importance-urgency matrix.

Optionally, the position of each event in the importance-urgency matrix is determined by using corresponding probabilities of the event in positions. Correspondingly, a processing procedure may be as follows: for each event in the event set, determining, based on pre-stored corresponding probabilities of the event in the positions in the importance-urgency matrix, a position corresponding to a largest probability as the position corresponding to the event.

During implementation, the robot may preset the corresponding probabilities of each event in the positions in the importance-urgency matrix. The probability may be a value having a preset quantity of digits, and a sum of the corresponding probabilities of each event in the positions in the importance-urgency matrix is <NUM>. For each event in the event set, when determining the position of each event in the importance-urgency matrix, the robot may determine the largest probability from the corresponding probabilities of the event in the positions in the importance-urgency matrix, and then may determine the position corresponding to the largest probability as the corresponding position of the event in the importance-urgency matrix.

Specifically, the importance-urgency matrix may be an m*n EDM, and a quantity of the events in the event set is m*n. For the event a, assuming that a probability of the event a in a position (i, j) in EDM is Pij(a) (i ∈[<NUM>,m),j ∈[<NUM>,n)), and a sum of corresponding probabilities of the event a in the positions in the importance-urgency matrix is <NUM>, a normalization condition is satisfied: <MAT>.

Assuming that an actual position of the event a in the importance-urgency matrix is (i',j'), a corresponding probability of the event a in the position is largest, and satisfies the following formula: <MAT>.

Optionally, the user may adjust, by using the human-machine interaction interface of the robot, the corresponding position of each event in the event set in the importance-urgency matrix. Each time when the user adjusts the corresponding position of the event in the importance-urgency matrix, the robot may correspondingly adjust the corresponding probabilities of the event in the positions in the importance-urgency matrix. Based on different probability adjustment methods, there may be a variety of specific processing manners, and several feasible processing manners are provided below.

Manner <NUM>: When an instruction for adjusting a position corresponding to a second event from a first position to a second position is received, an excitation factor corresponding to each position in the importance-urgency matrix for the adjustment instruction is obtained, where an excitation factor corresponding to the second position is largest, and an excitation factor corresponding to the first position is smallest. New corresponding probabilities of the second event in the positions in the importance-urgency matrix are calculated based on the obtained excitation factor corresponding to each position in the importance-urgency matrix and corresponding probabilities of the second event in the positions in the importance-urgency matrix. The second position corresponding to a new largest probability is determined as the position corresponding to the event based on the new corresponding probabilities of the second event in the positions in the importance-urgency matrix.

The second event may be any event in the event set.

During implementation, the robot may pre-store the excitation factor Kij corresponding to each position in the importance-urgency matrix. For different adjustment instructions, excitation factors corresponding to each position in the importance-urgency matrix are different. For an event whose position is adjusted, an excitation factor corresponding to a position after adjustment is largest, an excitation factor corresponding to a position before adjustment is smallest, and an excitation factor corresponding to another position is between the largest and the smallest. When the user adjusts the position corresponding to the second event from the first position to the second position, the robot may receive the instruction for adjusting the position corresponding to the second event from the first position to the second position. In this case, the robot may obtain the excitation factor corresponding to each position in the importance-urgency matrix for the adjustment instruction, and then may adjust, by using the excitation factor corresponding to each position, a corresponding probability of the second event in each position in the importance-urgency matrix, to obtain the new corresponding probabilities of the second event in the positions in the importance-urgency matrix (that is, obtain the corresponding probabilities of the second event in the positions in the importance-urgency matrix after position adjustment). After obtaining the new corresponding probabilities of the second event in the positions in the importance-urgency matrix, the robot may determine, based on the new corresponding probabilities of the second event in the positions in the importance-urgency matrix, the second position corresponding to the new largest probability as the position corresponding to the event.

Specifically, it is assumed that the event a is the second event, the first position is (i',j'), the second position is (i",j"), the corresponding probability of the second event in each position in the importance-urgency matrix before adjustment is Pij(a), the corresponding probability of the second event in each position in the importance-urgency matrix after adjustment is <MAT>, and the excitation factor is Kij. The robot may calculate, according to the formula (<NUM>), the new corresponding probabilities of the second event a in the positions in the importance-urgency matrix: <MAT>.

It may be learned that <MAT> is normalized. In addition, a value of Kij may be shown as follows:.

It may be learned that a new corresponding probability of the second event in the second position in the importance-urgency matrix is largest. To be specific, after adjustment by the user, the second position adjusted by the user is the corresponding position of the second event in the importance-urgency matrix.

Manner <NUM>: When an instruction for adjusting a position corresponding to a second event from a first position to a second position is received, a corresponding probability of the second event in the first position in the importance-urgency matrix is determined as a new corresponding probability of the second event in the second position, and a corresponding probability of the second event in the second position in the importance-urgency matrix is determined as a new corresponding probability of the second event in the first position. The second position corresponding to a new largest probability is determined as the position corresponding to the event based on new corresponding probabilities of the second event in the positions in the importance-urgency matrix.

During implementation, when receiving the instruction for adjusting the position corresponding to the second event from the first position to the second position, the robot may adjust only the corresponding probabilities of the second event in the first position and the second position, and does not adjust probabilities corresponding to the other positions. Specifically, when the instruction for adjusting the position corresponding to the second event from the first position to the second position is received, the corresponding probability of the second event in the first position in the importance-urgency matrix may be determined as the new corresponding probability of the second event in the second position, and the corresponding probability of the second event in the second position in the importance-urgency matrix may be determined as the new corresponding probability of the second event in the first position. In other words, the robot may interchange the probability of the second event in the first position and the probability of the second event in the second position before adjustment, and determine the interchanged probabilities as the new corresponding probability of the second event in the first position after adjustment and the new corresponding probability of the second event in the second position after adjustment. New probabilities of the second event in the other positions after adjustment are the same as the probabilities of the second event in the other positions before adjustment. After the new corresponding probabilities of the second event in the positions in the importance-urgency matrix are obtained, the second position corresponding to the new largest probability may be determined as the position corresponding to the event.

The new corresponding probabilities of the second event in the positions in the importance-urgency matrix may be calculated according to the formula (<NUM>), and a definition of the excitation factor Kij corresponding to each position is different from a definition in manner <NUM>, and may be as follows:.

It may be learned that the new corresponding probability of the second event in the second position in the importance-urgency matrix is largest. To be specific, after adjustment by the user, the second position adjusted by the user is the corresponding position of the second event in the importance-urgency matrix.

In addition, that the user adjusts the corresponding position of the second event in the importance-urgency matrix is equivalent to that positions of two events in the importance-urgency matrix are interchanged. In other words, when the position corresponding to the second event is adjusted from the first position to the second position, a position corresponding to a third event whose original corresponding position is the second position is adjusted from the second position to the first position. In other words, after the user adjusts the position corresponding to the second event, when re-determining, in manner <NUM> or manner <NUM>, the position corresponding to the second event, the robot may further re-determine, in manner <NUM> or manner <NUM>, the position corresponding to the third event. A specific implementation procedure is similar to that of the second event, and details are not described herein again.

Optionally, when the second event for which the corresponding position is adjusted is a to-be-processed event, the robot may re-calculate a priority of the second event. Correspondingly, a specific processing procedure may be as follows: when the second event is a to-be-processed event, re-determining, based on importance and urgency that are corresponding to the second position in the importance-urgency matrix, the priority corresponding to the second event.

During implementation, as described above, after the at least one triggered event and the target task corresponding to each event are determined, the target task corresponding to each of the at least one event may be added to a current task queue, and after the target task is executed, the target task may be deleted from the current task queue. Based on this case, when a target task corresponding to the second event is in the current task queue, the second event may be determined as a to-be-processed event. In other words, the to-be-processed event may include an event being processed. In addition, the to-be-processed event may alternatively not include an event being processed.

When the second event is a to-be-processed event, the robot may re-calculate, based on the foregoing method for determining a priority of an event, the priority corresponding to the second event. Further, the robot may execute, based on the re-calculated priority, the target task corresponding to the second event. For a case in which the to-be-processed event includes an event being processed, when the re-calculated priority is decreased, execution of the target task corresponding to the event may be suspended, and a target task corresponding to an event having a higher priority is executed.

For example, the robot detects, by using a component, triggering information "There is dirt on the ground", determines that an event triggered by the triggering information is "Find that the floor needs to be swept", and then may add a target task corresponding to the event to a current task queue, as shown in <FIG>. In this case, the robot further detects, by using another component, triggering information "Bring me medicine", determines that an event triggered by the triggering information is "An object needs to be fetched", and then may add a target task corresponding to the event to the current task queue, as shown in <FIG>. It is calculated, based on importance and urgency that are corresponding to the two events, that a priority of the event "Find that the floor needs to be swept" is higher than that of the event "An object needs to be fetched". When the user is not satisfied with the priorities, corresponding positions of the two events in the importance-urgency matrix may be adjusted. In other words, the importance and urgency of the two events may be adjusted, as shown in <FIG>. Correspondingly, the robot may re-calculate the priorities of the two events (to learn that the priority of the event "An object needs to be fetched" is higher than that of the event "Find that the floor needs to be swept"), and change a sequence of the target tasks corresponding to the two events in the current task queue, as shown in <FIG>. Eventually, the robot may first execute the target task corresponding to the event "An object needs to be fetched", and after completing the execution, may delete the target task corresponding to the event "An object needs to be fetched" from the current task queue, as shown in <FIG>, and continue to execute the target task corresponding to the event "Find that the floor needs to be swept".

In this implementation of this application, when the at least one piece of triggering information is detected, the at least one to-be-processed event corresponding to the at least one piece of triggering information is determined based on the at least one piece of triggering information, where the determined at least one event is different from each other. For each of the determined at least one event, the target task corresponding to the event is selected from the at least one task corresponding to the event. The target task corresponding to each event is executed. In this way, the robot combines the detected triggering information to determine events that are different from each other, so as to prevent a corresponding task from being executed twice for a same event corresponding to different triggering information, thereby preventing resource waste.

Based on a same technical idea, an implementation of this application further provides an apparatus for executing a task by an intelligent device. As shown in <FIG>, the apparatus includes a determining module <NUM> and an execution module <NUM>.

The determining module <NUM> is configured to: when at least one piece of triggering information is detected, determine, based on the at least one piece of triggering information, at least one to-be-processed event triggered by the at least one piece of triggering information, where the determined at least one event is different from each other, the triggering information is outside information detected by an intelligent device by using a sensor, and the event is an event that happens outside and that is determinable for the intelligent device when the intelligent device detects the triggering information. A determining function in step <NUM> and other implicit steps may be specifically implemented.

The determining module <NUM> is further configured to select, for each determined event and from at least one task corresponding to the event, a target task corresponding to the event, where the task is a processing manner available to the intelligent device for the event that happens outside. A determining function in step <NUM> and other implicit steps may be specifically implemented.

The execution module <NUM> is configured to execute the target task corresponding to each event. An execution function in step <NUM> and other implicit steps may be specifically implemented.

The determining module <NUM> is configured to:.

The determining module <NUM> is configured to:
when the intelligent device detects the at least one piece of triggering information, classify each piece of detected triggering information based on a pre-trained classification model and each event in an event set, and determine the event corresponding to each piece of triggering information.

Optionally, the determining module <NUM> is configured to:
for each determined event, select, from the at least one task corresponding to the event and based on a selection probability of each of the at least one task corresponding to the event, the target task corresponding to the event.

Optionally, as shown in <FIG>, the apparatus further includes:
an adjustment module <NUM>, configured to: when a satisfaction degree value entered for execution of a first task of a target task corresponding to a first event is received, adjust, based on the entered satisfaction degree value, a selection probability of the first task corresponding to the first event.

Optionally, the determining module <NUM> is further configured to:.

Optionally, the determining module <NUM> is configured to:.

Optionally, the determining module <NUM> is configured to:
determine, based on a pre-stored importance-urgency matrix and an event corresponding to each position in the importance-urgency matrix, the importance and urgency that are corresponding to each of the at least one event, where each position in the importance-urgency matrix represents importance and urgency of the event corresponding to the position.

Optionally, the determining module <NUM> is further configured to:
for each event in the event set, determine, based on pre-stored corresponding probabilities of the event in positions in the importance-urgency matrix, a position corresponding to a largest probability as a position corresponding to the event.

Optionally, the determining module <NUM> is further configured to:
when the second event is a to-be-processed event, re-determine, based on importance and urgency that are corresponding to the second position in the importance-urgency matrix, a priority corresponding to the second event.

It should be noted that the determining module <NUM>, the execution module <NUM>, and the adjustment module <NUM> may be implemented by a processor, or may be implemented by a processor along with a memory, or may be implemented by a processor executing a program instruction in a memory.

In this implementation of this application, when the at least one piece of triggering information is detected, the at least one to-be-processed event corresponding to the at least one piece of triggering information is determined based on the at least one piece of triggering information, where the determined at least one event is different from each other. For each of the determined at least one event, the target task corresponding to the event is selected from the at least one task corresponding to the event. The target task corresponding to each event is executed. In this way, a robot combines detected triggering information to determine events that are different from each other, so as to prevent a corresponding task from being executed twice for a same event corresponding to different triggering information, thereby preventing resource waste.

It should be noted that when the apparatus for executing a task provided in the foregoing implementation executes a task, only division of the foregoing functional modules is used as an example for description. In an actual application, the foregoing functions may be allocated to different functional modules for implementation according to needs. In other words, an inner structure of the intelligent device may be divided into different functional modules, to implement all or some functions described above. In addition, the apparatus for executing a task provided in the foregoing implementation and the implementation of the method for executing a task belong to a same idea. For a specific implementation process, refer to the method implementation, and details are not described herein again.

The foregoing implementations may be implemented completely or partially by software, hardware, firmware, or any combination thereof. When the foregoing implementations are implemented by software, the foregoing implementations may be completely or partially implemented in a form of a computer program product. The computer program product includes one or more computer instructions. When an intelligent device loads and executes the computer instruction, procedures or functions described in the implementations of this application are completely or partially generated. The computer instruction may be stored in a computer-readable storage medium or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial optical cable, an optical fiber, or a digital subscriber line (DSL)) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any available medium accessible by the intelligent device, or a data storage device, such as a server or a data center, integrating one or more available mediums. The available medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a digital versatile disc (DVD)), or a semiconductor medium (for example, a solid-state drive).

Claim 1:
A method for executing a task by an intelligent device, wherein the intelligent device comprises a plurality of sensor components, wherein the plurality of sensor components includes at least a first sensor component of a first type and a second sensor component of a second type, each sensor component detects a piece of triggering information, wherein the triggering information is outside information detected by the intelligent device by using the sensor components, wherein the pieces of triggering information respectively detected by the first and the second sensor components are of different types, wherein the method comprises:
when the intelligent device detects (<NUM>)
a first piece of triggering information detected by the first sensor component and further detects a second piece of triggering information detected by the second sensor component at the same time as that of detecting the first piece of triggering information,
classifying each piece of detected triggering information based on a pre-trained classification model and each event in an event set, and determining an event corresponding to each piece of triggering information, wherein the event is an event that happens outside and that is determinable for the intelligent device when the intelligent device detects the triggering information;
performing deduplication processing on all determined events to obtain an event list including at least one to-be-processed event triggered by the pieces of triggering information, wherein the deduplication processing comprises deleting repeated events such that when the event list includes multiple to-be-processed events, each event in the event list is different from each other;
selecting (<NUM>), for each determined to-be-processed event and from at least one task corresponding to the event, a target task corresponding to the event, wherein the task is a processing manner available to the intelligent device for the event that happens outside; and
executing (<NUM>) the target task corresponding to each event.