I am not sure what you wish to do.
Can you show a simpler example problem and show what the optimization would be for that?
Perhaps if I understand you example I can try to help with your original problem.
Are there any conditions the solution must have?
There is no need to apologize for your English. Your use of English is much better than my use of any other language, except for a little mathematics and perhaps we share enough of that to find you your answer.