Queue reduction algorithm?

I have a queue of actions shared between clients, capturing user activity and being performed by a robot on another site. An example of an activity might look like this:

CREATE FOLDER  /docs
CREATE FILE    /docs/journal.txt
DELETE FILE    /docs/blog.txt
MOVE   FOLDER  /docs/images /docs/photos
...

Often there are actions that can be reduced to one or not. For instance:

CREATE FOLDER /docs
RENAME FOLDER /docs /documents

You can simply change to:

CREATE FOLDER /documents

And something like:

CREATE FOLDER /docs
RENAME FOLDER /documents
DELETE FOLDER /documents

Can be completely removed from the queue.

This kind of reduction / optimization seems to be a very common problem, and before the attack I would like to try some general solution. This is similar to a path search optimization problem.

Any ideas?

+5
source share
3 answers

, . , , , , , .

, :

  • ( " " .. ")

  • "" .

  • , .

+3

( ) - , , , . , , . , , , , .

, !

+1
  • (, , )
  • Command, + .
  • , , , , .

I have to assume that you can only combine commands that immediately follow each other, or you can potentially introduce unwanted side effects. Therefore, when you start executing a command from the yoru queue, start peeping / popping up / typing a command until you come across a team that cannot be combined into it.

0
source

All Articles