Motivated by the economic context, the social security reform in Brazil, and the Chandelier behavior of Brazilian individual investors in the retirement-fund market, this study designs an algorithm to manage a real retirement-fund portfolio.In our model, the theoretical manager of the fund can allocate its resources among four securities belonging to the same financial institution: two fixed income funds; and two private credit funds.Innovatively, the machine learning algorithm optimizes the portfolio allocation using reinforcement learning, which rewards good decisions and punishes bad decisions based on individual and social criteria.The algorithm presented a consistent and stable performance Vitamin C in all the six scenarios of simulation, outperforming the actual portfolio and s random strategy by considerable and significant average returns.