{
l: LIST OF Incr ¬ fs.incrs;
c: QPSolve.RVector ~ NEW[QPSolve.RVectorRep[2+fs.nIncrs] ];
A: QPSolve.Matrix ~ QPSolve.NewMatrix[fs.nIncrs, 2+fs.nIncrs];
lobd: QPSolve.RVector ~ NEW[QPSolve.RVectorRep[2+fs.nIncrs]];
x: QPSolve.RVector ~ NEW[QPSolve.RVectorRep[2+fs.nIncrs]];
iVar: QPSolve.IVector ~ NEW[QPSolve.IVectorRep[2+fs.nIncrs]];
minMaxDay: INT ¬ INT.LAST;
maxbd: REAL ¬ 0;
nFR: NAT ¬ 0;
nFX: NAT ¬ 2+fs.nIncrs-1;
sum: REAL ¬ 0;
c.n ¬ 2+fs.nIncrs;
lobd.n ¬ 2+fs.nIncrs;
x.n ¬ 2+fs.nIncrs;
iVar.n ¬ 2+fs.nIncrs;
FOR i:
INT
IN [0..fs.nIncrs)
DO
A[i][0] ¬ 1;
A[i][1] ¬ l.first.days;
sum ¬ sum + l.first.days;
A[i][2+i] ¬ -1;
lobd[2+i] ¬ (100.0*l.first.size)/fs.level0Size;
IF lobd[2+i] >= maxbd
THEN {
maxbd ¬ lobd[2+i];
IF l.first.days < minMaxDay THEN minMaxDay ¬ l.first.days;
};
c[2+i] ¬ 0;
l ¬ l.rest;
ENDLOOP;
FOR i:
INT
IN [0..fs.nIncrs)
DO
x[2+i] ¬ maxbd;
IF lobd[2+i]= maxbd
AND A[i][1]=minMaxDay
THEN {
iVar[nFX] ¬ 2+i;
nFX ¬ nFX-1;
}
ELSE {
IF lobd[2+i]= maxbd THEN lobd[2+i] ¬ .9999*lobd[2+i]; -- hack to preserve dimension of problem
iVar[nFR] ¬ 2+i;
nFR ¬ nFR+1;
};
ENDLOOP;
x[0] ¬ maxbd;
iVar[nFR] ¬ 0;
x[1] ¬ 0;
iVar[nFX] ¬ 1;
nFR ¬ nFX;
c[0] ¬ fs.nIncrs*1.0e3;
c[1] ¬ sum*1.0e3;
[] ¬ QPSolve.QPSolve[c, A, lobd, x, iVar, nFR];
out.PutFL["%g %4g %4g (based on %g incrementals).\n", LIST[[rope[fs.name]], [real[x[0]]], [real[x[1]]], [integer[fs.nIncrs]]]];
};