MATH 441 Section 201
Sample inputs for LINGO for absorptivity example.
Online Course Material 


LINGO is a higher level language from which you can use Linear programming. The LP model is typically formulated in more general terms with access to data files containing for example, the requirements or availablities of raw materials and sets of variables etc. Examples throught the HELP function may be useful. Please note that there is some careful syntax to trip you up. Each `line' (say a constraint or the objective function) ends with a semicolon ; and you can embed comments using !comment here between exclamation and semicolon; Also multiplication is expressely done with * key and is not implicit as in LINDO. Many other pitfalls as well. Good luck.
Model:
!a=(best guessof) concentration of adenine in sample;
!c=(best guessof) concentration of cytosine in sample;
!g=(best guessof) concentration of guanine in sample;
!t=(best guessof) concentration of thiamine in sample;
!u=(best guessof) concentration of uracil in sample;
!guess(wavelength)=absorptivity predicted by choices for a,c,g,t,u;
!error(wavelength) is greater than or equal to |guess(wavelength)-abssample(wavelength|;
!diff is greater than equal to all errors and, because we are minimizing,it will end up as;
!min |guess(wavelength)-abssample(wavelength)| over all wavelengths;


Sets:
wavelength / 220 230 240 250 260 270 280 290 300 310 320 330/: abssample,
absa, absc, absg, abst, absu, guess, error;
endsets

[objective] Min=diff;
@for(wavelength(j): [guessabs] absa(j)*a+absc(j)*c+absg(j)*g
+abst(j)*t+absu(j)*u = guess(j));
@for(wavelength(j): [unsignederror] error(j)=guess(j)- abssample(j));
@for(wavelength(j): [error1] diff+error(j)>0);
@for(wavelength(j): [error2] diff-error(j)>0);
@for(wavelength(j): [freeerror] @free(error(j)));

Data:
abssample=@OLE('absorptivity.xls', 'B2:B13');
absa=@OLE('absorptivity.xls', 'C2:C13');
absc=@OLE('absorptivity.xls', 'D2:D13');
absg=@OLE('absorptivity.xls', 'E2:E13');
abst=@OLE('absorptivity.xls', 'F2:F13');
absu=@OLE('absorptivity.xls', 'G2:G13');

Enddata

The excel file absorptivity.xls should be stored in the standard location for LINGO files. When accessinging it in LINGO, the file must be closed. I had some challenges. I suspect a more generic access to the spreadsheet is possible but giving the specific locations `B2-B13' worked.