  We study the adaptive control of an unknown linear system with a quadratic
cost function subject to safety constraints on both the states and actions. The
challenges of this problem arise from the tension among safety, exploration,
performance, and computation. To address these challenges, we propose a
polynomial-time algorithm that guarantees feasibility and constraint
satisfaction with high probability under proper conditions. Our algorithm is
implemented on a single trajectory and does not require system restarts.
Further, we analyze the regret of our learning algorithm compared to the
optimal safe linear controller with known model information. The proposed
algorithm can achieve a $\tilde O(T^{2/3})$ regret, where $T$ is the number of
stages and $\tilde O(\cdot)$ absorbs some logarithmic terms of $T$.
