  We present an open-source retrieval code named HELIOS-Retrieval (hereafter
HELIOS-R), designed to obtain chemical abundances and temperature-pressure
profiles from inverting the measured spectra of exoplanetary atmospheres. In
the current implementation, we use an exact solution of the radiative transfer
equation, in the pure absorption limit, in our forward model, which allows us
to analytically integrate over all of the outgoing rays (instead of performing
Gaussian quadrature). Two chemistry models are considered: unconstrained
chemistry (where the mixing ratios are treated as free parameters) and
equilibrium chemistry (enforced via analytical formulae, where only the
elemental abundances are free parameters). The nested sampling algorithm allows
us to formally implement Occam's Razor based on a comparison of the Bayesian
evidence between models. We perform a retrieval analysis on the measured
spectra of the HR 8799b, c, d and e directly imaged exoplanets. Chemical
equilibrium is disfavored by the Bayesian evidence for HR 8799b, c and d. We
find supersolar C/O, C/H and O/H values for the outer HR 8799b and c
exoplanets, while the inner HR 8799d and e exoplanets have substellar C/O,
substellar C/H and superstellar O/H values. If these retrieved properties are
representative of the bulk compositions of the exoplanets, then they are
inconsistent with formation via gravitational instability (without late-time
accretion) and consistent with a core accretion scenario in which late-time
accretion of ices occurred differently for the inner and outer exoplanets. For
HR 8799e, we find that spectroscopy in the K band is crucial for constraining
C/O and C/H. HELIOS-R is publicly available as part of the Exoclimes Simulation
Platform (ESP; www.exoclime.org).
