AMPL第十六章问题

10 views
Skip to first unread message

袁梦豪

unread,
Jul 23, 2022, 10:09:51 PM7/23/22
to ampl
您好,关于AMPL的第十六章有些地方不懂,想问一下obj和coeff分别表示的是什么呀,可以帮我解释一下
var Sell {i in MATF} >= sell_min[i], <= sell_max[i],
obj Net_Profit revenue[i],
coeff Balance[i] -1;
这几行代码嘛?

AMPL Google Group

unread,
Jul 25, 2022, 3:59:21 PM7/25/22
to AMPL Modeling Language
These come from the definition of var Sell in Figure 16-3 (file iocol2.mod). The model has already defined an objective and a collection of constraints:

maximize Net_Profit;
subject to Balance {i in MAT}: to_come = 0;

obj Net_Profit revenue[i] says that in the objective Net_Profit, the variable Sell[i] has the coefficient revenue[i]. Thus a term revenue[i] * Sell[i] is added to the expression for the objective function.

coeff Balance[i] -1 says that in the constraint Balance[i], the variable Sell[i] has the coefficient -1. Thus the term -1 * Sell[i] is added on the left-hand side of the expression for the constraint Balance[i]. (It is added on the left because that is where "to_come" appears in the definition of Balance.)


--
Robert Fourer
am...@googlegroups.com
{#HS:1957779999-111144#}
On Sun, Jul 24, 2022 at 2:09 AM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
您好,关于AMPL的第十六章有些地方不懂,想问一下obj和coeff分别表示的是什么呀,可以帮我解释一下

Hello, I don't understand something about Chapter 16 of AMPL. I want to ask what obj and coeff mean respectively. Can you explain it to me?

var Sell {i in MATF} >= sell_min[i], <= sell_max[i],
obj Net_Profit revenue[i],
coeff Balance[i] -1;

这几行代码嘛?

What are these lines of code?

Reply all
Reply to author
Forward
0 new messages