I have to get GAMS to find the maximum element of a set. This should result in some linear regression model, where the objective is not the least squares but the least maximum deviation.
My data points are the (x(p), y(p))
points (There is Set p / p1*p1000 / ;
given). I managed to solve the regression model as described by 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;
But what I should hand in is something like
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;
Of course you can read this, but GAMS hates it:
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
Yep, it is homework, nevertheless I'm completely stuck.