C
C
Conder2021-08-20 21:20:16
Algorithms
Conder, 2021-08-20 21:20:16

How to determine the sequence of actions?

Suppose there is a certain complex class C containing several fields (A1, A2, A3, etc.), and these fields are not numeric, but something more complex (strings there, or enums), that is, classical algebra for these data not applicable.
There is a finite list of actions that we can perform on this class, for example:

  • Add the line "learn algorithms!" to field A1
  • Write an empty line in field A1 and change the value of field A2 to "green"
  • If field A2 is equal to "blue" then change it to "red", if not - clear field A3
  • Etc

Further, let's say we have two objects of class C (C1 and C2), and we want to build a sequence of actions that will turn C2 into C1

Question: In which direction should we dig? How are such tasks solved? In what notation are the rules written? What to even look for in Google, do such tasks have a common name? What book to read on the topic?
I feel like I missed something in my education.
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2021-08-20
@wataru

This is called state-space search. If you could build a graph - take all possible states of the field A1 x all possible states of the field A2... and draw from each edge corresponding to all possible actions, then it would be a dumb task to find a path in the graph.
The problem is that there are a lot of states. Therefore, the graph is not generated, but built on the fly. And then all the same, some kind of path-finding algorithm is launched in this graph. For example A*. Or dfs with all sorts of heuristic optimizations. The main thing is to wind up enough optimizations so that the algorithm does not touch too many states - because all the viewed states must be stored somehow in memory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question