PROBLEM MultiOutputMultiplier CODE << const int N = 4; class State { public bool[] x1; public bool[] x2; public bool[] output; } private void GenerateProblemData(int n, out bool[][] a, out bool[][] b, out bool[][] expectedOutput) { var nConfigurations = (int)Math.Pow(2, n); var e = from i in Enumerable.Range(0, nConfigurations) from j in Enumerable.Range(0, i+1) select new {a = ToBitArray(N, i), b = ToBitArray(N, j), res = ToBitArray(2*N, i*j) }; a = e.Select(x=>x.a).ToArray(); b = e.Select(x=>x.b).ToArray(); expectedOutput = e.Select(x=>x.res).ToArray(); } private bool[] ToBitArray(int n, int x) { var b = new bool[n]; for(int i=0; i0) throw new ArgumentException(); return b; } >> NONTERMINALS Expr<>. Assign<>. AND<>. AND1<>. XOR<>. OR<>. TERMINALS InputA<> CONSTRAINTS id IN SET << Enumerable.Range(0, N) >> . InputB<> CONSTRAINTS id IN SET << Enumerable.Range(0, N) >> . Output<> CONSTRAINTS id IN SET << Enumerable.Range(0, 2 * N) >> . RULES Expr<> = LOCAL << int id; >> Assign<> | AND<> | AND1<> | XOR<> | OR<> | InputA<> SEM<< res = state.x1[id]; >> | InputB<> SEM<< res = state.x2[id]; >> | Output<> SEM<< res = state.output[id]; >> . Assign<> = LOCAL << int outId; >> Output<> Expr<> SEM<< state.output[outId] = res; >> . AND<> = LOCAL << bool resA, resB; >> Expr<> Expr<> SEM << res = resA & resB; >> . AND1<> = LOCAL << bool resA, resB; >> Expr<> Expr<> SEM << res = resA & !resB; >> . XOR<> = LOCAL << bool resA, resB; >> Expr<> Expr<> SEM << res = resA ^ !resB; >> . OR<> = LOCAL << bool resA, resB; >> Expr<> Expr<> SEM << res = resA | resB; >> . MINIMIZE << bool[][] a, b, expectedOutput; GenerateProblemData(N, out a, out b, out expectedOutput); int sumErr = 0; for(int i=0; i> END MultiOutputMultiplier.