Hello All! If the following approach makes sense?
Suppose we have a device with the K sensors and L motors. Sensor gives whole numbers
- the more on the sensor - the greater the number.
Motors are also supervised by sending the number - the higher the number - the greater the power.
How to manage such a device? It isn't necessary to write the program.
You can simply create a table in which each row contains the K + L elements.
First K elements correspond to the sensors and the remaining L to motors.
The work consists in the following: we try to find row where first K elements match to the current state of the sensors.
Then take the remaining L elements and fed to the motors.
It is clear that it's impossible to have a table that lists all the options of sensors.
So, complete the table with typical examples, and if not found an exact match we look for the most similar to the current
state of the sensors.
As a measure of closeness we can take the usual scalar product
(the vectors are more similar if the scalar product greater).
If the maximum similarity is achieved on multiple rows,
their L - part just add up and divide by the number of such rows.
Remarks: The scalar product can be used as measure of similarity if the rows stored in the table are normalized - scalar
products of a row to itself are equal for each rows