Function value definition

I have some function and its graph (you can take any for example). My task is to find such parameters of this function so that its value is maximum. Can’t I figure out which Loss function to apply to me? Who knows how to solve this problem?