  Control barrier function (CBF) has recently started to serve as a basis to
develop approaches for enforcing safety requirements in control systems.
However, constructing such function for a general system is a non-trivial task.
This paper proposes an iterative, optimization-based framework to obtain a CBF
from a given user-specified set for a general control affine system. Without
losing generality, we parameterize the CBF as a set of linear functions of
states. By taking samples from the given user-specified set, we reformulate the
problem of learning a CBF into an optimization problem that solves for linear
function coefficients. The resulting linear functions construct the CBF and
yield a safe set which has forward invariance property. In addition, the
proposed framework explicitly addresses control input constraints during the
construction of CBFs. Effectiveness of the proposed method is demonstrated by
learning a CBF for an nonlinear Moore Greitzer jet engine, where the system
trajectory is prevented from entering unsafe set.
