Home | Research Interests | Publications | Positions | Personal | Models | Seminar Abstracts | Powerpoint Talks
 

 

» Agprice
» Constraint
  Curve
» Decent
» Distrib
» Economy
» Efficient
» Factory
» Farm
» Food
» Hydro
» Logic
» Manpower
» Market
» Milk
» Mining
» OandX
» Opencast
» Refinery
» Tariff
» TSP
» Yield
 

Model Curve

  MODEL curvea             ! linear regressions for L1 and L (infinity) norms
  SET
 

 

nopts = {1 .. 19}; ! number of data points
  DATA
   

xvalue[nopts] << "xfile.dat",

   

yvalue[nopts] << "yfile.dat";

  VARIABLES
   

a free,

! coefficients in
   

b free,

! linear relation
   

maxdev,

! maximum deviation variable
   

slack[nopts],

! negative error
   

surp[nopts];

! positive error
  OBJECTIVE
   

MINIMIZE sumdev = sum{i in nopts} (slack[i] + surp[i]);

! minimise L1 norm
   

! MINIMIZE minmax = maxdev;

! minimise L (infinity) norm
  CONSTRAINTS
   

dev{i in nopts} : xvalue[i]*b + a + slack[i]

! linear relation
                                   - surp[i] = yvalue[i],  
   

ula{i in nopts} : maxdev-slack[i] >= 0,

! maximum deviation >= absolute deviations
   

ulb{i in nopts} : maxdev-surp[i] >= 0;

 
  END MODEL
   

solve curvea;

   

print solution for curvea >> "curvea.sol";

   

quit;

 
   
  MODEL curveb ! quadratic regressions for L1 and L (infinity) norms
  SET
 

 

nopts = {1 .. 19}; ! number of data points
  DATA
   

xvalue[nopts] << "xfile.dat",

   

yvalue[nopts] << "yfile.dat";

  VARIABLES
   

a free,

! coefficients
   

b free,

! in quadratic
   

c free,

! relation
   

maxdev,

! maximum deviation variable
   

slack[nopts],

! negative error
   

surp[nopts];

! positive error
  OBJECTIVE
   

! MINIMIZE sumdev = sum{i in nopts} (slack[i] + surp[i]);

! minimise L1 norm
   

MINIMIZE minmax = maxdev;

! minimise L (infinity) norm
  CONSTRAINTS
   

dev{i in nopts} : (xvalue[i]*xvalue[i])*c + xvalue[i]*b

! quadratic relation
                                  + a + slack[i] - surp[i] = yvalue[i],  
   

ula{i in nopts} : maxdev-slack[i] >= 0,

! maximum deviation >=absolute deviations
   

ulb{i in nopts} : maxdev-surp[i] >= 0;

 
  END MODEL
   

solve curveb;

   

print solution for curveb >> "curveb.sol";

   

quit;

 
  xfile.dat
  [0.0,0.5,1.0,1.5,1.9,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.6,7.0,7.6,8.5,9.0,10.0]
 
  yfile.dat
  [1.0,0.9,0.7,1.5,2.0,2.4,3.2,2.0,2.7,3.5,1.0,4.0,3.6,2.7,5.7,4.6,6.0,6.8,7.3]
 
   

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

 

 

 

 

 

 

 

 

 
         
 
Site updated December 2021 | email: h.p.williams@lse.ac.uk