def hypervolume(self, reference):
"""
Autoflow method to calculate the hypervolume indicator
The hypervolume indicator is the volume of the dominated region.
:param reference: reference point to use
Should be equal or bigger than the anti-ideal point of the Pareto set
For comparing results across runs the same reference point must be used
:return: hypervolume indicator (the higher the better)
"""
min_pf = tf.reduce_min(self.front, 0, keep_dims=True)
R = tf.expand_dims(reference, 0)
pseudo_pf = tf.concat((min_pf, self.front, R), 0)
D = tf.shape(pseudo_pf)[1]
N = tf.shape(self.bounds.ub)[0]
idx = tf.tile(tf.expand_dims(tf.range(D), -1),[1, N])
ub_idx = tf.reshape(tf.stack([tf.transpose(self.bounds.ub), idx], axis=2), [N * D, 2])
lb_idx = tf.reshape(tf.stack([tf.transpose(self.bounds.lb), idx], axis=2), [N * D, 2])
ub = tf.reshape(tf.gather_nd(pseudo_pf, ub_idx), [D, N])
lb = tf.reshape(tf.gather_nd(pseudo_pf, lb_idx), [D, N])
hv = tf.reduce_sum(tf.reduce_prod(ub - lb, 0))
return tf.reduce_prod(R - min_pf) - hv
评论列表
文章目录