error calculating hypervolume with three objectives

88 views
Skip to first unread message

Betty

unread,
Oct 21, 2018, 4:32:56 PM10/21/18
to deap-users
 Hello,

I was able to use the python version of the hypervolume with two objectives, but, when I am trying to use it on three objectives I am getting the following error:
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I am trying to calculate the hypervolume at each generation by doing this:

 ref=numpy.array([-2, 101, 26])
 wobj = numpy.array([ind.fitness.wvalues for ind in hof]) * -1
 hypervolume=hv.hypervolume(wobj, ref)


Any suggestions on how to solve this please.

Best wishes.
Many thanks.

Betty

unread,
Oct 26, 2018, 12:21:57 PM10/26/18
to deap-users
I solved this problem by using the Python version by Simon Wessing from this site:

The usage example on the site has 3 objectives, so I had a go at it.  I haven't had the time to look at the difference in the code, but, I believe this is an updated version of the code that comes with the DEAP.

Reply all
Reply to author
Forward
0 new messages