0
我必須得到GAMS才能找到一個集合的最大元素。這應該導致一些線性迴歸模型,其中目標不是最小平方而是最小偏差。GAMS最大元素
我的數據點是(x(p), y(p))
分(有Set p/p1*p1000/;
給出)。我設法解決迴歸模型由amsterdamoptimization描述:
Variables
m Slope
b Constant
objVal Objective Value
;
Equations
objFun Objective Function
lin(p) Regression Model
;
objFun .. objVal =n= 0;
lin(p) .. y(p) =e= m * x(p) + b;
option lp=ls;
Model Regression/objFun, lin/;
Solve Regression minimizing objVal using lp;
但我應該交出有點像
Variables
m Slope
b Constant
objVal Objective Value
;
Equations
objFun Regression Model
;
objFun .. objVal =e= smax(p, abs(y(p) - (m * x(p) + b)));
Model Regression/objFun/;
Solve Regression minimizing objVal using lp;
當然你也可以閱讀,但是GAMS不喜歡它:
2031 Solve Regression minimizing objVal using lp;
**** $51,59,256
Error Messages
51 Endogenous function argument(s) not allowed in linear models
59 Endogenous prod smin smax require model type "dnlp"
256 Error(s) in analyzing solve statement. More detail appears
Below the solve statement above
是的,這是作業,但我完全卡住了。