2d Individual

84 views
Skip to first unread message

Christian

unread,
Sep 16, 2022, 11:04:36 AM9/16/22
to deap-users
Hi there,


I'm new to DEAP and I have a problem what is based on an individual  n X 5 array with binary 0/1 values and only one is allowed to be 1. 

Simple example:
m = np.array([[0,0,0,0,1], [1,0,0,0,0], [0,0,0,0,0]])


My getValue function calculates the fitness with constrain penalties based
on m. The mutation with mutFlipBit will not work because of the 2d challenge and results in ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Using my own mutation function what considers the 2d problem is running into 
an exception: too many values to unpack  in varAnd / eaSimple.

Question: Shall I express my individual as 1d array, what gives me a little headache according to the fitness function or is it possible with another simple modification?

Thanks in advance,
Christian




 


Christian

unread,
Sep 21, 2022, 12:54:36 PM9/21/22
to deap-users
I changed the individual to integer 1-5 values and it's fine . Anyway might be interesting how or if the 2d solution works in case  I haven't excludability.

Fadlu Hasen

unread,
Sep 21, 2022, 2:48:17 PM9/21/22
to deap-...@googlegroups.com
Im also new for DEAP who can clearly describe about identical fitness? I need your help on this area 

--
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/8938873c-69c2-40c9-acc6-fe9f3571c507n%40googlegroups.com.

Christian

unread,
Sep 23, 2022, 4:35:33 AM9/23/22
to deap-users
Can you please elaborate your probably and maybe I can help?

Christian

unread,
Sep 23, 2022, 4:36:15 AM9/23/22
to deap-users
Can you please elaborate your problem and maybe I can help?
Reply all
Reply to author
Forward
0 new messages