lemon-project-template-glpk

view deps/glpk/examples/huge.mod @ 11:4fc6ad2fb8a6

Test GLPK in src/main.cc
author Alpar Juttner <alpar@cs.elte.hu>
date Sun, 06 Nov 2011 21:43:29 +0100
parents
children
line source
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 */
8 param e := 20;
9 /* set Sample := {-2**e..2**e-1}; */
10 set Sample := {1..2**e-1};
12 var Mean;
13 var E{z in Sample};
15 /* sum of variances is zero */
16 zumVariance: sum{z in Sample} E[z] = 0;
18 /* Mean + variance[n] = Sample[n] */
19 variances{z in Sample}: Mean + E[z] = z;
21 solve;
23 printf "The arithmetic mean of the integers from 1 to %d is %f\n", 2**e-1, Mean;
25 end;