解决GAMS软件中一行代码的几个错误

问题描述 投票:0回答:1

我在以下行中有几个错误:

e3_d(b).. sum( (t)$(ord(t) >= 1) and (ord(t) <= t-N_chp_on_max+N_chp_on_max), alpha(b, t) ) =l= N_chp_on_max;

两个错误

(',' expected)
(Unknown symbol)
and

错误

(Set identifier or quoted element expected)
ord
,

此外,对于

N_chp_on_max
,它会给出错误
(Dimension different - The symbol is referenced with more/less indices as declared)
(Incompatible operands for addition)

它还为 (Incompatible operands for addition)

 第一部分的最后一个右括号给出错误 
sum

对于

comma before alpha
,它给出以下错误:
('=l=' or '=e=' or '=g=' operator expected)
(Unrecognizable item - skip to find a new statement looking for a ';' or a key word to get started again)

如果您能指导我并帮助我解决这个问题,我将不胜感激。

syntax modeling gams-math
1个回答
0
投票

看起来像两个较小的问题:

  • $
    条件中缺少一对括号
  • card
    条件下缺少
    $
    运算符(至少我认为这就是您的想法)

所以,以下应该有效:

e3_d(b).. sum( (t)$((ord(t) >= 1) and (ord(t) <= card(t)-N_chp_on_max+N_chp_on_max)), alpha(b, t) ) =l= N_chp_on_max;
© www.soinside.com 2019 - 2024. All rights reserved.