Perhaps something along the lines of: calories_in(food) => calories_out(activity_level, gender, age, weight, body_fat_percentage, protein, carbohydrates, fat, genetics)
I think the complicated part is altering your environment and/or yourself so that you, on average, don't eat more calories than you expend. That is, to fix the feedback loop to make calories_in equal to calories_out at your desired weight.
It's not the simplest of problems, for instance, two people can do the exact same activities and eat the same amount of food and gain different amounts of weight.
Ideally, people would simply stop being hungry when they had eaten enough food, but if that was true, there would be far less fat people. So what actually seems to be the problem is that the biological system that controls hunger is often miscalibrated. I believe that diets attempt to fix that, to make people feel the 'correct' amount of hunger.
For instance, if sugar caused people to become hungry, or to eat more calories than they otherwise would, or to burn less calories than they normally would, you could create a diet that contained no sugar. The average person, if they followed the diet, would hopefully have a more appropriate hunger level at any given time.