或者还有另一个问题?
这是我第一次尝试AMPL。我正在尝试解决一个非线性动态规划。以下是初稿的部分内容:
#defining degree
param degree >= 0 integer; # degree of polynomial approximation
param degrees {alpha in 0..degree}; # for storing degrees
...
# defining variables for optimization
var b {alpha in 0..degree}; # coefficient of polynomial
...
# defining constraints
subject to Upper_bound {i in M}: v[i] <=
sum {k in 0..n} (comb[n,k]*(p^k)*((1-p)^(n-k))*((k/n)*((ch[k,i])^d)/(1-d)) +
((n-k)/n)*(cl[k,i]^d)/(1-d)+(1/(1+r))*(sum {j in 0..degree}
(b[j]*cos(degrees[j]*acos((2*Anew[i]-Amax)/(Amax)))))));当我传递mod文件时,我得到一个语法错误:
model DP.mod;
DP.mod, line 41 (offset 1658):
syntax error
context: >>> (b[j]*cos(degrees[j]*acos((2*Anew[i]-Amax)/(Amax))))))) <<< ;请帮帮忙。
发布于 2020-07-21 15:01:37
已经解决了,谢谢!还有一个额外的结束括号。
https://stackoverflow.com/questions/63001746
复制相似问题