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:

- (X + B)[i, j] >= 0 for all i, j (element-wise non-negativity)
- sum_i((X + B)[i, j] - (X + B)[j, i]) = 0 for all j (sum constraint)
- 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!