Constrained Optimization Problem

I’m facing an optimization problem in Fortran and could use some guidance. The objective is to find a matrix B that, when added to matrix X (that is known, given), satisfies certain constraints while minimizing B in terms of the infinity norm.

To summarize the problem, I need to find the matrix B with the smallest (infinity) norm possible, while ensuring that X + B meets the following constraints:

  1. (X + B)[i, j] >= 0 for all i, j (element-wise non-negativity)
  2. sum_i((X + B)[i, j] - (X + B)[j, i]) = 0 for all j (sum constraint)
  3. diag(X + B) = 0

Although I have (very) basic knowledge in Fortran, I’m unsure about the specific tools or techniques to employ for this task. I’ve come across a GitHub repository (GitHub - Beliavsky/Fortran-code-on-GitHub: Directory of Fortran codes on GitHub, arranged by topic) that contains potentially helpful resources, but I’m uncertain about their relevance to my problem.

Thanks!

Just guessing, but is this kind of library possibly useful…? (The doc page shows “bound constraints”, “nonlinear constraints”, and “vector-valued constraints”)
https://nlopt.readthedocs.io/en/latest/NLopt_Fortran_Reference/