Exemplo n.º 1
0
 def _get_partitioning(self) -> None:
     r"""Get the bounds of each hypercell in the decomposition."""
     minimization_cell_bounds = get_partition_bounds(
         Z=self._Z, U=self._U, ref_point=self._neg_ref_point.view(-1)
     )
     cell_bounds = -minimization_cell_bounds.flip(0)
     self.register_buffer("hypercell_bounds", cell_bounds)
Exemplo n.º 2
0
    def _get_partitioning(self) -> None:
        r"""Compute non-dominated partitioning.

        Given local upper bounds for the minimization problem (self._U), this computes
        the non-dominated partitioning for the maximization problem. Note that
        -self.U contains the local lower bounds for the maximization problem. Following
        [Yang2019]_, this treats -self.U as a *new* pareto frontier for a minimization
        problem with a reference point of [infinity]^m and computes a dominated
        partitioning for this minimization problem.
        """
        new_ref_point = torch.full(
            torch.Size([1]) + self._neg_ref_point.shape,
            float("inf"),
            dtype=self._neg_ref_point.dtype,
            device=self._neg_ref_point.device,
        )
        # initialize local upper bounds for the second minimization problem
        self.register_buffer("_U2", new_ref_point)
        # initialize defining points for the second minimization problem
        # use ref point for maximization as the ideal point for minimization.
        self._Z2 = self.ref_point.expand(1, self.num_outcomes,
                                         self.num_outcomes).clone()
        for j in range(self._neg_ref_point.shape[-1]):
            self._Z2[0, j, j] = self._U2[0, j]
        # incrementally update local upper bounds and defining points
        # for each new Pareto point
        self._U2, self._Z2 = update_local_upper_bounds_incremental(
            new_pareto_Y=-self._U,
            U=self._U2,
            Z=self._Z2,
        )
        cell_bounds = get_partition_bounds(Z=self._Z2,
                                           U=self._U2,
                                           ref_point=new_ref_point.view(-1))
        self.register_buffer("hypercell_bounds", cell_bounds)
Exemplo n.º 3
0
 def test_get_partition_bounds(self):
     expected_bounds_raw = torch.tensor(
         [
             [[3.0, 5.0, 7.0], [6.0, 2.0, 7.0], [4.0, 7.0, 3.0], [6.0, 2.0, 4.0]],
             [
                 [10.0, 10.0, 10.0],
                 [10.0, 5.0, 10.0],
                 [10.0, 10.0, 7.0],
                 [10.0, 7.0, 7.0],
             ],
         ],
         device=self.device,
     )
     for dtype in (torch.float, torch.double):
         final_U = self.expected_U_after_update.to(dtype=dtype)
         final_Z = self.expected_Z_after_update.to(dtype=dtype)
         bounds = get_partition_bounds(
             Z=final_Z, U=final_U, ref_point=-self.ref_point
         )
         expected_bounds = expected_bounds_raw.to(dtype=dtype)
         self.assertTrue(torch.equal(bounds, expected_bounds))