examples/huge.mod
author Alpar Juttner <alpar@cs.elte.hu>
Sun, 05 Dec 2010 17:35:23 +0100
changeset 2 4c8956a7bdf4
permissions -rw-r--r--
Set up CMAKE build environment
     1 /*Arithmetic Mean of a large number of Integers
     2   - or - solve a very large constraint matrix
     3          over 1 million rows and columns
     4   Nigel_Galloway@operamail.com
     5   March 18th., 2008.
     6 */
     7 
     8 param e := 20;
     9 /* set Sample := {-2**e..2**e-1}; */
    10 set Sample := {1..2**e-1};
    11 
    12 var Mean;
    13 var E{z in Sample};
    14 
    15 /* sum of variances is zero */
    16 zumVariance: sum{z in Sample} E[z] = 0;
    17 
    18 /* Mean + variance[n] = Sample[n] */
    19 variances{z in Sample}: Mean + E[z] = z;
    20 
    21 solve;
    22 
    23 printf "The arithmetic mean of the integers from 1 to %d is %f\n", 2**e-1, Mean;
    24 
    25 end;