int N = 250; {int} I = asSet(1..N); float A[i in I][j in I] = (i==j)?1:0; float B[i in I][j in I] = (i==j)?1:0; //float A[i in I][j in I] = 1; //float B[i in I][j in I] = 1; float C[i in I][j in I] = sum(k in I) A[i,k]*B[k,j]; float s = sum(i in I, j in I) C[i,j]; execute{ writeln(s); } |

Model | GNU Mathprog | AMPL | GAMS | OPL |

sparse (identity) | 50 sec | 3 sec | 0.1 sec | 17 sec |

dense (all ones) | 50 sec | 3 sec | 3 sec | 17 sec |