Individual of 2 trees

16 views
Skip to first unread message

Ozéas Carvalho

unread,
Apr 21, 2023, 6:16:50 AM4/21/23
to deap-users
Greetings,

I'm starting with DEAP and I need to create an individual of 2 trees with different sets. Each tree controls cooperative agents with different roles in a simulation. They are evaluated together.
How can I achieve that?

After some research, I came up with the following.

Given agent1_set and agent2_set:

creator.create("FitnessMax", base.Fitness, weights=(1,))
creator.create("Individual", tuple, fitness=creator.FitnessMax)

toolbox.register("agent1_tree", gp.genHalfAndHalf, pset=agent1_set, min_=5, max_=10)
toolbox.register("agent2_tree", gp.genHalfAndHalf, pset=agent2_set, min_=10, max_=20)

Now I'm not sure how to initialize them as an Individual.
For evaluation and recombination, I know that I just need to wrap the functions, since the first tree doesn't recombine with the second one.

Any help is appreciated,


François-Michel De Rainville

unread,
Apr 21, 2023, 7:33:22 AM4/21/23
to deap-users
Have you tried to create a function that uses the two operators defined in the toolbox and returns a tuple of trees?

--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/deap-users/a5b856fd-3474-4b6b-b5b2-6a2422cf3ad9n%40googlegroups.com.

Ozéas Carvalho

unread,
Apr 21, 2023, 12:41:30 PM4/21/23
to deap-...@googlegroups.com
I see. I will try that then.

Many thanks,

You received this message because you are subscribed to a topic in the Google Groups "deap-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/deap-users/63xInzkIHvQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to deap-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/deap-users/CAJjWHnaqB5%2B0XwcPc0ML%2Bi6vtqLok72ZXTOM5iBT-Mzd%2BF8vRg%40mail.gmail.com.


--
Ozéas Carvalho
Reply all
Reply to author
Forward
0 new messages