How to imagine a path for a genetic algorithm?

I want to use GA to determine the optimal path from A to B, satisfying certain conditions (length, number of turns, etc.)

Example path: Up 4, Left 8, Down 3, Right 3, Down 1, Left 10, Up 4, Left 1, Up 3

The problem is that I really don't know how to present information such as this well for use in GA, especially because the paths are of variable length.

Does anyone have a good idea how to do this?

+3
source share
5 answers

, , , - GA. , , , -. , "". - , " nuke this element" " A B", , .

+2

, - A *, ( ) . , , .

+2

U, D, L, R....

, " 4, 8, 3, 3, 1, 10, 4, 1, 3" :

UUUULLLLLLLLDDDRRRDLLLLLLLLLLUUUULUUU

.

A (15 ) B (3 ) A B :

  • (len) 1 MAX (LEN (A), LEN (B)) { 1 15}
  • () 1 len.
  • , , A B .
  • s- , , (len-s) .
+1

GA . . , , ( ) , , . , . , , (, , ). , . .

, , , , Osama ALASSIRY, : UUUULLLLLLLLDDDRRRDLLLLLLLLLLUUULUUU.
  :

  • 1 ,
  • x1, y1, x1, y1 = < lenght1 x1!= y1 ( 1),
  • 2, (x1, y1) (x2, y2),
  • 1, x1 y1, 2 x2 y2. Individual 2 , x1y1 x2y2 , ,
  • , 2 x2y2, 1 x1y1 ( ),

:
parent A: UUUULLLLLLLLDDDRRRLLLLLLLLLLLLUUULUUU
B: DRRRRLULUDDDR
pairA (4,18), pairB (0,5) , 0, :
UUUU LLLLLLLLDDDRRRD LLLLLLLLLLUUUULUUU
DRRRRL ULUDDDR
, UUUU DRRRRL LLLLLLLLLLUUUULUUU
LLLLLLLLDDDRRRD ULUDDDR
. .

:

  • 0 ,
  • generate a number between 1-4 and update this gene. (if 1 was generated, change it to U, 2-D, 3-L, 4-R)

you just made a mutation. You can also mutate more than one gene.

But, as I said, there are other possibilities.

+1
source

For me, this sounds very similar to a seller-seller problem , does this page contain any useful information?

0
source

Source: https://habr.com/ru/post/1706342/


All Articles