由 app/helpers/pages_helper.rb 中的 helper 函数来完成这一工作,从而保持视图的最小化(请参阅 清单 12)。
A helper function in app/helpers/pages_helper.rb does the heavy lifting, keeping the view minimal (see Listing 12).
它使所需的代码量最小化,因为它有许多内置功能,这样您就不再需要为这些功能编写客户端函数或对象了。
It minimizes the code you need to write, because it has many built-in features that you would otherwise need to write custom functions or objects for.
第20行的目标函数要对食物的总体成本实现最小化,该值是每个决策变量(食物数量)乘以每单位食物成本的结果。
The objective function on line 20 minimizes the total food cost as the total of each decision variable (amount of food) multiplied by that food's cost per unit.
应用推荐