How to optimize input parameters given target and scoring parameters
If your data have simple linear relationship (or you can transform it such that this is the case) you can do regression on $T$ and $S$, and after that you should have the linear relationship between input parameters and target parameters. After that you can use scipy minimize or any other library to perform constrained optimization. If I follow from my example my idea would be to perform a predefined trade-off between $T$ and $S$ for example $\max 0.8 T + 0. 2S$. This should be easy to code with scipy.