## Automatic hp-Adaptivity in Three Space Dimensions

In this chapter we present our algorithm for fully automatic hp-adaptivity in three dimensions. From a given initial grid, our algorithm automatically generates a sequence of hp-refined (coarse) grids such that the energy norm of the error decreases exponentially with respect to the number of unknowns. The optimal refinements are determined by way of a second sequence of fine grids, which are logically obtained from the first sequence by a global hprefinement (i.e., each coarse grid element is broken isotropically into eight sons, and the order of approximation is increased by one). In particular, we employ a discrete optimization algorithm to select the refinements such that the projection-based interpolation error of the fine grid solution decreases with the fastest possible rate with respect to the number of new unknowns introduced by the refinement. As we shall see, with relatively minor modifications, this same discrete optimization algorithm can be used to minimize an upper bound for the error in a quantity of interest, leading to a goal-oriented hp-adaptivity.