A set of programs to calculate the number of free polyominoes of width 2, 3, or 4 To run the width counters, use "java -jar WidthCounter.jar param" where param is one of: w2calculator:size=n w3calculator:size=n w4calculator:size=n for some value of n, e.g. 100 Alternatively, substitute size=n with code=true to generate the expressions used in the calculation. The programs have not been written "well". There is insufficient code sharing. Also there is little use of symmetry. For example, width 4 polyominoes with a complete bottom row, and just the leftmost square in the top row are counted separately from those having just the rightmost square in the top row. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil; /** * * @author mason * used to analyze parameters passed to filters */ public class ParameterAnalyzer { String resultsParameters[]; String resultValues[]; String rules[]; int number = 0; public ParameterAnalyzer(String input, String rules[]) { this.rules = rules; resultsParameters = new String[rules.length]; resultValues = new String[rules.length]; while (input.length() > 0) input = doOne(input); } String doOne(String input) { int n = input.indexOf(","); String param = input; if (n >= 0) { param = input.substring(0, n); input = input.substring(n + 1); } else input = ""; int m = param.indexOf("="); if (m < 0) { System.err.println("erroneous " + param); System.exit(1); } String paramName = param.substring(0, m); String paramValue = param.substring(m + 1); for (int i = 0; i < rules.length ; i++) { if (paramName.equals(rules[i])) { resultsParameters[number] = paramName; resultValues[number] = paramValue; number++; return input; } } System.err.println("erroneous " + paramName); System.exit(1); return null; } public String getStringValue(String paramName) { for (int i = 0 ; i < number; i++) { if (paramName.equals(this.resultsParameters[i])) return this.resultValues[i]; } return null; } public String getStringValue(String paramName, boolean obligatory) { for (int i = 0 ; i < number; i++) { if (paramName.equals(this.resultsParameters[i])) return this.resultValues[i]; } if (obligatory) { System.err.println("missing " + paramName); System.exit(1); } return null; } public int getIntValue(String paramName, int def) { String t = getStringValue(paramName); if (t == null) return def; return Integer.parseInt(t); } public double getDoubleValue(String paramName, double def) { String t = getStringValue(paramName); if (t == null) return def; return Double.parseDouble(t); } public int getIntValue(String paramName) { String t = getStringValue(paramName); if (t == null) { System.err.println("missing " + paramName); System.exit(1); } return Integer.parseInt(t); } public long getLongValue(String paramName, long def) { String t = getStringValue(paramName); if (t == null) { return def; } return Long.parseLong(t); } public boolean getBooleanValue(String paramName) { String t = getStringValue(paramName); if (t == null || t.equals("false")) return false; if (t.equals("true")) return true; System.err.println("erroneous " + t); System.exit(1); return false; } public boolean getBooleanValue(String paramName, boolean def) { String t = getStringValue(paramName); if (t == null) return def; if (t.equals("false")) return false; if (t.equals("true")) return true; System.err.println("erroneous " + t); System.exit(1); return false; } public Boolean getTrooleanValue(String paramName, boolean obbli) { Boolean ret = getTrooleanValue( paramName); if (ret == null && obbli) { System.err.println("missing " + paramName); System.exit(1); } return ret; } public Boolean getTrooleanValue(String paramName) { String t = getStringValue(paramName); if (t == null) return null; if (t.equals("false")) return Boolean.FALSE; if (t.equals("true")) return Boolean.TRUE; System.err.println("erroneous " + t); System.exit(1); return false; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil; import polyutil.readers.*; import java.io.*; import java.math.BigInteger; import java.util.*; /** * * @author jmason */ public class PolyUtil { /** * @param args the command line arguments: see Runner class */ public static void main(String[] args) { long startTime = System.currentTimeMillis(); // run the program new Runner(args); // log the cpu time long endTime = System.currentTimeMillis(); long elapsedTime = (endTime - startTime) / 1000; System.err.println("Elapsed " + elapsedTime); String command = ""; for (int i = 0; i < args.length; i++) command += " " + args[i]; try { FileWriter fw = new FileWriter("times.txt", true); BufferedWriter bw = new BufferedWriter(fw); bw.write(elapsedTime + command); bw.newLine(); bw.close(); } catch (IOException e) { System.err.println(e.getMessage()); System.exit(1); } } } package polyutil; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import polyutil.readers.*; import polyutil.functions.*; import java.io.*; import java.math.BigInteger; import java.util.*; /** * * @author mason */ public class Runner { /** * @param args the command line arguments */ public Runner(String[] args) { //Runner.printArgs("Runner", args); if (args.length < 1) usage("too few arguments"); run(args); } void run(String args[]) { int n; // Choose which program and pass arguments if ((n = testCMD(args[0],"w2calculator")) > 0) { String in = args[0].substring(n); W2CalculatorHeight firstOne = new W2CalculatorHeight( in); firstOne.runReader(); } else if ((n = testCMD(args[0],"w3calculator")) > 0) { String in = args[0].substring(n); W3CalculatorABC firstOne = new W3CalculatorABC( in); firstOne.runReader(); } else if ((n = testCMD(args[0],"w4calculator")) > 0) { String in = args[0].substring(n); W4Calculator firstOne = new W4Calculator(in); firstOne.runReader(); } else usage("unknown first parameter"); } int testCMD(String arg, String cmd) { if (arg.equals(cmd)) return arg.length(); if (arg.startsWith(cmd + ":")) return cmd.length() + 1; return 0; } void usage(String error) { System.err.println(error); System.exit(1); } public static void printArgs(String place, String args[]) { String cmd = ""; for (int i = 0 ; i < args.length ; i++) cmd += args[i] + " "; System.err.println(place + " : " + cmd); } public static void notImplemented(String place) { System.err.println(place + " not implemented"); System.exit(1); } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.readers; import polyutil.*; import polyutil.functions.*; import java.util.*; import java.io.*; /** * * @author mason * */ public class W2CalculatorHeight { int lines; Hashtable equiv; ParameterAnalyzer pa; int size; String debugCat ; SingleFunction free; FunctionSet fs; boolean code; static String[] w2combinations = {"a", "b", "ab"}; ArrayList w2FunctionList; public FunctionSet getFS() { return fs; } public W2CalculatorHeight( String params) { String[] rules = new String[] {"debugcat", "size", "code"}; pa = new ParameterAnalyzer(params , rules); debugCat = pa.getStringValue("debugcat"); if (debugCat == null) debugCat = ""; size = pa.getIntValue("size", 0); code = pa.getBooleanValue("code", false); } public W2CalculatorHeight(int size) { this.size = size; } public void runReader() { prepare(); doit(); } void prepare() { String curr; fs = new FunctionSet(); equiv = new Hashtable<>(); W2CalculatorRoutinesHeight routines = new W2CalculatorRoutinesHeight(equiv, fs, size); routines.run(); Set>> w2EntrySet = routines.w2_hash.entrySet(); free = new SingleFunction("free"); SingleFunction free1 = new SingleFunction("free1"); SingleFunction free2 = new SingleFunction("free2"); SingleFunction free4 = new SingleFunction("free4"); free.addTerm(free1); free.addTerm(new Division(free2, new Constant(2))); free.addTerm(new Division(free4, new Constant(4))); ArrayList freeList = new ArrayList<>(); for(Map.Entry> entryEven : w2EntrySet) { freeList.add(substitute(entryEven.getKey())); } outArrayDiv(freeList, free1, 1); outArrayDiv(freeList, free2, 2); outArrayDiv(freeList, free4, 4); } void doit() { if ( !code) { for (int i = 1 ; i <= size; i++) { System.out.println(i + " " + free.value(i)); } } if (code) { Hashtable done = new Hashtable<>(); ArrayList todo = new ArrayList<>(); todo.add(free); for (int i = 0; i < todo.size(); i++) { GenericFunction f = todo.get(i); if (done.get(f.getName()) == null) { //System.err.println(f.getName()); done.put(f.getName(), f.getName()); todo.addAll(f.getDependentFunctions(true)); System.out.println(f.expression()); } } } } boolean testSlr(String s) { return s.equals("ab"); } static String invert(String s) { String ret = ""; for (int i = 0; i < s.length(); i++) { String t = s.substring(i, i + 1); switch(t) { case "a": ret = "b" + ret; break; case "b": ret = "a" + ret; break; } } return ret; } void outArrayDiv(ArrayList array, SingleFunction f, int div) { Collections.sort(array); String current = ""; int count = 0; for (String s : array) { if (s.equals(current)) { count++; continue; } outDiv(current, count, f, div); count = 0; current = s; count++; } outDiv(current, count, f, div); } void outDiv(String category, int count, SingleFunction f, int div) { //String portion = category; //This routine must distinguish which free* to add to int divisor = 1; if (count > 0) { Term t = new Call(fs.getFunction(category), 1, 0); //portion += "(n)"; //if (count > 1) { //portion += ".multiply(BigInteger.valueOf(" + count + "))"; //} if (category.contains("_slr_sud_srot")) { // ; // noop t = new Product(t, new Constant(count)); } else if (category.contains("_s")) { if (count == 2) ; // noop portion = category + "(n)"; else { if (count > 1) t = new Product(t, new Constant(count)); divisor = 2; //t = new Division(t, new Constant(2)); // portion = "div(" + portion + ", two)"; } } else { if (count == 4) ; // noop portion = category + "(n)"; else { if (count > 1) t = new Product(t, new Constant(count)); divisor = 4; //t = new Division(t, new Constant(4)); // portion = "div(" + portion + ", four)"; } } //out(" " + portion + ","); if (div == divisor) f.addTerm(t); //count = 0; } } String substitute(String in) { String out = equiv.get(in); if (out == null) return in; else return out; } }/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.readers; import java.math.BigInteger; import polyutil.*; import java.util.*; import java.io.*; import polyutil.functions.*; /** * * @author mason */ public class W2CalculatorRoutinesHeight { Hashtable equiv; int lines; public String number; String[] listLetters = new String[] {"a", "b"}; //String[] ncolcol_above = { "ncolcol_l_lr", "ncolcol_r_lr", "ncolcol_lr_lr_slr"}; //String[] ncolcol_below = { "ncolcol_lr_l", "ncolcol_lr_r", "ncolcol_lr_lr_slr"}; String[] w1 = { "w1a_a_a", "w1b_b_b"}; public Hashtable> w2_hash, w1_hash; int size ; FunctionSet fs; boolean isEven; public W2CalculatorRoutinesHeight(Hashtable equiv, FunctionSet fs, int size) { this.equiv = equiv; this.fs = fs; this.size = size; } public void run() { // 1. w3 above w3 w2_hash = new Hashtable<>(); w2_hash = new Hashtable<>(); for (String above : W2CalculatorHeight.w2combinations) { for (String below : W2CalculatorHeight.w2combinations) { String prefix = "w2_" + above + "_" + below; process_w2(prefix); boolean bslr = slrW2(above) && slrW2(below); if (bslr) process_w2(prefix + "_slr"); boolean bsud = above.equals(below); if (bsud) process_w2(prefix + "_sud"); boolean bsrot = above.equals(W2CalculatorHeight.invert(below)); if (bsrot) process_w2(prefix + "_srot"); if (bsrot && bslr) { process_w2(prefix + "_slr_sud_srot"); } } } w1_hash = new Hashtable<>(); SingleFunction w1_l_l = new SingleFunction("w1_l_l"); w1_l_l.setMinimum(1); w1_l_l.setHard(1); w1_l_l.setSoft(1); for (String s : w1) { w1_hash.put(s, new ArrayList<>()); fs.add(w1_l_l, s); } String rows1[] = new String[] {"row_a_a", "row_b_b"}; String rows2[] = new String[] {"row_ab_ab_slr"}; isEven = true; mix(null, 0, 0); for (String rowComp : rows2) { String row = rowComp; mix(row, 1, 1); } isEven = false; for (String rowComp : rows1) { String row = rowComp; mix(row, 0, 0); } for (String rowComp : rows2) { String row = rowComp; mix(row, 1, 0); mix(row, 0, 1); } loadMinimums(); loadShouldBes(); } Hashtable> listPoly[] /* = {w4_hash, w3_hash, w2_hash, w1_hash} */; void mix(String row, int subtractCoeffAbove, int subtractCoeffBelow) { listPoly = new Hashtable[2]; listPoly[0] = w2_hash; listPoly[1] = w1_hash; for (Hashtable> hAbove : listPoly) { for (Hashtable> hBelow : listPoly) { outRow(row, subtractCoeffAbove, subtractCoeffBelow, hAbove, hBelow); } } } private void outRow(String row, int subtractCoeffAbove, int subtractCoeffBelow, Hashtable> hAbove, Hashtable> hBelow) { Set>> setAbove = hAbove.entrySet(); Set>> setBelow = hBelow.entrySet(); Destruct drow = null; if (row != null) drow = new Destruct(row); for (Map.Entry> entryAbove : setAbove) { String above = entryAbove.getKey(); Destruct dabove = new Destruct(above); for (Map.Entry> entryBelow : setBelow) { String below = entryBelow.getKey(); Destruct dbelow = new Destruct(below); if (row == null) { if (!overlaps(dabove, dbelow)) continue; if (dabove.width == null || dbelow.width == null) { int qq = 1 / 0; } if (!completeWidth(dabove, dbelow)) continue; } else { if (!overlaps(dabove, drow, dbelow)) continue; if (!completeWidth(dabove, drow, dbelow)) continue; } boolean newslr = dabove.newSlr && dbelow.newSlr; if (drow != null) newslr = newslr && drow.newSlr; boolean newsud = sudable(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow); boolean newsrot; if (drow != null) newsrot = srotableW2(dabove, drow, dbelow, subtractCoeffAbove, subtractCoeffBelow); else newsrot = srotableW2(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow); String sabove = substitute(above), sbelow = substitute(below); int rowHeight = 0; if (drow != null) rowHeight = 1; if (newslr) { if (newsud) { outComplexProduct("w2", dabove.top, dbelow.bottom, sabove, sbelow, "_slr", "_sud_srot", subtractCoeffAbove, 1, null, rowHeight); } else { outSimpleProduct("w2", dabove.top, dbelow.bottom, sabove, sbelow, "_slr", subtractCoeffAbove, subtractCoeffBelow, rowHeight); } } else if (newsud) { if (newsrot) outComplexProduct("w2", dabove.top, dbelow.bottom, sabove, sbelow, "", "_sud", subtractCoeffAbove, 2, "_srot", rowHeight); else outComplexProduct("w2", dabove.top, dbelow.bottom, sabove, sbelow, "", "_sud", subtractCoeffAbove, 1, null, rowHeight); } else if (newsrot) { outComplexProduct("w2", dabove.top, dbelow.bottom, sabove, sbelow, "", "_srot", subtractCoeffAbove, 1, null, rowHeight); } else { outSimpleProduct("w2", dabove.top, dbelow.bottom, sabove, sbelow, "", subtractCoeffAbove, subtractCoeffBelow, rowHeight); } } } } boolean srotableW2(Destruct dabove, Destruct dbelow, int subtractCoeffAbove, int subtractCoeffBelow) { if (! srotW2(dabove.type).equals(dbelow.type) ) return false; if (! W2CalculatorHeight.invert(dabove.bottom).equals(dbelow.top) ) return false; if (! W2CalculatorHeight.invert(dabove.top).equals(dbelow.bottom) ) return false; if ( subtractCoeffAbove != subtractCoeffBelow) return false; if (!dabove.sameSymmetry(dbelow)) return false; return true; } boolean srotableW2(Destruct dabove, Destruct drow, Destruct dbelow, int subtractCoeffAbove, int subtractCoeffBelow) { if (!srotableW2(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow)) return false; if (!W2CalculatorHeight.invert(drow.bottom).equals(drow.bottom)) return false; return true; } String srotW2(String s) { String ret = ""; switch(s) { case "w2" : ret = "w2"; break; case "w1a" : ret = "w1b"; break; case "w1b" : ret = "w1a"; break; } return ret; } boolean overlaps(Destruct dabove, Destruct dbelow) { String[] listLetters = new String[] {"a", "b"}; for (String letter : listLetters) if (dabove.bottom.contains(letter) && dbelow.top.contains(letter)) return true; return false; } boolean overlaps(Destruct dabove, Destruct drow, Destruct dbelow) { return overlaps(dabove, drow) && overlaps(drow, dbelow); } boolean completeWidth(Destruct dabove, Destruct dbelow) { return union(dabove.width, dbelow.width).length() == 2; } boolean completeWidth(Destruct dabove, Destruct drow, Destruct dbelow) { return union(union(dabove.width, dbelow.width), drow.width).length() == 2; } String union(String s1, String s2) { String ret = ""; for (String letter : listLetters) { if (s1.contains(letter) || s2.contains(letter)) ret += letter; } return ret; } boolean sudable(Destruct dabove , Destruct dbelow , int subtractCoeffAbove, int subtractCoeffBelow) { if (!dabove.type.equals(dbelow.type)) return false; if (!dabove.sameSymmetry(dbelow)) return false; return (dabove.top.equals(dbelow.bottom) && dabove.bottom.equals(dbelow.top) && subtractCoeffAbove == subtractCoeffBelow); } void outSimpleProduct(String type, String top, String bottom, String above, String below, String sym, int subtractCoeffAbove, int subtractCoeffBelow, int rowHeight) { String newName = type + "_" + top + "_" + bottom + sym; if (suppressed(newName)) return; //String line = "prod(" + substitute(above) + "(" + subtractCoeffAbove + "), " + substitute(below) + "(" + subtractCoeffBelow + "))"; //w3_hash.get(newName).add(comment(line)); Call left = new Call(fs.getFunction(above), 2, subtractCoeffAbove); Call right = new Call(fs.getFunction(below), 2, subtractCoeffBelow); DoubleFunction f = (DoubleFunction)(fs.getFunction(newName)); f.addTerm(new HeightProduct(left , right, rowHeight , 0) , isEven); } void outComplexProduct(String type, String top, String bottom, String above, String below, String sym, String extraSym, int subtractCoeff, int subtractFromProduct, String extraSym2, int rowHeight) { String newName = type + "_" + top + "_" + bottom + sym; DoubleFunction f; //String line = "prod(" + substitute(above) + "(" + quantity + "), " + substitute(below) + "(" + quantity + ").subtract(" + subtract + "))"; //w3_hash.get(newName).add(comment(line)); above = substitute(above); below = substitute(below); if (!suppressed(newName)) { Call left = new Call(fs.getFunction(above), 2, subtractCoeff); Call right = new Call(fs.getFunction(below), 2, subtractCoeff); f = (DoubleFunction)(fs.getFunction(newName)); f.addTerm(new HeightProduct(left , right , rowHeight, subtractFromProduct) , isEven); } //introduce subtract one or two; change call form string to int String name1 = newName + extraSym; //line = substitute(above) + "(" + quantity + ")"; if (!suppressed(name1)) { f = (DoubleFunction)(fs.getFunction(name1)); f.addTerm(new HeightCall(fs.getFunction(above), 2, subtractCoeff, rowHeight) , isEven); } //w3_hash.get(name1).add(comment(line)); if (extraSym2 != null) { name1 = newName + extraSym2; //w3_hash.get(name1).add(comment(line)); if (!suppressed(name1)) { f = (DoubleFunction)(fs.getFunction(name1)); f.addTerm(new HeightCall(fs.getFunction(above), 2, subtractCoeff, rowHeight) , isEven); } } } String comment(String line) { //return line + "/* " + number + " */"; return line; } void process_w2(String s) { w2_hash.put(s, new ArrayList<>()); DoubleFunction f = new DoubleFunction(s); fs.add(f ); f.setMinimum(2); } String substitute(String in) { String out = equiv.get(in); if (out == null) return in; else return out; } boolean suppressed(String in) { String out = equiv.get(in); if (out == null) return false; else return true; } boolean slrW2(String s) { return s.equals(W2CalculatorHeight.invert(s)); } private class Destruct { boolean origSlr, sud, srot, all, newSlr; String top, bottom, type, complete, width; Destruct(String s) { origSlr = s.contains("_slr"); sud = s.contains("_sud"); srot = s.contains("_srot"); all = origSlr && sud; String t[] = s.split("_"); if (t.length < 3) { int qq = 1 / 0; } type = t[0]; top = t[1]; bottom = t[2]; complete = s; switch (type) { case "w2": case "w1": case "row": newSlr = origSlr; } switch (type) { case "w2" : width = "ab"; break; case "w1a" : width = "a"; break; case "w1b" : width = "b"; break; case "row" : width = calcRowWidth(top); break; } } String recompose() { String ret = type + "_" + top + "_" + bottom; if (newSlr) ret += "_slr"; if (sud) ret += "_sud"; if (srot) ret += "_srot"; return ret; } boolean sameSymmetry(Destruct other) { return (newSlr == other.newSlr) && (sud == other.sud) && (srot == other.srot); } String calcRowWidth(String s) { String ret = ""; String first = s.substring(0, 1); String last = s.substring(s.length() - 1); for (String letter : listLetters) { if (letter.compareTo(first) >= 0 && letter.compareTo(last) <= 0) ret += letter; } return ret; } } void loadShouldBes() { ((GenericFunction)(fs.getFunction("w2_ab_ab_slr_sud_srot"))).shouldBe(2, 1, 1); ((GenericFunction)(fs.getFunction("w2_ab_a"))).shouldBe(3, 2, 1); ((GenericFunction)(fs.getFunction("w2_b_ab"))).shouldBe(3, 2, 1); ((GenericFunction)(fs.getFunction("w2_a_ab"))).shouldBe(3, 2, 1); ((GenericFunction)(fs.getFunction("w2_ab_b"))).shouldBe(3, 2, 1); ((GenericFunction)(fs.getFunction("w2_ab_b"))).shouldBe(4, 3, 1); ((GenericFunction)(fs.getFunction("w2_b_ab"))).shouldBe(4, 3, 1); ((GenericFunction)(fs.getFunction("w2_b_a_srot"))).shouldBe(4, 3, 1); ((GenericFunction)(fs.getFunction("w2_ab_ab_slr_sud_srot"))).shouldBe(4, 2, 1); ((GenericFunction)(fs.getFunction("w2_a_a_sud"))).shouldBe(4, 3, 1); ((GenericFunction)(fs.getFunction("w2_b_b_sud"))).shouldBe(4, 3, 1); ((GenericFunction)(fs.getFunction("w2_a_b_srot"))).shouldBe(4, 3, 1); ((GenericFunction)(fs.getFunction("w2_a_ab"))).shouldBe(4, 3, 1); ((GenericFunction)(fs.getFunction("w2_ab_a"))).shouldBe(4, 3, 1); ((GenericFunction)(fs.getFunction("w2_b_b"))).shouldBe(5, 4, 2); ((GenericFunction)(fs.getFunction("w2_ab_b"))).shouldBe(5, 4, 1); ((GenericFunction)(fs.getFunction("w2_a_b"))).shouldBe(5, 4, 2); ((GenericFunction)(fs.getFunction("w2_ab_b"))).shouldBe(5, 3, 1); ((GenericFunction)(fs.getFunction("w2_b_ab"))).shouldBe(5, 4, 1); ((GenericFunction)(fs.getFunction("w2_b_ab"))).shouldBe(5, 3, 1); ((GenericFunction)(fs.getFunction("w2_ab_ab_sud"))).shouldBe(5, 3, 2); ((GenericFunction)(fs.getFunction("w2_b_a"))).shouldBe(5, 4, 2); ((GenericFunction)(fs.getFunction("w2_a_ab"))).shouldBe(5, 4, 1); ((GenericFunction)(fs.getFunction("w2_ab_a"))).shouldBe(5, 4, 1); ((GenericFunction)(fs.getFunction("w2_a_ab"))).shouldBe(5, 3, 1); ((GenericFunction)(fs.getFunction("w2_a_a"))).shouldBe(5, 4, 2); ((GenericFunction)(fs.getFunction("w2_ab_a"))).shouldBe(5, 3, 1); ((GenericFunction)(fs.getFunction("w2_b_a"))).shouldBe(6, 5, 2); //((GenericFunction)(fs.getFunction("w2_ab_ab_slr_sud_srot"))).shouldBe(6, 3, 1); ((GenericFunction)(fs.getFunction("w2_ab_b"))).shouldBe(6, 5, 1); ((GenericFunction)(fs.getFunction("w2_ab_b"))).shouldBe(6, 4, 3); ((GenericFunction)(fs.getFunction("w2_a_a"))).shouldBe(6, 5, 2); ((GenericFunction)(fs.getFunction("w2_b_a_srot"))).shouldBe(6, 5, 1); ((GenericFunction)(fs.getFunction("w2_b_b"))).shouldBe(6, 5, 2); ((GenericFunction)(fs.getFunction("w2_b_a_srot"))).shouldBe(6, 4, 1); ((GenericFunction)(fs.getFunction("w2_ab_a"))).shouldBe(6, 5, 1); ((GenericFunction)(fs.getFunction("w2_a_ab"))).shouldBe(6, 5, 1); ((GenericFunction)(fs.getFunction("w2_ab_a"))).shouldBe(6, 4, 3); ((GenericFunction)(fs.getFunction("w2_a_ab"))).shouldBe(6, 4, 3); ((GenericFunction)(fs.getFunction("w2_a_b_srot"))).shouldBe(6, 5, 1); ((GenericFunction)(fs.getFunction("w2_a_b_srot"))).shouldBe(6, 4, 1); ((GenericFunction)(fs.getFunction("w2_b_ab"))).shouldBe(6, 5, 1); ((GenericFunction)(fs.getFunction("w2_b_ab"))).shouldBe(6, 4, 3); ((GenericFunction)(fs.getFunction("w2_ab_ab_sud"))).shouldBe(6, 4, 2); ((GenericFunction)(fs.getFunction("w2_b_b_sud"))).shouldBe(6, 5, 1); ((GenericFunction)(fs.getFunction("w2_b_b_sud"))).shouldBe(6, 4, 1); ((GenericFunction)(fs.getFunction("w2_a_a_sud"))).shouldBe(6, 5, 1); ((GenericFunction)(fs.getFunction("w2_a_b"))).shouldBe(6, 5, 2); ((GenericFunction)(fs.getFunction("w2_a_a_sud"))).shouldBe(6, 4, 1); } void loadMinimums() { ((DoubleFunction)(fs.getFunction("w2_ab_ab_slr_sud_srot"))).setMinimum(2); ((DoubleFunction)(fs.getFunction("w2_ab_ab_slr_sud_srot"))).addForce(2, 1); ((DoubleFunction)(fs.getFunction("w2_ab_b"))).setMinimum(3); ((DoubleFunction)(fs.getFunction("w2_ab_b"))).addForce(3, 1); ((DoubleFunction)(fs.getFunction("w2_ab_a"))).setMinimum(3); ((DoubleFunction)(fs.getFunction("w2_ab_a"))).addForce(3, 1); ((DoubleFunction)(fs.getFunction("w2_b_ab"))).setMinimum(3); ((DoubleFunction)(fs.getFunction("w2_b_ab"))).addForce(3, 1); ((DoubleFunction)(fs.getFunction("w2_a_ab"))).setMinimum(3); ((DoubleFunction)(fs.getFunction("w2_a_ab"))).addForce(3, 1); ((DoubleFunction)(fs.getFunction("w2_b_a_srot"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w2_b_a_srot"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w2_b_b_sud"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w2_b_b_sud"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w2_a_b_srot"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w2_a_b_srot"))).addForce(4, 1); ((GenericFunction)(fs.getFunction("w2_a_ab"))).shouldBe(4, 1); ((DoubleFunction)(fs.getFunction("w2_a_a_sud"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w2_a_b"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w2_a_b"))).addForce(5, 2); ((DoubleFunction)(fs.getFunction("w2_a_a"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w2_a_a"))).addForce(5, 2); ((DoubleFunction)(fs.getFunction("w2_b_b"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w2_b_b"))).addForce(5, 2); ((DoubleFunction)(fs.getFunction("w2_b_a"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w2_b_a"))).addForce(5, 2); ((DoubleFunction)(fs.getFunction("w2_ab_ab_sud"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w2_ab_ab_sud"))).addForce(5, 2); ((DoubleFunction)(fs.getFunction("w2_ab_ab_slr_sud_srot"))).setMinimum(2, 1); ((DoubleFunction)(fs.getFunction("w2_ab_ab_slr_sud_srot"))).addForce(2, 1, 1); ((DoubleFunction)(fs.getFunction("w2_ab_a"))).setMinimum(3, 2); ((DoubleFunction)(fs.getFunction("w2_ab_a"))).addForce(3, 2, 1); ((DoubleFunction)(fs.getFunction("w2_b_ab"))).setMinimum(3, 2); ((DoubleFunction)(fs.getFunction("w2_b_ab"))).addForce(3, 2, 1); ((DoubleFunction)(fs.getFunction("w2_a_ab"))).setMinimum(3, 2); ((DoubleFunction)(fs.getFunction("w2_a_ab"))).addForce(3, 2, 1); ((DoubleFunction)(fs.getFunction("w2_ab_b"))).setMinimum(3, 2); ((DoubleFunction)(fs.getFunction("w2_ab_b"))).addForce(3, 2, 1); ((DoubleFunction)(fs.getFunction("w2_b_a_srot"))).setMinimum(4, 3); ((DoubleFunction)(fs.getFunction("w2_b_a_srot"))).addForce(4, 3, 1); ((DoubleFunction)(fs.getFunction("w2_a_a_sud"))).setMinimum(4, 3); ((DoubleFunction)(fs.getFunction("w2_a_a_sud"))).addForce(4, 3, 1); ((DoubleFunction)(fs.getFunction("w2_b_b_sud"))).setMinimum(4, 3); ((DoubleFunction)(fs.getFunction("w2_b_b_sud"))).addForce(4, 3, 1); ((DoubleFunction)(fs.getFunction("w2_a_b_srot"))).setMinimum(4, 3); ((DoubleFunction)(fs.getFunction("w2_a_b_srot"))).addForce(4, 3, 1); ((DoubleFunction)(fs.getFunction("w2_b_b"))).setMinimum(5, 4); ((DoubleFunction)(fs.getFunction("w2_b_b"))).addForce(5, 4, 2); ((DoubleFunction)(fs.getFunction("w2_a_b"))).setMinimum(5, 4); ((DoubleFunction)(fs.getFunction("w2_a_b"))).addForce(5, 4, 2); ((DoubleFunction)(fs.getFunction("w2_ab_ab_sud"))).setMinimum(5, 3); ((DoubleFunction)(fs.getFunction("w2_ab_ab_sud"))).addForce(5, 3, 2); ((DoubleFunction)(fs.getFunction("w2_b_a"))).setMinimum(5, 4); ((DoubleFunction)(fs.getFunction("w2_b_a"))).addForce(5, 4, 2); ((DoubleFunction)(fs.getFunction("w2_a_a"))).setMinimum(5, 4); ((DoubleFunction)(fs.getFunction("w2_a_a"))).addForce(5, 4, 2); } }/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.readers; import polyutil.*; import polyutil.functions.*; import java.util.*; import java.io.*; /** * * @author mason * */ public class W2W2Calculator { public ArrayList w2w2_hash; int lines; Hashtable equiv; ParameterAnalyzer pa; int size; String debugCat ; SingleFunction free; FunctionSet fs, w2fs; ArrayList w4FunctionList; W2CalculatorHeight w2Calculator; public W2W2Calculator(String params) { String[] rules = new String[] {"debugcat", "size"}; pa = new ParameterAnalyzer(params , rules); debugCat = pa.getStringValue("debugcat"); if (debugCat == null) debugCat = ""; size = pa.getIntValue("size"); } public W2W2Calculator(int size) { this.size = size; } public FunctionSet getFS() { return fs; } public ArrayList getHash() { return w2w2_hash; } public void runReader() { prepare(); doit(); } void prepare() { String curr; w2Calculator = new W2CalculatorHeight(size); w2Calculator.prepare(); w2fs = w2Calculator.getFS(); fs = new FunctionSet(); equiv = new Hashtable<>(); w2w2_hash = new ArrayList<>(); W2W2CalculatorRoutines routines = new W2W2CalculatorRoutines(equiv, w2w2_hash, fs, w2fs, size); routines.run(); } void doit() { SingleFunction free = new SingleFunction("free"); String combinations[] = new String[] {"abd", "ac", "ad", "bd", "acd"}; for (String top : combinations) for (String bottom : combinations) { String name = "2p-w2-w2_" + top + "_" + bottom; Function f = fs.getFunction(name); free.addTerm(f); } for (int i = 1; i <= 14; i++) { System.out.println(i + " " + free.value(i)); } } void addF(String combo) { DoubleFunction f; f = new DoubleFunction(combo); fs.add(f); w4FunctionList.add(f); /* W4Loop l = new W4Loop("loop_" + combo, f); fs.add(l); w4FunctionList.add(l); */ } boolean testSlr(String s) { return s.equals("abcd") || s.equals("bc") || s.equals("ad"); } static String invert(String s) { String ret = ""; for (int i = 0; i < s.length(); i++) { String t = s.substring(i, i + 1); switch(t) { case "a": ret = "d" + ret; break; case "b": ret = "c" + ret; break; case "c": ret = "b" + ret; break; case "d": ret = "a" + ret; break; } } return ret; } void outArrayDiv(ArrayList array, SingleFunction f, int div) { Collections.sort(array); String current = ""; int count = 0; for (String s : array) { if (s.equals(current)) { count++; continue; } outDiv(current, count, f, div); count = 0; current = s; count++; } outDiv(current, count, f, div); } void outDiv(String category, int count, SingleFunction f, int div) { //String portion = category; //This routine must distinguish which free* to add to int divisor = 1; if (count > 0) { Term t = new Call(fs.getFunction(category), 1, 0); //portion += "(n)"; //if (count > 1) { //portion += ".multiply(BigInteger.valueOf(" + count + "))"; //} if (category.contains("_slr_sud_srot")) { // ; // noop t = new Product(t, new Constant(count)); } else if (category.contains("_s")) { if (count == 2) ; // noop portion = category + "(n)"; else { if (count > 1) t = new Product(t, new Constant(count)); divisor = 2; //t = new Division(t, new Constant(2)); // portion = "div(" + portion + ", two)"; } } else { if (count == 4) ; // noop portion = category + "(n)"; else { if (count > 1) t = new Product(t, new Constant(count)); divisor = 4; //t = new Division(t, new Constant(4)); // portion = "div(" + portion + ", four)"; } } //out(" " + portion + ","); if (div == divisor) f.addTerm(t); //count = 0; } } String substitute(String in) { String out = equiv.get(in); if (out == null) return in; else return out; } }/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.readers; import java.math.BigInteger; import polyutil.*; import java.util.*; import java.io.*; import polyutil.functions.*; /** * * @author mason */ public class W2W2CalculatorRoutines { Hashtable equiv; int lines; public String number; String[] listLetters = new String[] {"a", "b", "c", "d"}; String[] w1 = { "w1a_a_a", "w1b_b_b", "w1c_c_c", "w1d_d_d"}; public ArrayList w2w2_hash; public Hashtable> w1_hash; public Hashtable> w2a_hash; public Hashtable> w2c_hash; public Hashtable> half; int size ; FunctionSet fs, w2fs; boolean isEven; public W2W2CalculatorRoutines(Hashtable equiv, ArrayList w2w2_hash, FunctionSet fs, FunctionSet w2fs, int size) { this.equiv = equiv; this.fs = fs; this.w2fs = w2fs; this.w2w2_hash = w2w2_hash; this.size = size; } public void run() { half = new Hashtable<>(); w1_hash = new Hashtable<>(); SingleFunction w1_l_l = new SingleFunction("w1_l_l"); w1_l_l.setMinimum(1); w1_l_l.setHard(1); for (String s : w1) { w1_hash.put(s, new ArrayList<>()); fs.add(w1_l_l, s); } w2a_hash = new Hashtable<>(); w2c_hash = new Hashtable<>(); genW2(w2a_hash, 0); genW2(w2c_hash, 2); /* we need a set of functions for below and above: w1+w1 ac, ad, bd w2+w2 w1(a) + w2 w2 + w1(d) */ SingleFunction ncolcol_ac_ac = new SingleFunction("ncolcol_ac_ac"); ncolcol_ac_ac.setMinimum(2); ncolcol_ac_ac.setOneIfEven(); SingleFunction ncolcol_ad_ad = new SingleFunction("ncolcol_ad_ad"); ncolcol_ad_ad.setMinimum(2); ncolcol_ad_ad.setOneIfEven(); SingleFunction ncolcol_bd_bd = new SingleFunction("ncolcol_bd_bd"); ncolcol_bd_bd.setMinimum(2); ncolcol_bd_bd.setOneIfEven(); half.put("ncolcol_ac_ac", new ArrayList<>()); half.put("ncolcol_ad_ad", new ArrayList<>()); half.put("ncolcol_bd_bd", new ArrayList<>()); fs.add(ncolcol_ac_ac); fs.add(ncolcol_ad_ad); fs.add(ncolcol_bd_bd); String combinations[] = new String[] {"abd", "ac", "ad", "bd", "acd"}; for (String top : combinations) for (String bottom : combinations) { String name = "2p-abcd-w2-w2_" + top + "_" + bottom; DoubleFunction f = new DoubleFunction(name); fs.add(f); w2w2_hash.add(name); half.put(name, new ArrayList<>()); } String w2rcombinations[] = new String[] {"c", "d", "cd"}; String w2lcombinations[] = new String[] {"a", "b", "ab"}; for (String top : w2rcombinations) for (String bottom : w2rcombinations) { String name = "ncolw2_" + "a" + top + "_a" + bottom; SingleFunction f = new SingleFunction(name); fs.add(f); half.put(name, new ArrayList<>()); Set>> scanner = w2c_hash.entrySet(); for (Map.Entry> w2e : scanner) { String w2s = w2e.getKey(); Destruct w2d = new Destruct(w2s); if (top.equals(w2d.top) && bottom.equals(w2d.bottom)) { f.addTerm(new W1W2Loop("w1w2Loop", fs.getFunction(w2s))); } } } for (String top : w2lcombinations) for (String bottom : w2lcombinations) { String name = "nw2col_" + top + "d_" + bottom + "d"; SingleFunction f = new SingleFunction(name); fs.add(f); half.put(name, new ArrayList<>()); Set>> scanner = w2a_hash.entrySet(); for (Map.Entry> w2e : scanner) { String w2s = w2e.getKey(); Destruct w2d = new Destruct(w2s); if (top.equals(w2d.top) && bottom.equals(w2d.bottom)) { f.addTerm(new W1W2Loop("w1w2Loop", fs.getFunction(w2s))); } } } String rows2[] = new String[] { "ac", "ad", "bd"}; String rows3[] = new String[] { "abd", "acd"}; isEven = true; mix(null, 0, 0); for (String rowComp : rows2) { String row = "row_" + rowComp + "_" + rowComp; mix(row, 1, 1); } for (String rowComp : rows3) { String row = "row_" + rowComp + "_" + rowComp; mix(row, 2, 1); mix(row, 1, 2); } isEven = false; for (String rowComp : rows2) { String row = "row_" + rowComp + "_" + rowComp; mix(row, 1, 0); mix(row, 0, 1); } for (String rowComp : rows3) { String row = "row_" + rowComp + "_" + rowComp; mix(row, 1, 1); mix(row, 2, 0); mix(row, 0, 2); } loadMinimums(); loadShouldBes(); /* ((DoubleFunction)(w3fs.getFunction("w3_l_l"))).debugValue(2); System.out.println(((DoubleFunction)(w3fs.getFunction("w3_l_l"))).value(2)); System.out.println(((DoubleFunction)(fs.getFunction("w4_a_a_sud"))).expression()); */ //System.out.println(((DoubleFunction)(fs.getFunction("w4_a_abcd"))).expression()); } void genW2(Hashtable> specific, int delta) { Set> scanner = w2fs.getScanner(); for (Map.Entry w2Entry : scanner) { String w2Name = w2Entry.getKey(); Destruct realFunction = new Destruct(w2Name); if (!realFunction.type.equals("w2")) continue; realFunction.applyDelta(0); String realFunctionName = realFunction.recompose(); if (delta > 0 ) { Destruct aliasFunction = new Destruct(w2Name); aliasFunction.applyDelta(delta); String aliasFunctionName = aliasFunction.recompose(); specific.put(aliasFunctionName, new ArrayList<>()); fs.add(w2fs.getFunction(w2Name), aliasFunctionName); } else { specific.put(realFunctionName, new ArrayList<>()); fs.add(w2fs.getFunction(w2Name), realFunctionName); } } } /* Above (or below) can be: 1. Two W2 2. W1 + W1 3. W2 + W1 or vice versa */ void mix(String row, int subtractCoeffAbove, int subtractCoeffBelow) { outRow(row, subtractCoeffAbove, subtractCoeffBelow, half, half); } private void outRow(String row, int subtractCoeffAbove, int subtractCoeffBelow, Hashtable> hAbove, Hashtable> hBelow) { Set>> setAbove = hAbove.entrySet(); Set>> setBelow = hBelow.entrySet(); Destruct drow = null; if (row != null) drow = new Destruct(row); for (Map.Entry> entryAbove : setAbove) { String above = entryAbove.getKey(); Destruct dabove = new Destruct(above); for (Map.Entry> entryBelow : setBelow) { String below = entryBelow.getKey(); Destruct dbelow = new Destruct(below); if (row == null) { if (!overlaps(dabove, dbelow)) continue; if (dabove.width == null || dbelow.width == null) { int qq = 1 / 0; } if (!completeWidth(dabove, dbelow)) continue; } else { if (!overlaps(dabove, drow, dbelow)) continue; if (!completeWidth(dabove, drow, dbelow)) continue; } boolean ok = false; switch(dabove.type + " " + dbelow.type) { case "2p-abcd-w2-w2 2p-abcd-w2-w2": ok = true; break; case "2p-abcd-w2-w2 ncolw2": ok = true; break; case "2p-abcd-w2-w2 nw2col": ok = true; break; case "2p-abcd-w2-w2 ncolcol": ok = true; break; case "ncolw2 2p-abcd-w2-w2": ok = true; break; case "nw2col 2p-abcd-w2-w2": ok = true; break; case "ncolcol 2p-abcd-w2-w2": ok = true; break; case "ncolw2 nw2col": ok = true; break; case "nw2col ncolw2": ok = true; break; case "ncolw2 ncolw2": ok = (row != null && drow.top.contains("ab")); break; case "ncolw2 ncolcol": ok = (row != null && drow.top.contains("ab")); break; case "nw2col nw2col": ok = (row != null && drow.top.contains("cd")); break; case "ncolcol nw2col": ok = (row != null && drow.top.contains("cd")); break; case "ncolcol ncolw2": ok = (row != null && drow.top.contains("ab")); break; case "nw2col ncolcol": ok = (row != null && drow.top.contains("cd")); break; case "ncolcol ncolcol": ok = false; break; default: { int ww = 1 / 0; } } if (ok) { String sabove = substitute(above), sbelow = substitute(below); outSimpleProduct("2p-abcd-w2-w2", dabove.top, dbelow.bottom, sabove, sbelow, "", subtractCoeffAbove, subtractCoeffBelow, row); } } } } boolean overlaps(Destruct dabove, Destruct dbelow) { return overlaps(dabove.bottom, dbelow.top, new String[] {"a", "b"}) && overlaps(dabove.bottom, dbelow.top, new String[] {"c", "d"}); } boolean overlaps(String above, String below, String[] listLetters) { for (String letter : listLetters) if (above.contains(letter) && below.contains(letter)) return true; return false; } boolean overlaps(Destruct dabove, Destruct drow, Destruct dbelow) { return overlaps(dabove, drow) && overlaps(drow, dbelow); } boolean completeWidth(Destruct dabove, Destruct dbelow) { return union(dabove.width, dbelow.width).length() == 4; } boolean completeWidth(Destruct dabove, Destruct drow, Destruct dbelow) { return union(union(dabove.width, dbelow.width), drow.width).length() == 4; } String union(String s1, String s2) { String ret = ""; for (String letter : listLetters) { if (s1.contains(letter) || s2.contains(letter)) ret += letter; } return ret; } /* void outSimpleProduct(String type, String top, String bottom, String above, String below, String sym, int quantity) { outSimpleProduct( type, top, bottom, above, below, sym, quantity, quantity); } */ void outSimpleProduct(String type, String top, String bottom, String above, String below, String sym, int subtractCoeffAbove, int subtractCoeffBelow, String row) { String newName = type + "_" + top + "_" + bottom + sym; //System.out.println(newName); if (suppressed(newName)) return; //String line = "prod(" + substitute(above) + "(" + subtractCoeffAbove + "), " + substitute(below) + "(" + subtractCoeffBelow + "))"; //w3_hash.get(newName).add(comment(line)); Product p = new Product(new Call(fs.getFunction(above), 2, subtractCoeffAbove), new Call(fs.getFunction(below), 2, subtractCoeffBelow)); //p.setRow(row); ((DoubleFunction)(fs.getFunction(newName))).addTerm(p , isEven); } String comment(String line) { //return line + "/* " + number + " */"; return line; } String substitute(String in) { String out = equiv.get(in); if (out == null) return in; else return out; } boolean suppressed(String in) { String out = equiv.get(in); if (out == null) return false; else return true; } private class Destruct { boolean origSlr, sud, srot, all, newSlr; String list = "abcd"; String top, bottom, type, complete, width; Destruct(String s) { origSlr = s.contains("_slr"); sud = s.contains("_sud"); srot = s.contains("_srot"); all = origSlr && sud; String t[] = s.split("_"); if (t.length < 3) { int qq = 1 / 0; } type = t[0]; top = t[1]; bottom = t[2]; complete = s; switch (type) { //case "w2": case "w4": case "row": newSlr = origSlr; } if (type.startsWith("2p")) newSlr = origSlr; switch (type) { case "w2a" : width = "ab"; break; case "w2b" : width = "bc"; break; case "w2c" : width = "cd"; break; case "w1a" : width = "a"; break; case "w1b" : width = "b"; break; case "w1c" : width = "c"; break; case "w1d" : width = "d"; break; case "row" : width = calcRowWidth(top); break; case "ncolw2": case "nw2col": case "ncolcol": case "2p-abcd-w2-w2" : width = "abcd"; break; } } String recompose() { String ret = type + "_" + top + "_" + bottom; if (origSlr) ret += "_slr"; if (sud) ret += "_sud"; if (srot) ret += "_srot"; return ret; } boolean sameSymmetry(Destruct other) { return (newSlr == other.newSlr) && (sud == other.sud) && (srot == other.srot); } String calcRowWidth(String s) { String ret = ""; String first = s.substring(0, 1); String last = s.substring(s.length() - 1); for (String letter : listLetters) { if (letter.compareTo(first) >= 0 && letter.compareTo(last) <= 0) ret += letter; } return ret; } String calcRowWidth2(String top, String bottom) { return union(calcRowWidth(top), calcRowWidth(bottom)); } void applyDelta(int delta) { type += list.substring(delta, delta + 1); top = applyDelta(top, delta); bottom = applyDelta(bottom, delta); if (type.equals("w2b") && origSlr) newSlr = true; } String applyDelta(String in, int delta) { String ret = ""; for (int i = 0; i < in.length(); i++) { String s = in.substring(i, i + 1); int pos = list.indexOf(s) + delta; ret += list.substring(pos , pos + 1); } if (ret.equals("ada")) { int qq = 1 / 0; } return ret; } } /* class Container { ArrayList odd, even; } */ void loadShouldBes() { } void loadMinimums() { } }/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.readers; import polyutil.*; import polyutil.functions.*; import java.util.*; import java.io.*; /** * * @author mason * */ public class W3CalculatorABC { int lines; Hashtable equiv; ParameterAnalyzer pa; int size; String debugCat ; boolean code; SingleFunction free; FunctionSet fs, w2fs; static String[] w3Combinations = {"a", "b", "c", "ab", "ac", "bc", "abc"}; ArrayList w3FunctionList; W2CalculatorHeight w2Calculator; public W3CalculatorABC( String params) { String[] rules = new String[] {"debugcat", "size", "code"}; pa = new ParameterAnalyzer(params , rules); debugCat = pa.getStringValue("debugcat"); if (debugCat == null) debugCat = ""; size = pa.getIntValue("size", 0); code = pa.getBooleanValue("code", false); } public W3CalculatorABC(int size) { this.size = size; } public FunctionSet getFS() { return fs; } public void runReader() { prepare(); doit(); } public void prepare() { String curr; w2Calculator = new W2CalculatorHeight(size); w2Calculator.prepare(); w2fs = w2Calculator.getFS(); fs = new FunctionSet(); equiv = new Hashtable<>(); w3FunctionList = new ArrayList<>(); /* for (String top : w3Combinations) { for (String bottom : w3Combinations) { String combo = "w3_" + top + "_" + bottom; boolean slr = testSlr(top) && testSlr(bottom); boolean sud = top.equals(bottom); boolean srot = top.equals(invert(bottom)); addF(combo); if (slr && sud) { addF(combo + "_slr_sud_srot"); } if (slr ) { addF(combo + "_slr"); } if (sud ) { addF(combo + "_sud"); } if (srot ) { addF(combo + "_srot"); } } } */ W3CalculatorRoutinesABC routines = new W3CalculatorRoutinesABC(equiv, fs, w2fs, size); routines.run(); //System.err.println("term count " + Term.termCount); free = new SingleFunction("free"); SingleFunction free1 = new SingleFunction("free1"); SingleFunction free2 = new SingleFunction("free2"); SingleFunction free4 = new SingleFunction("free4"); free.addTerm(free1); free.addTerm(new Division(free2, new Constant(2))); free.addTerm(new Division(free4, new Constant(4))); ArrayList freeList = new ArrayList<>(); for(String w3name : routines.w3_hash) { freeList.add(substitute(w3name)); } outArrayDiv(freeList, free1, 1); outArrayDiv(freeList, free2, 2); outArrayDiv(freeList, free4, 4); SingleFunction delta = new SingleFunction("delta"); free.addTerm(delta); delta.setHard(0); /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0, 0, 0, 3, 5, 5, 1 */ delta.addForce(5, -3); delta.addForce(6, -5); delta.addForce(7, -5); delta.addForce(8, -1); } void doit() { if ( !code) { for (int i = 1 ; i <= size; i++) { System.out.println(i + " " + free.value(i)); } } if (code) { Hashtable done = new Hashtable<>(); ArrayList todo = new ArrayList<>(); todo.add(free); for (int i = 0; i < todo.size(); i++) { GenericFunction f = todo.get(i); if (done.get(f.getName()) == null) { //System.err.println(f.getName()); done.put(f.getName(), f.getName()); todo.addAll(f.getDependentFunctions(true)); System.out.println(f.expression()); } } } } static String invert(String s) { String ret = ""; for (int i = 0; i < s.length(); i++) { String t = s.substring(i, i + 1); switch(t) { case "a": ret = "c" + ret; break; case "b": ret = "b" + ret; break; case "c": ret = "a" + ret; break; } } return ret; } void outArrayDiv(ArrayList array, SingleFunction f, int div) { Collections.sort(array); String current = ""; int count = 0; for (String s : array) { if (s.equals(current)) { count++; continue; } outDiv(current, count, f, div); count = 0; current = s; count++; } outDiv(current, count, f, div); } void outDiv(String category, int count, SingleFunction f, int div) { //String portion = category; //This routine must distinguish which free* to add to int divisor = 1; if (count > 0) { Term t = new Call(fs.getFunction(category), 1, 0); //portion += "(n)"; //if (count > 1) { //portion += ".multiply(BigInteger.valueOf(" + count + "))"; //} if (category.contains("_slr_sud_srot")) { // ; // noop t = new Product(t, new Constant(count)); } else if (category.contains("_s")) { if (count == 2) ; // noop portion = category + "(n)"; else { if (count > 1) t = new Product(t, new Constant(count)); divisor = 2; //t = new Division(t, new Constant(2)); // portion = "div(" + portion + ", two)"; } } else { if (count == 4) ; // noop portion = category + "(n)"; else { if (count > 1) t = new Product(t, new Constant(count)); divisor = 4; //t = new Division(t, new Constant(4)); // portion = "div(" + portion + ", four)"; } } //out(" " + portion + ","); if (div == divisor) f.addTerm(t); //count = 0; } } String substitute(String in) { String out = equiv.get(in); if (out == null) return in; else return out; } }/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.readers; import java.math.BigInteger; import polyutil.*; import java.util.*; import java.io.*; import polyutil.functions.*; /** * * @author mason */ public class W3CalculatorRoutinesABC { Hashtable equiv; int lines; public String number; String[] listLetters = new String[] {"a", "b", "c"}; //String[] ncolcol_above = { "ncolcol_l_lr", "ncolcol_r_lr", "ncolcol_lr_lr_slr"}; //String[] ncolcol_below = { "ncolcol_lr_l", "ncolcol_lr_r", "ncolcol_lr_lr_slr"}; String[] w1 = { "w1a_a_a", "w1b_b_b_slr", "w1c_c_c"}; SingleFunction fun_n //, fun_one_if_even ; ArrayList w3_hash; ArrayList w1_hash; ArrayList w2_hash; ArrayList w2a_hash; ArrayList w2b_hash; ArrayList p2_hash_up, p2_hash_down; ArrayList sum_p2_hash_up, sum_p2_hash_down; String[] mix3; int size ; FunctionSet fs, w2fs; boolean isEven; public W3CalculatorRoutinesABC(Hashtable equiv, FunctionSet fs, FunctionSet w2fs, int size) { this.equiv = equiv; this.fs = fs; this.w2fs = w2fs; this.size = size; mix3 = new String[] { "a", "b", "c", "ab", "ac" , "bc" , "abc" }; } public void run() { fun_n = new SingleFunction("fun_n"); fun_n.setFunN(); //fun_one_if_even = new SingleFunction("fun_one_if_even"); //fun_one_if_even.setOneIfEven(); w3_hash = new ArrayList<>(); p2_hash_up = new ArrayList<>(); p2_hash_down = new ArrayList<>(); sum_p2_hash_up = new ArrayList<>(); sum_p2_hash_down = new ArrayList<>(); for (String above : W3CalculatorABC.w3Combinations) { for (String below : W3CalculatorABC.w3Combinations) { String prefix = "w3_" + above + "_" + below; process_w3(prefix); boolean bslr = slrW3(above) && slrW3(below); if (bslr) process_w3(prefix + "_slr"); boolean bsud = above.equals(below); if (bsud) process_w3(prefix + "_sud"); boolean bsrot = above.equals(W3CalculatorABC.invert(below)); if (bsrot) process_w3(prefix + "_srot"); if (bsrot && bslr) { process_w3(prefix + "_slr_sud_srot"); } } } w1_hash = new ArrayList<>(); SingleFunction w1_l_l = new SingleFunction("w1_l_l"); w1_l_l.setMinimum(1); w1_l_l.setHard(1); for (String s : w1) { w1_hash.add(s); fs.add(w1_l_l, s); } w2_hash = new ArrayList<>(); w2a_hash = new ArrayList<>(); w2b_hash = new ArrayList<>(); genW2(w2a_hash, 0); genW2(w2b_hash, 1); case_i(); case_iii(); case_iv(); summarise(); ((SingleFunction)(fs.getFunction("2pu-abc_ac_ac"))).setMinimum(5); ((SingleFunction)(fs.getFunction("2pd-abc_ac_ac"))).setMinimum(5); String rows1[] = new String[] {"a", "b", "c"}; String rows2[] = new String[] {"ab", "ac", "bc"}; String rows3[] = new String[] {"abc"}; isEven = true; mix(null, 0, 0); for (String rowComp : rows2) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("ac" )) row += "_slr"; mix(row, 1, 1); } for (String rowComp : rows3) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("abc" )) row += "_slr"; mix(row, 2, 1); mix(row, 1, 2); } isEven = false; for (String rowComp : rows1) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("b" )) row += "_slr"; mix(row, 0, 0); } for (String rowComp : rows2) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("ac" ) ) row += "_slr"; mix(row, 1, 0); mix(row, 0, 1); } for (String rowComp : rows3) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("abc" )) row += "_slr"; mix(row, 1, 1); mix(row, 2, 0); mix(row, 0, 2); } loadMinimums(); loadShouldBes(); } void genW2(ArrayList specific, int delta) { Set> scanner = w2fs.getScanner(); for (Map.Entry w2Entry : scanner) { String w2Name = w2Entry.getKey(); Destruct realFunction = new Destruct(w2Name); if (!realFunction.type.equals("w2")) continue; realFunction.applyDelta(0); String realFunctionName = realFunction.recompose(); if (delta > 0 ) { Destruct aliasFunction = new Destruct(w2Name); aliasFunction.applyDelta(delta); String aliasFunctionName = aliasFunction.recompose(); w2_hash.add(aliasFunctionName); specific.add(aliasFunctionName); fs.add(w2fs.getFunction(w2Name), aliasFunctionName); } else { w2_hash.add(realFunctionName); specific.add(realFunctionName); fs.add(w2fs.getFunction(w2Name), realFunctionName); } } } void summarise() { summarise(p2_hash_down, sum_p2_hash_down, "d"); summarise(p2_hash_up, sum_p2_hash_up, "u"); } void summarise(ArrayList old, ArrayList sum, String dir ) { for (String name : old) { if (name.contains("ca")) { int qq = 1 / 0; } Destruct d = new Destruct(name); String[] bits = d.type.split("-"); // 2pd-abcd-w1-w1 d.type = "2p" + dir + "-" + bits[1]; String newName = d.recompose(); if (!sum.contains(newName)) { sum.add(newName); SingleFunction f = new SingleFunction(newName); fs.add(f); if (newName.equals("2pu_ad_ad_slr")) { int dbg = 1; } } SingleFunction f = ((SingleFunction)(fs.getFunction(newName))); if (f.getName().equals("2pu_ab_ac")) { //System.out.println("adding " + name); } f.addTerm(((Function)(fs.getFunction(name)))); } } void mix(String row, int subtractCoeffAbove, int subtractCoeffBelow) { //System.err.println("mix " + row); ArrayList[] listPolyAbove , listPolyBelow; listPolyAbove = new ArrayList[4]; listPolyAbove[0] = w3_hash; listPolyAbove[1] = w2_hash; listPolyAbove[2] = w1_hash; listPolyAbove[3] = sum_p2_hash_up; listPolyBelow = new ArrayList[4]; listPolyBelow[0] = w3_hash; listPolyBelow[1] = w2_hash; listPolyBelow[2] = w1_hash; listPolyBelow[3] = sum_p2_hash_down; for (ArrayList hAbove : listPolyAbove) { for ( ArrayList hBelow : listPolyBelow) { if (row == null) { //if (hAbove == w2w2_hash && hBelow == w2w2_hash) continue; if (hAbove == w1_hash && hBelow != w3_hash) continue; if (hAbove != w3_hash && hBelow == w1_hash) continue; //if (hAbove == w2_hash && hBelow == w2_hash) continue; } if (row != null && !row.startsWith("row_abc_abc")) { if (hAbove == w1_hash && hBelow == w1_hash) continue; } if (row != null && !row.contains("bc")) { if (hAbove == sum_p2_hash_up && hBelow == w1_hash) continue; if (hAbove == w1_hash && hBelow == sum_p2_hash_up) continue; if (hAbove == sum_p2_hash_down && hBelow == w1_hash) continue; if (hAbove == w1_hash && hBelow == sum_p2_hash_down) continue; } outRow(row, subtractCoeffAbove, subtractCoeffBelow, hAbove, hBelow); } } } private void outRow(String row, int subtractCoeffAbove, int subtractCoeffBelow, ArrayList hAbove, ArrayList hBelow) { Destruct drow = null; if (row != null) drow = new Destruct(row); for (String above : hAbove) { Destruct dabove = new Destruct(above); for (String below : hBelow) { //if (above.equals("w2a_a_ab") && below.equals("w2b_bc_c") && drow == null) { if (above.startsWith("w3_a_abc") && below.startsWith("2pd-abc_ac_a") && drow != null && drow.top.equals("ac")) { int dbg = 1; } Destruct dbelow = new Destruct(below); if (row == null) { if (!overlaps(dabove, dbelow)) continue; if (dabove.width == null || dbelow.width == null) { int qq = 1 / 0; } if (!completeWidth(dabove, dbelow)) continue; if (dabove.type.startsWith("2p") && dbelow.type.startsWith("2p")) continue; if (dabove.type.startsWith("2p") && dbelow.type.startsWith("w2a")) continue; if (dabove.type.startsWith("2p") && dbelow.type.startsWith("w2b")) continue; if (dabove.type.startsWith("w2a") && dbelow.type.startsWith("2p")) continue; if (dabove.type.startsWith("w2b") && dbelow.type.startsWith("2p")) continue; if (dabove.type.startsWith("2p") || dbelow.type.startsWith("2p")) { if (!overlaps(dabove, dbelow, "a") || !overlaps(dabove, dbelow, "c")) continue; } } else { if (!drow.top.equals("abc") && dabove.type.startsWith("2p") && dbelow.type.startsWith("2p")) continue; if (!overlaps(dabove, drow, dbelow)) continue; if (!completeWidth(dabove, drow, dbelow)) continue; if (dabove.type.startsWith("2p")) { if (!overlaps(dabove, drow, "a") || !overlaps(dabove, drow, "c")) continue; } if (dbelow.type.startsWith("2p")) { if (!overlaps(drow, dbelow, "a") || !overlaps(drow, dbelow, "c")) continue; } if (!drow.top.contains("b")) { boolean aboveLeft = overlaps(dabove, drow, "a"); boolean aboveRight = overlaps(dabove, drow, "c"); boolean belowLeft = overlaps( drow, dbelow, "a"); boolean belowRight = overlaps( drow, dbelow, "c"); if ((aboveLeft && belowLeft) || (aboveRight && belowRight)) ; // noop else continue; } } boolean newslr = dabove.newSlr && dbelow.newSlr; if (drow != null) newslr = newslr && drow.newSlr; boolean newsud = sudable(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow); boolean newsrot; if (drow != null) newsrot = srotableW3(dabove, drow, dbelow, subtractCoeffAbove, subtractCoeffBelow); else newsrot = srotableW3(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow); String sabove = substitute(above), sbelow = substitute(below); String trow = ""; if (row != null) trow = drow.top; String comment = dabove.bottom + "/" + trow + "/" + dbelow.top; if (comment.equals("ab/ac/ab")) { int dbg = 1; } if (newslr) { if (newsud) { outComplexProduct("w3", dabove.top, dbelow.bottom, sabove, sbelow, "_slr", "_sud_srot", subtractCoeffAbove, 1, comment); } else { outSimpleProduct("w3", dabove.top, dbelow.bottom, sabove, sbelow, "_slr", subtractCoeffAbove, subtractCoeffBelow, comment); } } else if (newsud) { if (newsrot) outComplexProduct("w3", dabove.top, dbelow.bottom, sabove, sbelow, "", "_sud", subtractCoeffAbove, 2, "_srot", comment); else outComplexProduct("w3", dabove.top, dbelow.bottom, sabove, sbelow, "", "_sud", subtractCoeffAbove, 1, comment); } else if (newsrot) { if (dabove.top.equals("b") && dbelow.bottom.equals("ab")) { int dbg = 1; } outComplexProduct("w3", dabove.top, dbelow.bottom, sabove, sbelow, "", "_srot", subtractCoeffAbove, 1, comment); } else { outSimpleProduct("w3", dabove.top, dbelow.bottom, sabove, sbelow, "", subtractCoeffAbove, subtractCoeffBelow, comment); } } } } boolean srotableW3(Destruct dabove, Destruct dbelow, int subtractCoeffAbove, int subtractCoeffBelow) { if (! srotW3(dabove.type).equals(dbelow.type) ) { return false; } if (! W3CalculatorABC.invert(dabove.bottom).equals(dbelow.top) ) return false; if (! W3CalculatorABC.invert(dabove.top).equals(dbelow.bottom) ) return false; if ( subtractCoeffAbove != subtractCoeffBelow) return false; if (!dabove.sameOrigSymmetry(dbelow)) return false; return true; } boolean srotableW3(Destruct dabove, Destruct drow, Destruct dbelow, int subtractCoeffAbove, int subtractCoeffBelow) { if (!srotableW3(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow)) return false; if (!W3CalculatorABC.invert(drow.bottom).equals(drow.bottom)) return false; return true; } String srotW3(String s) { String ret = ""; switch(s) { case "w3" : ret = "w3"; break; case "w2a" : ret = "w2b"; break; case "w2b" : ret = "w2a"; break; case "w1a" : ret = "w1c"; break; case "w1b" : ret = "w1b"; break; case "w1c" : ret = "w1a"; break; case "2pd-abc" : ret = "2pu-abc"; break; case "2pd-ac" : ret = "2pu-ac"; break; case "2pu-abc" : ret = "2pd-abc"; break; case "2pu-ac" : ret = "2pd-ac"; break; default: { int qq = 1 / 0; } break; } return ret; } boolean overlaps(Destruct dabove, Destruct dbelow) { String[] listLetters = new String[] {"a", "b", "c"}; for (String letter : listLetters) if (dabove.bottom.contains(letter) && dbelow.top.contains(letter)) return true; return false; } boolean overlaps(Destruct dabove, Destruct dbelow, String intersect) { String[] listLetters = new String[] {"a", "b", "c"}; for (String letter : listLetters) if (dabove.bottom.contains(letter) && dbelow.top.contains(letter) && intersect.contains(letter)) return true; return false; } boolean overlaps(Destruct dabove, Destruct drow, Destruct dbelow) { if (drow.top.equals("ac")) { if (!dabove.bottom.contains("c") && !dbelow.top.contains("c")) return false; if (!dabove.bottom.contains("a") && !dbelow.top.contains("a")) return false; if (!dabove.bottom.contains("a") && !dbelow.top.contains("c")) return false; if (!dabove.bottom.contains("c") && !dbelow.top.contains("a")) return false; if (dabove.type.startsWith("2p") && !(dbelow.top.contains("a") && dbelow.top.contains("c"))) return false; if (dbelow.type.startsWith("2p") && !(dabove.bottom.contains("a") && dabove.bottom.contains("c"))) return false; } return overlaps(dabove, drow) && overlaps(drow, dbelow); } boolean completeWidth(Destruct dabove, Destruct dbelow) { return union(dabove.width, dbelow.width).length() == 3; } boolean completeWidth(Destruct dabove, Destruct drow, Destruct dbelow) { return union(union(dabove.width, dbelow.width), drow.width).length() == 3; } String union(String s1, String s2) { String ret = ""; for (String letter : listLetters) { if (s1.contains(letter) || s2.contains(letter)) ret += letter; } return ret; } String intersect(String s1, String s2) { String ret = ""; for (int i = 0; i < s1.length(); i++) { String letter = s1.substring(i, i + 1); if (s2.contains(letter)) ret += letter; } return ret; } // 2pu-abc_ac_ac 2pd-abcd_ac_ac boolean sudable(Destruct dabove , Destruct dbelow , int subtractCoeffAbove, int subtractCoeffBelow) { if (!dabove.type.equals(dbelow.type)) { if (dabove.type.startsWith("2p") && dbelow.type.startsWith("2p")) { String aboveBits[] = dabove.type.split("-"); String belowBits[] = dbelow.type.split("-"); if (!aboveBits[1].equals(belowBits[1])) return false; } else return false; } if (!dabove.sameOrigSymmetry(dbelow)) return false; return (dabove.top.equals(dbelow.bottom) && dabove.bottom.equals(dbelow.top) && subtractCoeffAbove == subtractCoeffBelow); } Hashtable osph; String eo() { if (isEven) return "even"; else return "odd"; } void outSimpleProduct(String type, String top, String bottom, String above, String below, String sym, int subtractCoeffAbove, int subtractCoeffBelow, String comment) { String newName = type + "_" + top + "_" + bottom + sym; if (suppressed(newName)) return; if (osph == null) osph = new Hashtable<>(); String leftName = "accum_" + newName + "_" + above + "_" + subtractCoeffAbove + "_" + eo() ; Call left = new Call(fs.getFunction(above), 2, subtractCoeffAbove); Call right = new Call(fs.getFunction(below), 2, subtractCoeffBelow); //if (newName.equals("w4_a_a") && leftName.equals("w4_a_a+2pu-abc_a_ac+1+2+")) { if (true) { // new version SingleFunction rightFun = osph.get(leftName); if (rightFun == null) { rightFun = new SingleFunction(leftName); rightFun.debug = 9; osph.put(leftName, rightFun); fs.add(rightFun, leftName); Product p = new Product(left, rightFun); p.comment = comment; ((DoubleFunction)(fs.getFunction(newName))).addTerm(p , isEven); } rightFun.addTerm(right); } else { Product p = new Product(left, right); p.comment = comment; ((DoubleFunction)(fs.getFunction(newName))).addTerm(p , isEven); } } void outComplexProduct(String type, String top, String bottom, String above, String below, String sym, String extraSym, int subtractCoeff, int subtractFromProduct, String comment) { outComplexProduct(type, top, bottom, above, below, sym, extraSym, subtractCoeff, subtractFromProduct, null, comment) ; } void outComplexProduct(String type, String top, String bottom, String above, String below, String sym, String extraSym, int subtractCoeff, int subtractFromProduct, String extraSym2, String comment) { String newName = type + "_" + top + "_" + bottom + sym; //String line = "prod(" + substitute(above) + "(" + quantity + "), " + substitute(below) + "(" + quantity + ").subtract(" + subtract + "))"; //w3_hash.get(newName).add(comment(line)); above = substitute(above); below = substitute(below); if (!suppressed(newName)) { Product p = new Product(new Call(fs.getFunction(above), 2, subtractCoeff), new Subtraction(new Call(fs.getFunction(below), 2, subtractCoeff), new Constant(subtractFromProduct))); p.comment = comment; ((DoubleFunction)(fs.getFunction(newName))).addTerm(p , isEven); } //introduce subtract one or two; change call form string to int String name1 = newName + extraSym; //line = substitute(above) + "(" + quantity + ")"; if (!suppressed(name1)) { Call c = new Call(fs.getFunction(above), 2, subtractCoeff); c.comment = comment; DoubleFunction df = ((DoubleFunction)(fs.getFunction(name1))); df.addTerm(c , isEven); } //w3_hash.get(name1).add(comment(line)); if (extraSym2 != null) { name1 = newName + extraSym2; //w3_hash.get(name1).add(comment(line)); if (!suppressed(name1)) { Call c = new Call(fs.getFunction(above), 2, subtractCoeff); c.comment = comment; ((DoubleFunction)(fs.getFunction(name1))).addTerm(c , isEven); } } } String comment(String line) { //return line + "/* " + number + " */"; return line; } void process_w3(String s) { w3_hash.add(s); fs.add(new DoubleFunction(s)); } String substitute(String in) { String out = equiv.get(in); if (out == null) return in; else return out; } boolean suppressed(String in) { String out = equiv.get(in); if (out == null) return false; else return true; } boolean slrW3(String s) { switch (s) { case "abc": case "b": case "ac": return true; default: return false; } } boolean slrW4(String s) { return s.equals(W3CalculatorABC.invert(s)); } String invW3(String s) { String ret = ""; if (s.contains("a")) ret += "c"; if (s.contains("b")) ret += "b"; if (s.contains("c")) ret += "a"; return ret; } /* i. Two W1 pillars of equal or differing height, in positions ac: O O O O O O O */ void case_i() { /* Going up: 2p-w1-w1_a_ac, 2p-w1-w1_c_ac, 2p-w1-w1_ac_ac; then repeat with letters ad and bd Going down: 2p-w1-w1_ac_a, 2p-w1-w1_ac_c, 2p-w1-w1_ac_ac; then repeat with letters ad and bd */ case_i("a", "c", "abc"); } SingleFunction case_i_up = new SingleFunction("case_i_up"); SingleFunction case_i_down = new SingleFunction("case_i_down"); void case_i(String left, String right, String width) { case_i(this.p2_hash_up, case_i_up, left, left + right, "u", width); case_i(this.p2_hash_up, case_i_up, right, left + right, "u", width); case_i(this.p2_hash_up, case_i_up, left + right, left + right, "u", width); case_i(this.p2_hash_down, case_i_down, left + right, left, "d", width); case_i(this.p2_hash_down, case_i_down, left + right, right, "d", width); case_i(this.p2_hash_down, case_i_down, left + right, left + right, "d", width); fs.add(case_i_up); fs.add(case_i_down); } boolean case_i_first = true; String case_i_first_name; SingleFunction case_i_first_fun; boolean case_i_first_eq = true; String case_i_first_name_eq; SingleFunction case_i_first_fun_eq; void case_i(ArrayList h, SingleFunction accum, String top, String bottom, String upDown, String width) { String name = "2p" + upDown + "-" + width + "-w1-w1_" + top + "_" + bottom; if (top.equals(bottom) && top.equals("ac")) name += "_slr"; h.add(name); if (top.equals(bottom)) { if (case_i_first_eq) { //case_i_first_eq = false; case_i_first_name_eq = name; case_i_first_fun_eq = new SingleFunction(name); fs.add(case_i_first_fun_eq); case_i_first_fun_eq.setOneIfEven(); accum.addTerm(case_i_first_fun_eq); } else { equiv.put(name, case_i_first_name_eq); accum.addTerm(case_i_first_fun_eq); fs.add(case_i_first_fun_eq, name); } } else { if (case_i_first) { //case_i_first = false; case_i_first_name = name; case_i_first_fun = new SingleFunction(name); fs.add(case_i_first_fun); case_i_first_fun.addTerm(new Call(fun_n, 1, 2, 0)); accum.addTerm(case_i_first_fun); } else { equiv.put(name, case_i_first_name); accum.addTerm(case_i_first_fun); fs.add(case_i_first_fun, name); } } } /* iii. Two W1 pillars, one of which supports a W2 that occupies a column adjacent to that of the W1. Consider the two pillars to be of the same height, and the W2 to have a bottom that overlaps the supporting W1 OO O O O O */ SingleFunction case_iii_up = new SingleFunction("case_iii_up"); SingleFunction case_iii_down = new SingleFunction("case_iii_down"); void case_iii() { case_iii(this.p2_hash_up, w2b_hash, case_iii_up, true, true, "a", "c", "b", "abc"); case_iii(this.p2_hash_down, w2b_hash, case_iii_down, false, true, "a", "c", "b", "abc"); case_iii(this.p2_hash_up, w2a_hash, case_iii_up, true, false, "c", "a", "b", "abc"); case_iii(this.p2_hash_down, w2a_hash, case_iii_down, false, false, "c", "a", "b", "abc"); fs.add(case_iii_up); fs.add(case_iii_down); } void case_iii(ArrayList h, ArrayList specific, SingleFunction accum, boolean up, boolean w1FreeLeft, String baseFreeW1, String baseSupportW1, String otherW2, String width) { String[] basesW2 = new String[2], extremetiesW2 = new String[3]; if (w1FreeLeft) { basesW2[0] = baseSupportW1; basesW2[1] = otherW2 + baseSupportW1; extremetiesW2[0] = baseSupportW1; extremetiesW2[1] = otherW2 + baseSupportW1; extremetiesW2[2] = otherW2 ; } else { basesW2[0] = baseSupportW1; basesW2[1] = baseSupportW1 + otherW2 ; extremetiesW2[0] = baseSupportW1; extremetiesW2[1] = baseSupportW1 + otherW2; extremetiesW2[2] = otherW2 ; } for (String extremityW2 : extremetiesW2) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-" + width + "-"; if (w1FreeLeft) name += "w1-w1w2_" + extremityW2 + "_" + baseFreeW1 + baseSupportW1; else name += "w1w2-w1_" + extremityW2 + "_" + baseSupportW1 + baseFreeW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-" + width + "-"; if (w1FreeLeft) name += "w1-w1w2_" + baseFreeW1 + baseSupportW1 + "_" + extremityW2 ; else name += "w1w2-w1_" + baseSupportW1 + baseFreeW1 + "_" + extremityW2; } if (name.equals("2pu-w1w2-w1_ab_ac")) { //System.out.println(name); } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specific) { Destruct d = new Destruct(w2fun); if ((up && d.bottom.contains(baseSupportW1) && d.top.equals(extremityW2)) || (!up && d.top.contains(baseSupportW1) && d.bottom.equals(extremityW2))) { W4Loop w = new W4Loop("loop-" + w2fun, fs.getFunction(w2fun)); f.addTerm(w); } } } } /* iv. Two W1 pillars, one of which supports a W3 that invades the territory of the W1. Consider that the two W1 have the same height and that the bottom of the W3 (a) overlaps the supporting W1, and (b) does not overlap the other W1 OOO OO O O Combinations: W1 on a, W3 on c W1 on b, W3 on d W1 on d, W3 on b W1 on c, W3 on a 2p-w1-w1w3inv or 2p-w1w3inv-w1 possible tops are a,b,c,ab,ac,bc,abc */ SingleFunction case_iv_up = new SingleFunction("case_iv_up"); SingleFunction case_iv_down = new SingleFunction("case_iv_down"); void case_iv() { case_iv(this.p2_hash_up, w3_hash, case_iv_up, true, true, "a", "c", "b", "abc"); case_iv(this.p2_hash_up, w3_hash, case_iv_up, true, false, "c", "a", "b", "abc"); case_iv(this.p2_hash_down, w3_hash, case_iv_down, false, true, "a", "c", "b", "abc"); case_iv(this.p2_hash_down, w3_hash, case_iv_down, false, false, "c", "a", "b", "abc"); fs.add(case_iv_up); fs.add(case_iv_down); } void case_iv(ArrayListh, ArrayList specific, SingleFunction accum, boolean up, boolean w1FreeLeft, String baseFreeW1, String baseSupportW1, String otherW3, String width) { String[] basesW3 = new String[2], extremetiesW3 = new String[7]; if (w1FreeLeft) { basesW3[0] = baseSupportW1; basesW3[1] = otherW3 + baseSupportW1; extremetiesW3[0] = baseSupportW1; extremetiesW3[1] = otherW3; extremetiesW3[2] = baseFreeW1 ; extremetiesW3[3] = otherW3 + baseSupportW1; extremetiesW3[4] = baseFreeW1 + otherW3; extremetiesW3[5] = baseFreeW1 + baseSupportW1 ; extremetiesW3[6] = baseFreeW1 + otherW3 + baseSupportW1 ; } else { basesW3[0] = baseSupportW1; basesW3[1] = baseSupportW1 + otherW3 ; extremetiesW3[0] = baseSupportW1; extremetiesW3[1] = otherW3; extremetiesW3[2] = baseFreeW1 ; extremetiesW3[3] = baseSupportW1 + otherW3; extremetiesW3[4] = otherW3 + baseFreeW1; extremetiesW3[5] = baseSupportW1 + baseFreeW1; extremetiesW3[6] = baseSupportW1 + otherW3 + baseFreeW1; } for (String extremityW3 : extremetiesW3) { String name = "2p"; if (up) { // going up name += "u-" + width + "-"; if (w1FreeLeft) name += "w1-w1w3inv_" + extremityW3 + "_" + baseFreeW1 + baseSupportW1; else name += "w1w3inv-w1_" + extremityW3 + "_" + baseSupportW1 + baseFreeW1 ; } else { // going down name += "d-" + width + "-"; if (w1FreeLeft) name += "w1-w1w3inv_" + baseFreeW1 + baseSupportW1 + "_" + extremityW3 ; else name += "w1w3inv-w1_" + baseSupportW1 + baseFreeW1 + "_" + extremityW3 ; } boolean dbgb = false; //if (name.equals("2pd-w1w3inv-w1_ac_bc")) // dbgb = true; h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String baseW3 : basesW3) { for (String w3fun : specific) { Destruct d = new Destruct(w3fun); if ((up && d.bottom.equals(baseW3) && d.top.equals(extremityW3)) || (!up && d.top.equals(baseW3) && d.bottom.equals(extremityW3))) { W4Loop w = new W4Loop("loop-" + w3fun, fs.getFunction(w3fun)); f.addTerm(w); if (dbgb) System.out.println("include " + w3fun); } else { if (dbgb) System.out.println("exclude " + w3fun); } } } dbgb = false; } } private class Destruct { boolean origSlr, sud, srot, all, newSlr; String list = "abc"; String top, bottom, type, complete, width; Destruct(String s) { origSlr = s.contains("_slr"); sud = s.contains("_sud"); srot = s.contains("_srot"); all = origSlr && sud; String t[] = s.split("_"); if (t.length < 3) { int qq = 1 / 0; } type = t[0]; top = t[1]; bottom = t[2]; complete = s; switch (type) { //case "w2": case "w3": case "row": case "w1b": newSlr = origSlr; break; } if (type.startsWith("2p")) newSlr = origSlr; switch (type) { case "w3" : width = "abc"; break; case "w2a" : width = "ab"; break; case "w2b" : width = "bc"; break; case "w1a" : width = "a"; break; case "w1b" : width = "b"; break; case "w1c" : width = "c"; break; case "row" : width = calcRowWidth(top); break; } if (type.startsWith("2p")) { String[] bits = type.split("-"); width = bits[1]; if (!width.contains("b")) { int qq = 1 / 0; } } } String recompose() { String ret = type + "_" + top + "_" + bottom; if (origSlr) ret += "_slr"; if (sud) ret += "_sud"; if (srot) ret += "_srot"; return ret; } boolean sameSymmetry(Destruct other) { return (newSlr == other.newSlr) && (sud == other.sud) && (srot == other.srot); } boolean sameOrigSymmetry(Destruct other) { return (origSlr == other.origSlr) && (sud == other.sud) && (srot == other.srot); } String calcRowWidth(String s) { String ret = ""; String first = s.substring(0, 1); String last = s.substring(s.length() - 1); for (String letter : listLetters) { if (letter.compareTo(first) >= 0 && letter.compareTo(last) <= 0) ret += letter; } return ret; } void applyDelta(int delta) { type += list.substring(delta, delta + 1); top = applyDelta(top, delta); bottom = applyDelta(bottom, delta); if (type.equals("w2b") && origSlr) newSlr = true; } String applyDelta(String in, int delta) { String ret = ""; for (int i = 0; i < in.length(); i++) { String s = in.substring(i, i + 1); int pos = list.indexOf(s) + delta; ret += list.substring(pos , pos + 1); } if (ret.equals("ada")) { int qq = 1 / 0; } return ret; } } /* class Container { ArrayList odd, even; } */ void loadShouldBes() { ((GenericFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).shouldBe(3, 1); ((GenericFunction)(fs.getFunction("w3_abc_a"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w3_c_abc"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w3_bc_ab_srot"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w3_ab_bc_srot"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w3_b_abc_slr"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w3_abc_b_slr"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w3_abc_c"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w3_a_abc"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w3_b_ab"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_abc_ab"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_ac_abc_slr"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_a_b"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_c_ab"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_abc_c"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_a_bc"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_b_b_slr_sud_srot"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_abc_a"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_c_b"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_a_c_srot"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_b_bc"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_c_c_sud"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_abc_b_slr"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_abc_bc"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_bc_ab_srot"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_b_abc_slr"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_bc_b"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_c_a_srot"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_bc_a"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_a_abc"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_ab_bc_srot"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_abc_ac_slr"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_b_c"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_bc_abc"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_b_a"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_a_a_sud"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_ab_c"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_ab_b"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_c_abc"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_ab_abc"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w3_ab_c"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_ab_ab_sud"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_ab_b"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_ab_a"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_b_c"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_b_b_srot"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_b_a"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_c_abc"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_ab_bc"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_abc_ab"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_b_ac_slr"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_bc_abc"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_b_ab"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_a_c"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_a_b"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_a_a"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_c_bc"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_b_abc_slr"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_ac_b_slr"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_bc_c"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_bc_b"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_bc_a"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_b_abc"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_a_bc"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_a_c_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_c_ac"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_c_ab"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_b_b_slr"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_bc_ab"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_ab_bc_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_abc_c"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_c_a_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_abc_b"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_a_abc"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_abc_a"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_bc_ab_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_a_ac"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_a_ab"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_abc_bc"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_abc_b_slr"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_bc_bc_sud"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_b_bc"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_ab_abc"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_ac_c"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_ac_a"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w3_c_c"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_c_b"))).shouldBe(6, 3); ((GenericFunction)(fs.getFunction("w3_c_a"))).shouldBe(6, 2); ((GenericFunction)(fs.getFunction("w3_ab_c"))).shouldBe(7, 8); ((GenericFunction)(fs.getFunction("w3_a_a_sud"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_ab_b"))).shouldBe(7, 9); ((GenericFunction)(fs.getFunction("w3_ab_ab_sud"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_ab_a"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w3_b_c"))).shouldBe(7, 10); ((GenericFunction)(fs.getFunction("w3_b_b_srot"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_b_b"))).shouldBe(7, 8); ((GenericFunction)(fs.getFunction("w3_b_a"))).shouldBe(7, 10); ((GenericFunction)(fs.getFunction("w3_ac_abc_slr"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_c_abc"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_ab_bc"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_abc_ab"))).shouldBe(7, 5); ((GenericFunction)(fs.getFunction("w3_b_ac_slr"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_b_ab"))).shouldBe(7, 9); ((GenericFunction)(fs.getFunction("w3_bc_abc"))).shouldBe(7, 5); ((GenericFunction)(fs.getFunction("w3_a_c"))).shouldBe(7, 8); ((GenericFunction)(fs.getFunction("w3_a_b"))).shouldBe(7, 10); ((GenericFunction)(fs.getFunction("w3_a_a"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_abc_abc_sud"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_c_bc"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w3_bc_bc"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_b_abc_slr"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_ac_b_slr"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_bc_c"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w3_ac_ac_slr_sud_srot"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_bc_b"))).shouldBe(7, 9); ((GenericFunction)(fs.getFunction("w3_bc_a"))).shouldBe(7, 8); ((GenericFunction)(fs.getFunction("w3_b_abc"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_a_bc"))).shouldBe(7, 8); ((GenericFunction)(fs.getFunction("w3_ab_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_abc_ac_slr"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_ab_ab"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_c_c_sud"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_ac_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_a_c_srot"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_c_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_c_ab"))).shouldBe(7, 8); ((GenericFunction)(fs.getFunction("w3_b_b_slr"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_bc_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_bc_ab"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_ab_bc_srot"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_abc_c"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_c_a_srot"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_abc_b"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_a_abc"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_abc_a"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_a_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_bc_ab_srot"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_a_ab"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w3_abc_bc"))).shouldBe(7, 5); ((GenericFunction)(fs.getFunction("w3_bc_bc_sud"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_abc_b_slr"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w3_b_bc"))).shouldBe(7, 9); ((GenericFunction)(fs.getFunction("w3_ac_ab"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_ab_abc"))).shouldBe(7, 5); ((GenericFunction)(fs.getFunction("w3_ac_c"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_ac_a"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_c_c"))).shouldBe(7, 6); ((GenericFunction)(fs.getFunction("w3_c_b"))).shouldBe(7, 10); ((GenericFunction)(fs.getFunction("w3_b_b_slr_sud_srot"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w3_c_a"))).shouldBe(7, 8); ((GenericFunction)(fs.getFunction("w3_ab_c"))).shouldBe(8, 22); ((GenericFunction)(fs.getFunction("w3_ab_ab_sud"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_a_a_sud"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_ab_b"))).shouldBe(8, 25); ((GenericFunction)(fs.getFunction("w3_ab_a"))).shouldBe(8, 13); ((GenericFunction)(fs.getFunction("w3_b_c"))).shouldBe(8, 28); ((GenericFunction)(fs.getFunction("w3_b_b_srot"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w3_b_b"))).shouldBe(8, 28); ((GenericFunction)(fs.getFunction("w3_b_a"))).shouldBe(8, 28); ((GenericFunction)(fs.getFunction("w3_ac_abc_slr"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w3_c_abc"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w3_ab_bc"))).shouldBe(8, 16); ((GenericFunction)(fs.getFunction("w3_abc_ab"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w3_b_ac_slr"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_b_ac"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_b_ab"))).shouldBe(8, 25); ((GenericFunction)(fs.getFunction("w3_bc_abc"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w3_a_c"))).shouldBe(8, 22); ((GenericFunction)(fs.getFunction("w3_a_b"))).shouldBe(8, 28); ((GenericFunction)(fs.getFunction("w3_a_a"))).shouldBe(8, 16); ((GenericFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_abc_abc_sud"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w3_c_bc"))).shouldBe(8, 13); ((GenericFunction)(fs.getFunction("w3_b_abc_slr"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w3_bc_bc"))).shouldBe(8, 8); ((GenericFunction)(fs.getFunction("w3_ac_b_slr"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_bc_c"))).shouldBe(8, 13); ((GenericFunction)(fs.getFunction("w3_bc_b"))).shouldBe(8, 25); ((GenericFunction)(fs.getFunction("w3_bc_a"))).shouldBe(8, 22); ((GenericFunction)(fs.getFunction("w3_b_abc"))).shouldBe(8, 18); ((GenericFunction)(fs.getFunction("w3_a_bc"))).shouldBe(8, 22); ((GenericFunction)(fs.getFunction("w3_ab_ac"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_abc_ac_slr"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w3_ab_ab"))).shouldBe(8, 8); ((GenericFunction)(fs.getFunction("w3_c_c_sud"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_ac_bc"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_a_c_srot"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w3_c_ac"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w3_c_ab"))).shouldBe(8, 22); ((GenericFunction)(fs.getFunction("w3_b_b_slr"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w3_bc_ac"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_bc_ab"))).shouldBe(8, 16); ((GenericFunction)(fs.getFunction("w3_ab_bc_srot"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w3_abc_c"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w3_c_a_srot"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w3_abc_b"))).shouldBe(8, 18); ((GenericFunction)(fs.getFunction("w3_a_abc"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w3_abc_a"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w3_bc_ab_srot"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w3_a_ac"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w3_a_ab"))).shouldBe(8, 13); ((GenericFunction)(fs.getFunction("w3_abc_bc"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w3_b_b_sud"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_bc_bc_sud"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_abc_b_slr"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w3_b_bc"))).shouldBe(8, 25); ((GenericFunction)(fs.getFunction("w3_ac_ab"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_ab_abc"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w3_ac_c"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w3_ac_b"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w3_ac_a"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w3_c_c"))).shouldBe(8, 16); ((GenericFunction)(fs.getFunction("w3_c_b"))).shouldBe(8, 28); ((GenericFunction)(fs.getFunction("w3_b_b_slr_sud_srot"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w3_c_a"))).shouldBe(8, 22); ((GenericFunction)(fs.getFunction("w3_ab_c"))).shouldBe(9, 54); ((GenericFunction)(fs.getFunction("w3_ab_ab_sud"))).shouldBe(9, 4); ((GenericFunction)(fs.getFunction("w3_a_a_sud"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_ab_b"))).shouldBe(9, 65); ((GenericFunction)(fs.getFunction("w3_ab_a"))).shouldBe(9, 36); ((GenericFunction)(fs.getFunction("w3_b_c"))).shouldBe(9, 78); ((GenericFunction)(fs.getFunction("w3_b_b_srot"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_b_b"))).shouldBe(9, 92); ((GenericFunction)(fs.getFunction("w3_b_a"))).shouldBe(9, 78); ((GenericFunction)(fs.getFunction("w3_ac_abc_slr"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w3_abc_ac"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w3_c_abc"))).shouldBe(9, 33); ((GenericFunction)(fs.getFunction("w3_ab_bc"))).shouldBe(9, 42); ((GenericFunction)(fs.getFunction("w3_abc_ab"))).shouldBe(9, 28); ((GenericFunction)(fs.getFunction("w3_b_ac"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_b_ac_slr"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w3_b_ab"))).shouldBe(9, 65); ((GenericFunction)(fs.getFunction("w3_bc_abc"))).shouldBe(9, 28); ((GenericFunction)(fs.getFunction("w3_a_c"))).shouldBe(9, 60); ((GenericFunction)(fs.getFunction("w3_a_b"))).shouldBe(9, 78); ((GenericFunction)(fs.getFunction("w3_a_a"))).shouldBe(9, 44); ((GenericFunction)(fs.getFunction("w3_abc_abc_sud"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w3_c_bc"))).shouldBe(9, 36); ((GenericFunction)(fs.getFunction("w3_b_abc_slr"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w3_bc_bc"))).shouldBe(9, 26); ((GenericFunction)(fs.getFunction("w3_ac_b_slr"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w3_bc_c"))).shouldBe(9, 36); ((GenericFunction)(fs.getFunction("w3_abc_abc"))).shouldBe(9, 12); ((GenericFunction)(fs.getFunction("w3_bc_b"))).shouldBe(9, 65); ((GenericFunction)(fs.getFunction("w3_bc_a"))).shouldBe(9, 54); ((GenericFunction)(fs.getFunction("w3_b_abc"))).shouldBe(9, 44); ((GenericFunction)(fs.getFunction("w3_a_bc"))).shouldBe(9, 54); ((GenericFunction)(fs.getFunction("w3_ab_ac"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_abc_ac_slr"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w3_ab_ab"))).shouldBe(9, 26); ((GenericFunction)(fs.getFunction("w3_c_c_sud"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_ac_bc"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_a_c_srot"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_c_ac"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w3_c_ab"))).shouldBe(9, 54); ((GenericFunction)(fs.getFunction("w3_b_b_slr"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_bc_ac"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_bc_ab"))).shouldBe(9, 42); ((GenericFunction)(fs.getFunction("w3_ab_bc_srot"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w3_ac_abc"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w3_abc_c"))).shouldBe(9, 33); ((GenericFunction)(fs.getFunction("w3_ac_ac_slr"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w3_c_a_srot"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_abc_b"))).shouldBe(9, 44); ((GenericFunction)(fs.getFunction("w3_a_abc"))).shouldBe(9, 33); ((GenericFunction)(fs.getFunction("w3_abc_a"))).shouldBe(9, 33); ((GenericFunction)(fs.getFunction("w3_bc_ab_srot"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w3_a_ac"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w3_a_ab"))).shouldBe(9, 36); ((GenericFunction)(fs.getFunction("w3_abc_bc"))).shouldBe(9, 28); ((GenericFunction)(fs.getFunction("w3_b_b_sud"))).shouldBe(9, 4); ((GenericFunction)(fs.getFunction("w3_bc_bc_sud"))).shouldBe(9, 4); ((GenericFunction)(fs.getFunction("w3_abc_b_slr"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w3_b_bc"))).shouldBe(9, 65); ((GenericFunction)(fs.getFunction("w3_ac_ab"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_ab_abc"))).shouldBe(9, 28); ((GenericFunction)(fs.getFunction("w3_ac_c"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w3_ac_b"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w3_ac_a"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w3_c_c"))).shouldBe(9, 44); ((GenericFunction)(fs.getFunction("w3_c_b"))).shouldBe(9, 78); ((GenericFunction)(fs.getFunction("w3_b_b_slr_sud_srot"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w3_c_a"))).shouldBe(9, 60); } void loadMinimums() { ((DoubleFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).setMinimum(3); ((DoubleFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).addForce(3, 1); ((DoubleFunction)(fs.getFunction("w3_abc_a"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w3_abc_a"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w3_c_abc"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w3_c_abc"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w3_bc_ab_srot"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w3_bc_ab_srot"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w3_ab_bc_srot"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w3_ab_bc_srot"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w3_b_abc_slr"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w3_b_abc_slr"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w3_abc_b_slr"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w3_abc_b_slr"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w3_abc_c"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w3_abc_c"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w3_a_abc"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w3_a_abc"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w3_b_ab"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_b_ab"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_abc_ab"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_abc_ab"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_ac_abc_slr"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_ac_abc_slr"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_a_b"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_a_b"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_c_ab"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_c_ab"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_abc_c"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_a_bc"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_a_bc"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_b_b_slr_sud_srot"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_b_b_slr_sud_srot"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_abc_a"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_c_b"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_c_b"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_a_c_srot"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_a_c_srot"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_b_bc"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_b_bc"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_c_c_sud"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_c_c_sud"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_abc_b_slr"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_abc_bc"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_abc_bc"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_bc_ab_srot"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_b_abc_slr"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_bc_b"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_bc_b"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_c_a_srot"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_c_a_srot"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_bc_a"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_bc_a"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_a_abc"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_ab_bc_srot"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_abc_ac_slr"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_abc_ac_slr"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_b_c"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_b_c"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_bc_abc"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_bc_abc"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_b_a"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_b_a"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_a_a_sud"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_a_a_sud"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_ab_c"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_ab_c"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_ab_b"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_ab_b"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_c_abc"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_ab_abc"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w3_ab_abc"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w3_ab_c"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_ab_ab_sud"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_ab_ab_sud"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_ab_b"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_ab_a"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_ab_a"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_b_c"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_b_b_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_b_b_srot"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_b_a"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_c_abc"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_ab_bc"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_ab_bc"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_abc_ab"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_b_ac_slr"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_b_ac_slr"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_bc_abc"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_b_ab"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_a_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_a_c"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_a_b"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_a_a"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_a_a"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_c_bc"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_c_bc"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_b_abc_slr"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_ac_b_slr"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_ac_b_slr"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_bc_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_bc_c"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_bc_b"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_bc_a"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_b_abc"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_b_abc"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_a_bc"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_a_c_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_c_ac"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_c_ac"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_c_ab"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_b_b_slr"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_b_b_slr"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_bc_ab"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_bc_ab"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_ab_bc_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_abc_c"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_c_a_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_abc_b"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_abc_b"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_a_abc"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_abc_a"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_bc_ab_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_a_ac"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_a_ac"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_a_ab"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_a_ab"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_abc_bc"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_abc_b_slr"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_bc_bc_sud"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_bc_bc_sud"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_b_bc"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_ab_abc"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_ac_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_ac_c"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_ac_a"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_ac_a"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w3_c_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_c_c"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_c_b"))).addForce(6, 3); ((DoubleFunction)(fs.getFunction("w3_c_a"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w3_c_a"))).addForce(6, 2); ((DoubleFunction)(fs.getFunction("w3_ab_c"))).addForce(7, 8); ((DoubleFunction)(fs.getFunction("w3_a_a_sud"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_ab_b"))).addForce(7, 9); ((DoubleFunction)(fs.getFunction("w3_ab_ab_sud"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_ab_a"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w3_b_c"))).addForce(7, 10); ((DoubleFunction)(fs.getFunction("w3_b_b_srot"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_b_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_b_b"))).addForce(7, 8); ((DoubleFunction)(fs.getFunction("w3_b_a"))).addForce(7, 10); ((DoubleFunction)(fs.getFunction("w3_ac_abc_slr"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_c_abc"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_ab_bc"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_abc_ab"))).addForce(7, 5); ((DoubleFunction)(fs.getFunction("w3_b_ac_slr"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_b_ab"))).addForce(7, 9); ((DoubleFunction)(fs.getFunction("w3_bc_abc"))).addForce(7, 5); ((DoubleFunction)(fs.getFunction("w3_a_c"))).addForce(7, 8); ((DoubleFunction)(fs.getFunction("w3_a_b"))).addForce(7, 10); ((DoubleFunction)(fs.getFunction("w3_a_a"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_abc_abc_slr_sud_srot"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_abc_abc_sud"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_abc_abc_sud"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_c_bc"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w3_bc_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_bc_bc"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_b_abc_slr"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_ac_b_slr"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_bc_c"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w3_ac_ac_slr_sud_srot"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_ac_ac_slr_sud_srot"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_bc_b"))).addForce(7, 9); ((DoubleFunction)(fs.getFunction("w3_bc_a"))).addForce(7, 8); ((DoubleFunction)(fs.getFunction("w3_b_abc"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_a_bc"))).addForce(7, 8); ((DoubleFunction)(fs.getFunction("w3_ab_ac"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_ab_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_abc_ac_slr"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_ab_ab"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_ab_ab"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_c_c_sud"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_ac_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_ac_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_a_c_srot"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_c_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_c_ab"))).addForce(7, 8); ((DoubleFunction)(fs.getFunction("w3_b_b_slr"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_bc_ac"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_bc_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_bc_ab"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_ab_bc_srot"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_abc_c"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_c_a_srot"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_abc_b"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_a_abc"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_abc_a"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_a_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_bc_ab_srot"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_a_ab"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w3_abc_bc"))).addForce(7, 5); ((DoubleFunction)(fs.getFunction("w3_bc_bc_sud"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_abc_b_slr"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w3_b_bc"))).addForce(7, 9); ((DoubleFunction)(fs.getFunction("w3_ac_ab"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w3_ac_ab"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_ab_abc"))).addForce(7, 5); ((DoubleFunction)(fs.getFunction("w3_ac_c"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_ac_a"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_c_c"))).addForce(7, 6); ((DoubleFunction)(fs.getFunction("w3_c_b"))).addForce(7, 10); ((DoubleFunction)(fs.getFunction("w3_b_b_slr_sud_srot"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w3_c_a"))).addForce(7, 8); ((DoubleFunction)(fs.getFunction("w3_b_ac"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w3_b_b_sud"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w3_ac_b"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w3_abc_ac"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w3_abc_abc"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w3_ac_abc"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w3_ac_ac_slr"))).setMinimum(9); } }/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.readers; import polyutil.*; import polyutil.functions.*; import java.util.*; import java.io.*; /** * * @author mason * */ public class W4Calculator { int lines; Hashtable equiv; ParameterAnalyzer pa; int size; String debugCat ; boolean code; SingleFunction free; FunctionSet fs, w3fs, w2fs, w2w2fs; static String[] w4combinations = {"a", "b", "c", "d", "ab", "ac", "ad", "bc", "bd", "cd", "abc", "abd", "acd", "bcd", "abcd"}; ArrayList w4FunctionList; W3CalculatorABC w3Calculator; W2CalculatorHeight w2Calculator; public W4Calculator( String params) { String[] rules = new String[] {"debugcat", "size", "code"}; pa = new ParameterAnalyzer(params , rules); debugCat = pa.getStringValue("debugcat"); if (debugCat == null) debugCat = ""; size = pa.getIntValue("size", 0); code = pa.getBooleanValue("code", false); } public void runReader() { doit(); } void doit() { String curr; w3Calculator = new W3CalculatorABC(size); w3Calculator.prepare(); w3fs = w3Calculator.getFS(); w2Calculator = new W2CalculatorHeight(size); w2Calculator.prepare(); w2fs = w2Calculator.getFS(); fs = new FunctionSet(); equiv = new Hashtable<>(); w4FunctionList = new ArrayList<>(); W2W2Calculator w2w2Calculator = new W2W2Calculator(size); w2w2Calculator.prepare(); w2w2fs = w2w2Calculator.getFS(); W4CalculatorRoutines routines = new W4CalculatorRoutines(equiv, fs, w2fs, w3fs, size); routines.run(); //System.err.println("term count " + Term.termCount); free = new SingleFunction("free"); // introduce subtracts to account for 4 by 4 squares SingleFunction free1 = new SingleFunction("free1"); SingleFunction free2 = new SingleFunction("free2"); SingleFunction free4 = new SingleFunction("free4"); free.addTerm(free1); free.addTerm(new Division(free2, new Constant(2))); free.addTerm(new Division(free4, new Constant(4))); ArrayList freeList = new ArrayList<>(); for(String w4name : routines.w4_hash) { freeList.add(substitute(w4name)); } outArrayDiv(freeList, free1, 1); outArrayDiv(freeList, free2, 2); outArrayDiv(freeList, free4, 4); SingleFunction delta = new SingleFunction("delta"); free.addTerm(delta); delta.setHard(0); /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 0 12 71 168 253 237 153 56 15 1 */ delta.addForce(7, -12); delta.addForce(8, -71); delta.addForce(9, -168); delta.addForce(10, -253); delta.addForce(11, -237); delta.addForce(12, -153); delta.addForce(13, -56); delta.addForce(14, -15); delta.addForce(15, -1); //System.err.println("set deltas"); Hashtable optimised = new Hashtable<>(); ArrayList toOptimise = new ArrayList<>(); toOptimise.add(free); for (int i = 0; i < toOptimise.size(); i++) { GenericFunction f = toOptimise.get(i); if (optimised.get(f.getName()) == null && !f.isExcluded()) { //System.err.println(f.getName()); optimised.put(f.getName(), f.getName()); toOptimise.addAll(f.getDependentFunctions(true)); f.optimise(); } } SingleFunction s, t; if (!code) { for (int i = 1 ; i <= size; i++) { System.out.println(i + " " + free.value(i)); } } if (code) { Hashtable done = new Hashtable<>(); ArrayList todo = new ArrayList<>(); todo.add(free); for (int i = 0; i < todo.size(); i++) { GenericFunction f = todo.get(i); if (done.get(f.getName()) == null && !f.isExcluded()) { //System.err.println(f.getName()); done.put(f.getName(), f.getName()); todo.addAll(f.getDependentFunctions(true)); System.out.println(f.expression()); if (f.getName().startsWith("w2")) System.out.println(f.expressionH()); } } } } static String invert(String s) { String ret = ""; for (int i = 0; i < s.length(); i++) { String t = s.substring(i, i + 1); switch(t) { case "a": ret = "d" + ret; break; case "b": ret = "c" + ret; break; case "c": ret = "b" + ret; break; case "d": ret = "a" + ret; break; } } return ret; } void outArrayDiv(ArrayList array, SingleFunction f, int div) { Collections.sort(array); String current = ""; int count = 0; for (String s : array) { if (s.equals(current)) { count++; continue; } outDiv(current, count, f, div); count = 0; current = s; count++; } outDiv(current, count, f, div); } void outDiv(String category, int count, SingleFunction f, int div) { //String portion = category; //This routine must distinguish which free* to add to int divisor = 1; if (count > 0) { Term t = new Call(fs.getFunction(category), 1, 0); //portion += "(n)"; //if (count > 1) { //portion += ".multiply(BigInteger.valueOf(" + count + "))"; //} if (category.contains("_slr_sud_srot")) { // ; // noop t = new Product(t, new Constant(count)); } else if (category.contains("_s")) { if (count == 2) ; // noop portion = category + "(n)"; else { if (count > 1) t = new Product(t, new Constant(count)); divisor = 2; //t = new Division(t, new Constant(2)); // portion = "div(" + portion + ", two)"; } } else { if (count == 4) ; // noop portion = category + "(n)"; else { if (count > 1) t = new Product(t, new Constant(count)); divisor = 4; //t = new Division(t, new Constant(4)); // portion = "div(" + portion + ", four)"; } } //out(" " + portion + ","); if (div == divisor) f.addTerm(t); //count = 0; } } String substitute(String in) { String out = equiv.get(in); if (out == null) return in; else return out; } }/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.readers; import java.math.BigInteger; import polyutil.*; import java.util.*; import java.io.*; import polyutil.functions.*; /** * * @author mason */ public class W4CalculatorRoutines { Hashtable equiv; int lines; public String number; String[] listLetters = new String[] {"a", "b", "c", "d"}; String[] w1 = { "w1a_a_a", "w1b_b_b", "w1c_c_c", "w1d_d_d"}; SingleFunction fun_n //, fun_one_if_even ; ArrayList w4_hash; ArrayList w3_hash; ArrayList w3a_hash; ArrayList w3b_hash; ArrayList w1_hash; ArrayList w2_hash; ArrayList w2a_hash; ArrayList w2b_hash; ArrayList w2c_hash; ArrayList p2_hash_up, p2_hash_down; ArrayList sum_p2_hash_up, sum_p2_hash_down; //ArrayList w2w2_hash; public ArrayList w2w2_hash; String[] mix4; int size ; FunctionSet fs, w2fs, w3fs; FunctionSet w2w2fs; boolean isEven; public W4CalculatorRoutines(Hashtable equiv, FunctionSet fs, FunctionSet w2fs, FunctionSet w3fs, int size) { this.equiv = equiv; this.fs = fs; this.w2fs = w2fs; this.w3fs = w3fs; this.size = size; W2W2Calculator w2w2 = new W2W2Calculator(size); w2w2.prepare(); w2w2fs = w2w2.getFS(); w2w2_hash = w2w2.getHash(); mix4 = new String[] { "a", "b", "c", "d", "ab", "ac" , "ad" , "bc" , "bd" , "cd" , "abc" , "abd" , "acd" , "bcd" , "abcd" }; } public void run() { fun_n = new SingleFunction("fun_n"); fun_n.setFunN(); //fun_one_if_even = new SingleFunction("fun_one_if_even"); //fun_one_if_even.setOneIfEven(); w4_hash = new ArrayList<>(); p2_hash_up = new ArrayList<>(); p2_hash_down = new ArrayList<>(); sum_p2_hash_up = new ArrayList<>(); sum_p2_hash_down = new ArrayList<>(); for (String above : W4Calculator.w4combinations) { for (String below : W4Calculator.w4combinations) { String prefix = "w4_" + above + "_" + below; process_w4(prefix); boolean bslr = slrW4(above) && slrW4(below); if (bslr) process_w4(prefix + "_slr"); boolean bsud = above.equals(below); if (bsud) process_w4(prefix + "_sud"); boolean bsrot = above.equals(W4Calculator.invert(below)); if (bsrot) process_w4(prefix + "_srot"); if (bsrot && bslr) { process_w4(prefix + "_slr_sud_srot"); } } } w1_hash = new ArrayList<>(); SingleFunction w1_l_l = new SingleFunction("w1_l_l"); w1_l_l.setMinimum(1); w1_l_l.setHard(1); for (String s : w1) { w1_hash.add(s); fs.add(w1_l_l, s); } w2_hash = new ArrayList<>(); w2a_hash = new ArrayList<>(); w2b_hash = new ArrayList<>(); w2c_hash = new ArrayList<>(); genW2(w2a_hash, 0); genW2(w2b_hash, 1); genW2(w2c_hash, 2); w3_hash = new ArrayList<>(); w3a_hash = new ArrayList<>(); w3b_hash = new ArrayList<>(); genW3(w3a_hash, 0); genW3(w3b_hash, 1); case_i(); case_ii(); case_iii(); case_iv(); case_v(); case_vi(); case_vii(); case_viii(); case_ix(); case_x(); case_xi(); case_xii(); case_xiii(); case_xiv(); case_xv(); case_xvi(); case_xvii(); case_xviii(); case_xix(); case_xx(); summarise(); String rows1[] = new String[] {"a", "b", "c", "d"}; String rows2[] = new String[] {"ab", "ac", "ad", "bc", "bd", "cd"}; String rows3[] = new String[] {"abc", "abd", "acd", "bcd"}; String rows4[] = new String[] {"abcd"}; isEven = true; mix(null, 0, 0); for (String rowComp : rows2) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("ad" ) || rowComp.equals("bc")) row += "_slr"; mix(row, 1, 1); } for (String rowComp : rows3) { String row = "row_" + rowComp + "_" + rowComp; mix(row, 2, 1); mix(row, 1, 2); } for (String rowComp : rows4) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("abcd")) row += "_slr"; mix(row, 2, 2); mix(row, 3, 1); mix(row, 1, 3); } isEven = false; for (String rowComp : rows1) { String row = "row_" + rowComp + "_" + rowComp; mix(row, 0, 0); } for (String rowComp : rows2) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("ad" ) || rowComp.equals("bc")) row += "_slr"; mix(row, 1, 0); mix(row, 0, 1); } for (String rowComp : rows3) { String row = "row_" + rowComp + "_" + rowComp; mix(row, 1, 1); mix(row, 2, 0); mix(row, 0, 2); } for (String rowComp : rows4) { String row = "row_" + rowComp + "_" + rowComp; if (rowComp.equals("abcd")) row += "_slr"; mix(row, 1, 2); mix(row, 2, 1); mix(row, 3, 0); mix(row, 0, 3); } loadMinimums(); loadShouldBes(); //System.err.println("loaded should be's"); /* ((DoubleFunction)(w3fs.getFunction("w3_l_l"))).debugValue(2); System.out.println(((DoubleFunction)(w3fs.getFunction("w3_l_l"))).value(2)); System.out.println(((DoubleFunction)(fs.getFunction("w4_a_a_sud"))).expression()); */ //System.out.println(((DoubleFunction)(fs.getFunction("w4_a_abcd"))).expression()); } void summarise() { summarise(p2_hash_down, sum_p2_hash_down, "d"); summarise(p2_hash_up, sum_p2_hash_up, "u"); } void summarise(ArrayList old, ArrayList sum, String dir ) { for (String name : old) { if (name.contains("ca")) { int qq = 1 / 0; } Destruct d = new Destruct(name); String[] bits = d.type.split("-"); // 2pd-abcd-w1-w1 d.type = "2p" + dir + "-" + bits[1]; String newName = d.recompose(); if (!sum.contains(newName)) { sum.add(newName); SingleFunction f = new SingleFunction(newName); fs.add(f); } SingleFunction f = ((SingleFunction)(fs.getFunction(newName))); f.addTerm(((Function)(fs.getFunction(name)))); } } void genW3(ArrayList specificW3, int delta) { Set> scanner = w3fs.getScanner(); for (Map.Entry w3Entry : scanner) { String w3Name = w3Entry.getKey(); if (!w3Name.startsWith("w3")) continue; //String w3NameAbc = convertW3(w3Name); //System.out.println(w3Name + " " + w3NameAbc); String w3NameAbc = w3Name; Destruct realFunction = new Destruct(w3NameAbc); if (!realFunction.type.equals("w3") || realFunction.complete.startsWith("accum_")) continue; realFunction.applyDelta(0); String realFunctionName = realFunction.recompose(); if (delta > 0 ) { Destruct aliasFunction = new Destruct(w3NameAbc); aliasFunction.applyDelta(delta); String aliasFunctionName = aliasFunction.recompose(); w3_hash.add(aliasFunctionName); specificW3.add(aliasFunctionName); fs.add(w3fs.getFunction(w3Name), aliasFunctionName); } else { w3_hash.add(realFunctionName); specificW3.add(realFunctionName); fs.add(w3fs.getFunction(w3Name), realFunctionName); } } } void genW2(ArrayList specific, int delta) { Set> scanner = w2fs.getScanner(); for (Map.Entry w2Entry : scanner) { String w2Name = w2Entry.getKey(); Destruct realFunction = new Destruct(w2Name); if (!realFunction.type.equals("w2")) continue; realFunction.applyDelta(0); String realFunctionName = realFunction.recompose(); if (delta > 0 ) { Destruct aliasFunction = new Destruct(w2Name); aliasFunction.applyDelta(delta); String aliasFunctionName = aliasFunction.recompose(); w2_hash.add(aliasFunctionName); specific.add(aliasFunctionName); fs.add(w2fs.getFunction(w2Name), aliasFunctionName); } else { w2_hash.add(realFunctionName); specific.add(realFunctionName); fs.add(w2fs.getFunction(w2Name), realFunctionName); } } } void mix(String row, int subtractCoeffAbove, int subtractCoeffBelow) { //System.err.println("mix " + row); ArrayList[] listPolyAbove , listPolyBelow; listPolyAbove = new ArrayList[5]; listPolyAbove[0] = w4_hash; listPolyAbove[1] = w3_hash; listPolyAbove[2] = w2_hash; listPolyAbove[3] = w1_hash; listPolyAbove[4] = sum_p2_hash_up; listPolyBelow = new ArrayList[5]; listPolyBelow[0] = w4_hash; listPolyBelow[1] = w3_hash; listPolyBelow[2] = w2_hash; listPolyBelow[3] = w1_hash; listPolyBelow[4] = sum_p2_hash_down; for (ArrayList hAbove : listPolyAbove) { for ( ArrayList hBelow : listPolyBelow) { if (row == null) { //if (hAbove == w2w2_hash && hBelow == w2w2_hash) continue; if (hAbove == w1_hash && hBelow != w4_hash) continue; if (hAbove != w4_hash && hBelow == w1_hash) continue; if (hAbove == w2_hash && hBelow == w2_hash) continue; } if (row != null && !row.startsWith("row_abcd_abcd")) { if (hAbove == w1_hash && hBelow == w1_hash) continue; } if (row != null && !row.contains("bc")) { if (hAbove == sum_p2_hash_up && hBelow == w1_hash) continue; if (hAbove == w1_hash && hBelow == sum_p2_hash_up) continue; if (hAbove == sum_p2_hash_down && hBelow == w1_hash) continue; if (hAbove == w1_hash && hBelow == sum_p2_hash_down) continue; } outRow(row, subtractCoeffAbove, subtractCoeffBelow, hAbove, hBelow); } } } private void outRow(String row, int subtractCoeffAbove, int subtractCoeffBelow, ArrayList hAbove, ArrayList hBelow) { Destruct drow = null; if (row != null) drow = new Destruct(row); for (String above : hAbove) { Destruct dabove = new Destruct(above); for (String below : hBelow) { Destruct dbelow = new Destruct(below); if (dabove.top.equals("a") && dabove.bottom.equals("abc") && dbelow.top.equals("ac") && dbelow.bottom.equals("c") && dabove.type.startsWith("w3") && dbelow.type.startsWith("2pd") && row == null) { int dbg = 1; } if (above.equals("w3a_b_abc") && below.equals("w3a_abc_b") && row != null && drow.top.equals("cd")) { int dbg = 1; } if (row == null) { if (!overlaps(dabove, dbelow)) continue; if (dabove.width == null || dbelow.width == null) { int qq = 1 / 0; } if (!completeWidth(dabove, dbelow)) continue; if (dabove.type.startsWith("2p") && dbelow.type.startsWith("2p")) continue; if (dabove.type.startsWith("2p") && dbelow.type.startsWith("w2a")) continue; if (dabove.type.startsWith("2p") && dbelow.type.startsWith("w2c")) continue; if (dabove.type.startsWith("w2a") && dbelow.type.startsWith("2p")) continue; if (dabove.type.startsWith("w2c") && dbelow.type.startsWith("2p")) continue; if (dabove.type.startsWith("2p") || dbelow.type.startsWith("2p")) { if (!overlaps(dabove, dbelow, "ab") || !overlaps(dabove, dbelow, "cd")) continue; } } else { if (!drow.top.contains("bc") && dabove.type.startsWith("2p") && dbelow.type.startsWith("2p")) continue; if (!overlaps(dabove, drow, dbelow)) continue; if (!completeWidth(dabove, drow, dbelow)) continue; if (dabove.type.startsWith("2p")) { if (!overlaps(dabove, drow, "ab") || !overlaps(dabove, drow, "cd")) continue; if (!drow.top.contains("bc")) { if (overlaps(drow, dbelow, "ab") && overlaps(drow, dbelow, "cd")) ; // noop else continue; } } if (dbelow.type.startsWith("2p")) { if (!overlaps(drow, dbelow, "ab") || !overlaps(drow, dbelow, "cd")) continue; if (!drow.top.contains("bc")) { if (overlaps(dabove, drow, "ab") && overlaps(dabove, drow, "cd")) ; // noop else continue; } } if (!drow.top.contains("bc")) { boolean aboveLeft = overlaps(dabove, drow, "ab"); boolean aboveRight = overlaps(dabove, drow, "cd"); boolean belowLeft = overlaps( drow, dbelow, "ab"); boolean belowRight = overlaps( drow, dbelow, "cd"); if ((aboveLeft && belowLeft) || (aboveRight && belowRight)) ; // noop else continue; } if (drow.top.contains("ac") || drow.top.contains("ad") || drow.top.contains("bd") ) { if (overlaps(dabove, drow, "ab") || overlaps(drow, dbelow, "ab")) ; // noop else continue; if (overlaps(dabove, drow, "cd") || overlaps(drow, dbelow, "cd")) ; // noop else continue; } } boolean newslr = dabove.newSlr && dbelow.newSlr; if (drow != null) newslr = newslr && drow.newSlr; if (newslr) { int sgb = 1; } boolean newsud = sudable(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow); boolean newsrot; if (drow != null) newsrot = srotableW4(dabove, drow, dbelow, subtractCoeffAbove, subtractCoeffBelow); else newsrot = srotableW4(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow); String sabove = substitute(above), sbelow = substitute(below); String trow = ""; if (row != null) trow = drow.top; String comment = dabove.bottom + "/" + trow + "/" + dbelow.top; if (dabove.top.equals("a") && dbelow.bottom.equals("a") && row == null && dabove.bottom.equals("abc") && dbelow.top.equals("ad") && dabove.type.equals("w3a") && dbelow.type.equals("2pd")) { int dbg = 1; } if (newslr) { if (newsud) { outComplexProduct("w4", dabove.top, dbelow.bottom, sabove, sbelow, "_slr", "_sud_srot", subtractCoeffAbove, 1, comment); } else { outSimpleProduct("w4", dabove.top, dbelow.bottom, sabove, sbelow, "_slr", subtractCoeffAbove, subtractCoeffBelow, comment); } } else if (newsud) { if (newsrot) outComplexProduct("w4", dabove.top, dbelow.bottom, sabove, sbelow, "", "_sud", subtractCoeffAbove, 2, "_srot", comment); else outComplexProduct("w4", dabove.top, dbelow.bottom, sabove, sbelow, "", "_sud", subtractCoeffAbove, 1, comment); } else if (newsrot) { outComplexProduct("w4", dabove.top, dbelow.bottom, sabove, sbelow, "", "_srot", subtractCoeffAbove, 1, comment); } else { outSimpleProduct("w4", dabove.top, dbelow.bottom, sabove, sbelow, "", subtractCoeffAbove, subtractCoeffBelow, comment); } } } } boolean srotableW4(Destruct dabove, Destruct dbelow, int subtractCoeffAbove, int subtractCoeffBelow) { if (! srotW4(dabove.type).equals(dbelow.type) ) { return false; } if (! W4Calculator.invert(dabove.bottom).equals(dbelow.top) ) return false; if (! W4Calculator.invert(dabove.top).equals(dbelow.bottom) ) return false; if ( subtractCoeffAbove != subtractCoeffBelow) return false; if (!dabove.sameOrigSymmetry(dbelow)) return false; return true; } boolean srotableW4(Destruct dabove, Destruct drow, Destruct dbelow, int subtractCoeffAbove, int subtractCoeffBelow) { if (!srotableW4(dabove, dbelow, subtractCoeffAbove, subtractCoeffBelow)) return false; if (!W4Calculator.invert(drow.bottom).equals(drow.bottom)) return false; return true; } String srotW4(String s) { String ret = ""; switch(s) { case "w4" : ret = "w4"; break; case "w3a" : ret = "w3b"; break; case "w3b" : ret = "w3a"; break; case "w2a" : ret = "w2c"; break; case "w2b" : ret = "w2b"; break; case "w2c" : ret = "w2a"; break; case "w1a" : ret = "w1d"; break; case "w1b" : ret = "w1c"; break; case "w1c" : ret = "w1b"; break; case "w1d" : ret = "w1a"; break; case "2pd-abc" : ret = "2pu-bcd"; break; case "2pd-bcd" : ret = "2pu-abc"; break; case "2pd-abcd" : ret = "2pu-abcd"; break; case "2pu-abc" : ret = "2pd-bcd"; break; case "2pu-bcd" : ret = "2pd-abc"; break; case "2pu-abcd" : ret = "2pd-abcd"; break; default: { int qq = 1 / 0; } break; } return ret; } boolean overlaps(Destruct dabove, Destruct dbelow) { String[] listLetters = new String[] {"a", "b", "c", "d"}; for (String letter : listLetters) if (dabove.bottom.contains(letter) && dbelow.top.contains(letter)) return true; return false; } boolean overlaps(Destruct dabove, Destruct dbelow, String intersect) { String[] listLetters = new String[] {"a", "b", "c", "d"}; for (String letter : listLetters) if (dabove.bottom.contains(letter) && dbelow.top.contains(letter) && intersect.contains(letter)) return true; return false; } boolean overlaps(Destruct dabove, Destruct drow, Destruct dbelow) { return overlaps(dabove, drow) && overlaps(drow, dbelow); } boolean completeWidth(Destruct dabove, Destruct dbelow) { return union(dabove.width, dbelow.width).length() == 4; } boolean completeWidth(Destruct dabove, Destruct drow, Destruct dbelow) { return union(union(dabove.width, dbelow.width), drow.width).length() == 4; } String union(String s1, String s2) { String ret = ""; for (String letter : listLetters) { if (s1.contains(letter) || s2.contains(letter)) ret += letter; } return ret; } String intersect(String s1, String s2) { String ret = ""; for (int i = 0; i < s1.length(); i++) { String letter = s1.substring(i, i + 1); if (s2.contains(letter)) ret += letter; } return ret; } // 2pu-abc_ac_ac 2pd-abcd_ac_ac boolean sudable(Destruct dabove , Destruct dbelow , int subtractCoeffAbove, int subtractCoeffBelow) { if (!dabove.type.equals(dbelow.type)) { if (dabove.type.startsWith("2p") && dbelow.type.startsWith("2p")) { String aboveBits[] = dabove.type.split("-"); String belowBits[] = dbelow.type.split("-"); if (!aboveBits[1].equals(belowBits[1])) return false; } else return false; } if (!dabove.sameOrigSymmetry(dbelow)) return false; return (dabove.top.equals(dbelow.bottom) && dabove.bottom.equals(dbelow.top) && subtractCoeffAbove == subtractCoeffBelow); } /* void outSimpleProduct(String type, String top, String bottom, String above, String below, String sym, int quantity) { outSimpleProduct( type, top, bottom, above, below, sym, quantity, quantity); } */ Hashtable osph; String eo() { if (isEven) return "even"; else return "odd"; } void outSimpleProduct(String type, String top, String bottom, String above, String below, String sym, int subtractCoeffAbove, int subtractCoeffBelow, String comment) { String newName = type + "_" + top + "_" + bottom + sym; if (suppressed(newName)) return; if (osph == null) osph = new Hashtable<>(); above = substitute(above); // new below = substitute(below); String leftName = "accum_" + newName + "_" + above + "_" + subtractCoeffAbove + "_" + eo(); Call left = new Call(fs.getFunction(above), 2, subtractCoeffAbove); Call right = new Call(fs.getFunction(below), 2, subtractCoeffBelow); //if (newName.equals("w4_a_a") && leftName.equals("w4_a_a+2pu-abc_a_ac+1+2+")) { if (true) { // new version SingleFunction rightFun = osph.get(leftName); if (rightFun == null) { rightFun = new SingleFunction(leftName); rightFun.debug = 9; osph.put(leftName, rightFun); fs.add(rightFun, leftName); Product p = new Product(left, rightFun); ((DoubleFunction)(fs.getFunction(newName))).addTerm(p , isEven); } rightFun.addTerm(right); } else { Product p = new Product(left, right); p.comment = comment; ((DoubleFunction)(fs.getFunction(newName))).addTerm(p , isEven); } } void outComplexProduct(String type, String top, String bottom, String above, String below, String sym, String extraSym, int subtractCoeff, int subtractFromProduct, String comment) { outComplexProduct(type, top, bottom, above, below, sym, extraSym, subtractCoeff, subtractFromProduct, null, comment) ; } void outComplexProduct(String type, String top, String bottom, String above, String below, String sym, String extraSym, int subtractCoeff, int subtractFromProduct, String extraSym2, String comment) { String newName = type + "_" + top + "_" + bottom + sym; if (above.equals("2pu-abc_ac_ac") && below.equals("2pd-abcd_ac_ac")) { int dbg = 1; } //String line = "prod(" + substitute(above) + "(" + quantity + "), " + substitute(below) + "(" + quantity + ").subtract(" + subtract + "))"; //w3_hash.get(newName).add(comment(line)); above = substitute(above); below = substitute(below); if (!suppressed(newName)) ((DoubleFunction)(fs.getFunction(newName))).addTerm(new Product(new Call(fs.getFunction(above), 2, subtractCoeff), new Subtraction(new Call(fs.getFunction(below), 2, subtractCoeff), new Constant(subtractFromProduct))) , isEven); //introduce subtract one or two; change call form string to int String name1 = newName + extraSym; //line = substitute(above) + "(" + quantity + ")"; if (!suppressed(name1)) { Call c = new Call(fs.getFunction(above), 2, subtractCoeff); //c.comment = comment; ((DoubleFunction)(fs.getFunction(name1))).addTerm(c , isEven); if (name1.equals("w4_a_a_sud") && above.startsWith("w1")) { int dbg = 1; } } //w3_hash.get(name1).add(comment(line)); if (extraSym2 != null) { name1 = newName + extraSym2; //w3_hash.get(name1).add(comment(line)); if (!suppressed(name1)) ((DoubleFunction)(fs.getFunction(name1))).addTerm(new Call(fs.getFunction(above), 2, subtractCoeff) , isEven); } } String comment(String line) { //return line + "/* " + number + " */"; return line; } void process_w4(String s) { DoubleFunction f; w4_hash.add(s); fs.add(f = new DoubleFunction(s)); String least = findLeast(s); if (!s.equals(least)) { equiv.put(s, least); f.exclude(); } } String findLeast(String s) { String ret = s; String a[] = s.split("_"); String s2 = recompose(a[0], a[2], a[1], a); String s3 = recompose(a[0], W4Calculator.invert(a[1]), W4Calculator.invert(a[2]), a); String s4 = recompose(a[0], W4Calculator.invert(a[2]), W4Calculator.invert(a[1]), a); if (s2.compareTo(ret) < 0) ret = s2; if (s3.compareTo(ret) < 0) ret = s3; if (s4.compareTo(ret) < 0) ret = s4; return ret; } String recompose(String prefix, String first, String second, String[] complete) { String ret = prefix + "_" + first + "_" + second; for (int i = 3 ; i < complete.length; i++) ret += "_" + complete[i]; return ret; } String substitute(String in) { String out = equiv.get(in); if (out == null) return in; else return out; } boolean suppressed(String in) { String out = equiv.get(in); if (out == null) return false; else return true; } boolean slrW3(String s) { switch (s) { case "lcr": case "c": case "lr": return true; default: return false; } } boolean slrW4(String s) { return s.equals(W4Calculator.invert(s)); } String invW3(String s) { String ret = ""; if (s.contains("r")) ret += "l"; if (s.contains("c")) ret += "c"; if (s.contains("l")) ret += "r"; return ret; } /* i. Two W1 pillars of equal or differing height, in positions ac, ad, bd: O O O O O O O */ void case_i() { /* Going up: 2p-w1-w1_a_ac, 2p-w1-w1_c_ac, 2p-w1-w1_ac_ac; then repeat with letters ad and bd Going down: 2p-w1-w1_ac_a, 2p-w1-w1_ac_c, 2p-w1-w1_ac_ac; then repeat with letters ad and bd */ case_i("a", "c", "abc"); case_i("a", "d", "abcd"); case_i("b", "d", "bcd"); } SingleFunction case_i_up = new SingleFunction("case_i_up"); SingleFunction case_i_down = new SingleFunction("case_i_down"); void case_i(String left, String right, String width) { case_i(this.p2_hash_up, case_i_up, left, left + right, "u", width); case_i(this.p2_hash_up, case_i_up, right, left + right, "u", width); case_i(this.p2_hash_up, case_i_up, left + right, left + right, "u", width); case_i(this.p2_hash_down, case_i_down, left + right, left, "d", width); case_i(this.p2_hash_down, case_i_down, left + right, right, "d", width); case_i(this.p2_hash_down, case_i_down, left + right, left + right, "d", width); fs.add(case_i_up); fs.add(case_i_down); } boolean case_i_first = true; String case_i_first_name; SingleFunction case_i_first_fun; boolean case_i_first_eq = true; String case_i_first_name_eq; SingleFunction case_i_first_fun_eq; void case_i(ArrayList h, SingleFunction accum, String top, String bottom, String upDown, String width) { String name = "2p" + upDown + "-" + width + "-w1-w1_" + top + "_" + bottom; if (top.equals(bottom) && top.equals("ad")) name += "_slr"; h.add(name); if (top.equals(bottom)) { if (case_i_first_eq) { //case_i_first_eq = false; case_i_first_name_eq = name; case_i_first_fun_eq = new SingleFunction(name); fs.add(case_i_first_fun_eq); case_i_first_fun_eq.setOneIfEven(); accum.addTerm(case_i_first_fun_eq); } else { equiv.put(name, case_i_first_name_eq); accum.addTerm(case_i_first_fun_eq); fs.add(case_i_first_fun_eq, name); } } else { if (case_i_first) { //case_i_first = false; case_i_first_name = name; case_i_first_fun = new SingleFunction(name); fs.add(case_i_first_fun); case_i_first_fun.addTerm(new Call(fun_n, 1, 2, 0)); accum.addTerm(case_i_first_fun); } else { equiv.put(name, case_i_first_name); accum.addTerm(case_i_first_fun); fs.add(case_i_first_fun, name); } } } /* ii. A W1 pillar and a W2, with no “nearness”. O O O OO O OO O OO O OO O O O O O O O O O O O O O O O O O O 2p-w1-w2 going up Base is one of a_c, a_d, a_cd. Top depends on: • W1 higher: a • W2 higher: c,d,cd • Equal height: ac,ad,acd Total = 3 * 7 = 21 combinations Then 2p-w2-w1 Then there is 2p-w2-w1 going up And then both going down. There will be a different set going up and going down. W1 higher: Tot = 0 For hw1 = 2 hw1 < n; hw1++ For hw2 = 1 hw2 < hw1 ; hw2++ Tot += w2_x_y.value(n – hw1, hw2) W1 lower For hw2 = 1; hw2 < n - 1; hw2++ For hw1 = 1 hw1 < hw2 ; hw1++ Tot += w2_x_y.value(n – hw1, hw2) W2 = W1 For hw1 = 2 hw1 < n; hw1++ Tot += w2_x_y.value(n – hw1, hw1) */ SingleFunction case_ii_up = new SingleFunction("case_ii_up"); SingleFunction case_ii_down = new SingleFunction("case_ii_down"); void case_ii() { case_ii_w1higher(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "c", "u"); case_ii_w1higher(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "d", "u"); case_ii_w1higher(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "cd", "u"); case_ii_w1higher(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "a", "u"); case_ii_w1higher(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "b", "u"); case_ii_w1higher(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "ab", "u"); case_ii_w1higher(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "c", "d"); case_ii_w1higher(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "d", "d"); case_ii_w1higher(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "cd", "d"); case_ii_w1higher(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "a", "d"); case_ii_w1higher(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "b", "d"); case_ii_w1higher(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "ab", "d"); case_ii_w1lower(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "c", new String[] {"c", "d", "cd"}, "u"); case_ii_w1lower(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "d", new String[] {"c", "d", "cd"}, "u"); case_ii_w1lower(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "cd", new String[] {"c", "d", "cd"}, "u"); case_ii_w1lower(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "a", new String[] {"a", "b", "ab"}, "u"); case_ii_w1lower(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "b", new String[] {"a", "b", "ab"}, "u"); case_ii_w1lower(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "ab", new String[] {"a", "b", "ab"}, "u"); case_ii_w1lower(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "c", new String[] {"c", "d", "cd"}, "d"); case_ii_w1lower(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "d", new String[] {"c", "d", "cd"}, "d"); case_ii_w1lower(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "cd", new String[] {"c", "d", "cd"}, "d"); case_ii_w1lower(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "a", new String[] {"a", "b", "ab"}, "d"); case_ii_w1lower(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "b", new String[] {"a", "b", "ab"}, "d"); case_ii_w1lower(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "ab", new String[] {"a", "b", "ab"}, "d"); case_ii_eq(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "c", "c", "d", "u"); case_ii_eq(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "d", "c", "d", "u"); case_ii_eq(this.p2_hash_up, w2c_hash, case_ii_up, true, true, "a", "cd", "c", "d", "u"); case_ii_eq(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "a", "a", "b", "u"); case_ii_eq(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "b", "a", "b", "u"); case_ii_eq(this.p2_hash_up, w2a_hash, case_ii_up, true, false, "d", "ab", "a", "b", "u"); case_ii_eq(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "c", "c", "d", "d"); case_ii_eq(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "d", "c", "d", "d"); case_ii_eq(this.p2_hash_down, w2c_hash, case_ii_down, false, true, "a", "cd", "c", "d", "d"); case_ii_eq(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "a", "a", "b", "d"); case_ii_eq(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "b", "a", "b", "d"); case_ii_eq(this.p2_hash_down, w2a_hash, case_ii_down, false, false, "d", "ab", "a", "b", "d"); fs.add(case_ii_up); fs.add(case_ii_down); } void case_ii_eq(ArrayList h, ArrayList specific, SingleFunction accum, boolean up, boolean w1Left, String baseW1, String baseW2, String extreme1, String extreme2, String upDown) { case_ii_eq( h, specific, accum, up, w1Left, baseW1, baseW2, extreme1, upDown); case_ii_eq( h, specific, accum, up, w1Left, baseW1, baseW2, extreme2, upDown); case_ii_eq( h, specific, accum, up, w1Left, baseW1, baseW2, extreme1 + extreme2, upDown); } void case_ii_eq( ArrayList h, ArrayList specific, SingleFunction accum, boolean up, boolean w1Left, String baseW1, String baseW2, String extreme, String upDown) { String name = "2p" + upDown + "-abcd-"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d if (w1Left) name += "w1-w2_a" + extreme + "_" + baseW1 + baseW2; else name += "w2-w1_" + extreme + "d_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d if (w1Left) name += "w1-w2_" + baseW1 + baseW2 + "_a" + extreme; else name += "w2-w1_" + baseW2 + baseW1 + "_" + extreme + "d"; } if (name.equals("2p-w1-w2_acd_acd")) { int dbg = 1; } h.add(name); SingleLoop f = new SingleLoop(name); fs.add(f); accum.addTerm(f); for (String w2fun : specific) { Destruct d = new Destruct(w2fun); if ((up && d.bottom.equals(baseW2) && d.top.equals(extreme)) || (!up && d.top.equals(baseW2) && d.bottom.equals(extreme))) f.addTerm(fs.getFunction(w2fun)); } } void case_ii_w1higher(ArrayList h, ArrayList specific, SingleFunction accum, boolean up, boolean w1Left, String baseW1, String baseW2, String upDown) { String name = "2p" + upDown + "-abcd-"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d if (w1Left) name += "w1-w2_a_" + baseW1 + baseW2; else name += "w2-w1_d_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d if (w1Left) name += "w1-w2_" + baseW1 + baseW2 + "_a"; else name += "w2-w1_" + baseW2 + baseW1 + "_d"; } h.add(name); DoubleLoopW1Higher f = new DoubleLoopW1Higher(name); fs.add(f); accum.addTerm(f); for (String w2fun : specific) { Destruct d = new Destruct(w2fun); if ((up && d.bottom.equals(baseW2)) || (!up && d.top.equals(baseW2))) f.addTerm(fs.getFunction(w2fun)); } } void case_ii_w1lower( ArrayList h, ArrayList specific, SingleFunction accum, boolean up, boolean w1Left, String baseW1, String baseW2, String[] extremityW2, String upDown) { String name ; for (String extremity : extremityW2) { name = "2p" + upDown + "-abcd-"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d if (w1Left) name += "w1-w2_" + extremity + "_" + baseW1 + baseW2; else name += "w2-w1_" + extremity + "_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d if (w1Left) name += "w1-w2_" + baseW1 + baseW2 + "_" + extremity + ""; else name += "w2-w1_" + baseW2 + baseW1 + "_" + extremity + ""; } if (name.equals("2p-w1-w2_c_ac")) { int dbg = 1; } h.add(name); DoubleLoopW1Lower f = new DoubleLoopW1Lower(name); fs.add(f); accum.addTerm(f); for (String w2fun : specific) { Destruct d = new Destruct(w2fun); if ((up && d.bottom.equals(baseW2) && d.top.equals(extremity)) || (!up && d.top.equals(baseW2) && d.bottom.equals(extremity))) f.addTerm(fs.getFunction(w2fun)); } } } /* iii. Two W1 pillars, one of which supports a W2 that occupies a column adjacent to that of the W1. Consider the two pillars to be of the same height, and the W2 to have a bottom that overlaps the supporting W1 OO O O O O */ SingleFunction case_iii_up = new SingleFunction("case_iii_up"); SingleFunction case_iii_down = new SingleFunction("case_iii_down"); void case_iii() { case_iii(this.p2_hash_up, w2b_hash, case_iii_up, true, true, "a", "c", "b", "abc"); case_iii(this.p2_hash_up, w2c_hash, case_iii_up, true, true, "b", "d", "c", "bcd"); case_iii(this.p2_hash_down, w2b_hash, case_iii_down, false, true, "a", "c", "b", "abc"); case_iii(this.p2_hash_down, w2c_hash, case_iii_down, false, true, "b", "d", "c", "bcd"); case_iii(this.p2_hash_up, w2a_hash, case_iii_up, true, false, "c", "a", "b", "abc"); case_iii(this.p2_hash_up, w2b_hash, case_iii_up, true, false, "d", "b", "c", "bcd"); case_iii(this.p2_hash_down, w2a_hash, case_iii_down, false, false, "c", "a", "b", "abc"); case_iii(this.p2_hash_down, w2b_hash, case_iii_down, false, false, "d", "b", "c", "bcd"); fs.add(case_iii_up); fs.add(case_iii_down); } void case_iii(ArrayList h, ArrayList specific, SingleFunction accum, boolean up, boolean w1FreeLeft, String baseFreeW1, String baseSupportW1, String otherW2, String width) { String[] basesW2 = new String[2], extremetiesW2 = new String[3]; if (w1FreeLeft) { basesW2[0] = baseSupportW1; basesW2[1] = otherW2 + baseSupportW1; extremetiesW2[0] = baseSupportW1; extremetiesW2[1] = otherW2 + baseSupportW1; extremetiesW2[2] = otherW2 ; } else { basesW2[0] = baseSupportW1; basesW2[1] = baseSupportW1 + otherW2 ; extremetiesW2[0] = baseSupportW1; extremetiesW2[1] = baseSupportW1 + otherW2; extremetiesW2[2] = otherW2 ; } /* for (String baseW2 : basesW2) for (String extremityW2 : extremetiesW2) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-"; if (w1FreeLeft) name += "w1-w1w2_" + extremityW2 + "_" + baseFreeW1 + baseSupportW1; else name += "w1w2-w1_" + extremityW2 + "_" + baseSupportW1 + baseFreeW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-"; if (w1FreeLeft) name += "w1-w1w2_" + baseFreeW1 + baseSupportW1 + "_" + extremityW2 ; else name += "w1w2-w1_" + baseSupportW1 + baseFreeW1 + "_" + extremityW2; } if (name.equals("2pu-w1w2-w1_ab_ac")) System.out.println(name); h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specific) { Destruct d = new Destruct(w2fun); if ((up && d.bottom.equals(baseW2) && d.top.equals(extremityW2)) || (!up && d.top.equals(baseW2) && d.bottom.equals(extremityW2))) { W4Loop w = new W4Loop("loop-" + w2fun, fs.getFunction(w2fun)); f.addTerm(w); } } } */ for (String extremityW2 : extremetiesW2) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-" + width + "-"; if (w1FreeLeft) name += "w1-w1w2_" + extremityW2 + "_" + baseFreeW1 + baseSupportW1; else name += "w1w2-w1_" + extremityW2 + "_" + baseSupportW1 + baseFreeW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-" + width + "-"; if (w1FreeLeft) name += "w1-w1w2_" + baseFreeW1 + baseSupportW1 + "_" + extremityW2 ; else name += "w1w2-w1_" + baseSupportW1 + baseFreeW1 + "_" + extremityW2; } if (name.equals("2pu-w1w2-w1_ab_ac")) { //System.out.println(name); } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specific) { Destruct d = new Destruct(w2fun); if ((up && d.bottom.contains(baseSupportW1) && d.top.equals(extremityW2)) || (!up && d.top.contains(baseSupportW1) && d.bottom.equals(extremityW2))) { W4Loop w = new W4Loop("loop-" + w2fun, fs.getFunction(w2fun)); f.addTerm(w); } } } } /* iv. Two W1 pillars, one of which supports a W3 that invades the territory of the W1. Consider that the two W1 have the same height and that the bottom of the W3 (a) overlaps the supporting W1, and (b) does not overlap the other W1 OOO OO O O Combinations: W1 on a, W3 on c W1 on b, W3 on d W1 on d, W3 on b W1 on c, W3 on a 2p-w1-w1w3inv or 2p-w1w3inv-w1 possible tops are a,b,c,ab,ac,bc,abc */ SingleFunction case_iv_up = new SingleFunction("case_iv_up"); SingleFunction case_iv_down = new SingleFunction("case_iv_down"); void case_iv() { case_iv(this.p2_hash_up, w3a_hash, case_iv_up, true, true, "a", "c", "b", "abc"); case_iv(this.p2_hash_up, w3b_hash, case_iv_up, true, true, "b", "d", "c", "bcd"); case_iv(this.p2_hash_up, w3b_hash, case_iv_up, true, false, "d", "b", "c", "bcd"); case_iv(this.p2_hash_up, w3a_hash, case_iv_up, true, false, "c", "a", "b", "abc"); case_iv(this.p2_hash_down, w3a_hash, case_iv_down, false, true, "a", "c", "b", "abc"); case_iv(this.p2_hash_down, w3b_hash, case_iv_down, false, true, "b", "d", "c", "bcd"); case_iv(this.p2_hash_down, w3b_hash, case_iv_down, false, false, "d", "b", "c", "bcd"); case_iv(this.p2_hash_down, w3a_hash, case_iv_down, false, false, "c", "a", "b", "abc"); fs.add(case_iv_up); fs.add(case_iv_down); } void case_iv(ArrayListh, ArrayList specific, SingleFunction accum, boolean up, boolean w1FreeLeft, String baseFreeW1, String baseSupportW1, String otherW3, String width) { String[] basesW3 = new String[2], extremetiesW3 = new String[7]; if (w1FreeLeft) { basesW3[0] = baseSupportW1; basesW3[1] = otherW3 + baseSupportW1; extremetiesW3[0] = baseSupportW1; extremetiesW3[1] = otherW3; extremetiesW3[2] = baseFreeW1 ; extremetiesW3[3] = otherW3 + baseSupportW1; extremetiesW3[4] = baseFreeW1 + otherW3; extremetiesW3[5] = baseFreeW1 + baseSupportW1 ; extremetiesW3[6] = baseFreeW1 + otherW3 + baseSupportW1 ; } else { basesW3[0] = baseSupportW1; basesW3[1] = baseSupportW1 + otherW3 ; extremetiesW3[0] = baseSupportW1; extremetiesW3[1] = otherW3; extremetiesW3[2] = baseFreeW1 ; extremetiesW3[3] = baseSupportW1 + otherW3; extremetiesW3[4] = otherW3 + baseFreeW1; extremetiesW3[5] = baseSupportW1 + baseFreeW1; extremetiesW3[6] = baseSupportW1 + otherW3 + baseFreeW1; } for (String extremityW3 : extremetiesW3) { String name = "2p"; if (up) { // going up name += "u-" + width + "-"; if (w1FreeLeft) name += "w1-w1w3inv_" + extremityW3 + "_" + baseFreeW1 + baseSupportW1; else name += "w1w3inv-w1_" + extremityW3 + "_" + baseSupportW1 + baseFreeW1 ; } else { // going down name += "d-" + width + "-"; if (w1FreeLeft) name += "w1-w1w3inv_" + baseFreeW1 + baseSupportW1 + "_" + extremityW3 ; else name += "w1w3inv-w1_" + baseSupportW1 + baseFreeW1 + "_" + extremityW3 ; } boolean dbgb = false; //if (name.equals("2pd-w1w3inv-w1_ac_bc")) // dbgb = true; h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String baseW3 : basesW3) { for (String w3fun : specific) { Destruct d = new Destruct(w3fun); if ((up && d.bottom.equals(baseW3) && d.top.equals(extremityW3)) || (!up && d.top.equals(baseW3) && d.bottom.equals(extremityW3))) { W4Loop w = new W4Loop("loop-" + w3fun, fs.getFunction(w3fun)); f.addTerm(w); if (dbgb) System.out.println("include " + w3fun); } else { if (dbgb) System.out.println("exclude " + w3fun); } } } dbgb = false; } } /* v. Two W1 pillars, one of which supports a W3 adjacent to the territory of the W1. Consider that the two W1 have the same height and that the bottom of the W3 overlaps the supporting W1 OOO or OOO OO OO O O O O Combinations: W1 on a, W1 on c or d, W3 left-aligned to b W1 on d, W1 on a or b, W3 left-aligned to a 2p-w1-w1w3adj or 2p-w1w3adj-w1 */ SingleFunction case_v_up = new SingleFunction("case_v_up"); SingleFunction case_v_down = new SingleFunction("case_v_down"); void case_v() { case_v(this.p2_hash_up, w3b_hash, case_v_up, true, true, "a", "c", "b", "c", "d"); case_v(this.p2_hash_up, w3b_hash, case_v_up, true, true, "a", "d", "b", "c", "d"); case_v(this.p2_hash_up, w3a_hash, case_v_up, true, false, "d", "b", "a", "b", "c"); case_v(this.p2_hash_up, w3a_hash, case_v_up, true, false, "d", "a", "a", "b", "c"); case_v(this.p2_hash_down, w3b_hash, case_v_down, false, true, "a", "c", "b", "c", "d"); case_v(this.p2_hash_down, w3b_hash, case_v_down, false, true, "a", "d", "b", "c", "d"); case_v(this.p2_hash_down, w3a_hash, case_v_down, false, false, "d", "b", "a", "b", "c"); case_v(this.p2_hash_down, w3a_hash, case_v_down, false, false, "d", "a", "a", "b", "c"); fs.add(case_v_up); fs.add(case_v_down); } void case_v( ArrayList h, ArrayList specific, SingleFunction accum, boolean up, boolean w1FreeLeft, String baseFreeW1, String baseSupportW1, String w3_1, String w3_2, String w3_3) { String[] extremetiesW3 = new String[7]; extremetiesW3[0] = w3_1; extremetiesW3[1] = w3_2; extremetiesW3[2] = w3_3 ; extremetiesW3[3] = w3_1 + w3_2; extremetiesW3[4] = w3_1 + w3_3; extremetiesW3[5] = w3_2 + w3_3 ; extremetiesW3[6] = w3_1 + w3_2 + w3_3 ; Destruct column = new Destruct("w1"+ baseSupportW1+ "_" + baseSupportW1 + "_" + baseSupportW1); for (String extremityW3 : extremetiesW3) { String name = "2p"; if (up) { // going up name += "u-abcd-"; if (w1FreeLeft) name += "w1-w1w3adj_" + extremityW3 + "_" + baseFreeW1 + baseSupportW1; else name += "w1w3adj-w1_" + extremityW3 + "_" + baseSupportW1 + baseFreeW1 ; } else { // going down name += "d-abcd-"; if (w1FreeLeft) name += "w1-w1w3adj_" + baseFreeW1 + baseSupportW1 + "_" + extremityW3 ; else name += "w1w3adj-w1_" + baseSupportW1 + baseFreeW1 + "_" + extremityW3 ; } boolean dbgb = false; //if (name.equals("2pd-w1w3inv-w1_ac_bc")) // dbgb = true; h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); int x = 1; for (String w3fun : specific) { //System.out.println(x + ":" + w3fun + ":" + fs.getFunction(w3fun).getName()); x++; Destruct d = new Destruct(w3fun); if ((up && overlaps(d, column) && d.top.equals(extremityW3)) || (!up && overlaps(column, d) && d.bottom.equals(extremityW3))) { W4Loop w = new W4Loop("loop-" + w3fun, fs.getFunction(w3fun)); f.addTerm(w); if (dbgb) System.out.println("include " + w3fun); } else { if (dbgb) System.out.println("exclude " + w3fun); } } dbgb = false; } } /* vi. A W1 pillar, and a W2 supporting a W3 that invades the territory of the W1. Consider equal the heights of the W1 and W2; the W3 bottom must overlap the W2 top, and not overlap the W1 top OOO OO O OO Combinations: W1 on a, W2 top and bottom c,d,cd, W3 bottom c,bc and top abc, etc W1 on d, W2 top and bottom a,b,ab, W3 bottom b,bc and top bcd, etc 2p-w1-w2w3inv */ SingleFunction case_vi_up = new SingleFunction("case_vi_up"); SingleFunction case_vi_down = new SingleFunction("case_vi_down"); void case_vi() { case_vi(p2_hash_up, case_vi_up, "a", "c", "d", "b", "c", w2c_hash, w3a_hash, true, true); case_vi(p2_hash_up, case_vi_up, "d", "a", "b", "b", "c", w2a_hash, w3b_hash, true, false); case_vi(p2_hash_down, case_vi_down, "a", "c", "d", "b", "c", w2c_hash, w3a_hash, false, true); case_vi(p2_hash_down, case_vi_down, "d", "a", "b", "b", "c", w2a_hash, w3b_hash, false, false); fs.add(case_vi_up); fs.add(case_vi_down); } void case_vi(ArrayList h, SingleFunction accum, String baseW1, String baseW2_1, String baseW2_2, String baseW3_1, String baseW3_2, ArrayList specificW2, ArrayList specificW3, boolean up, boolean w1FreeLeft) { String[] basesW2 = new String[3], extremetiesW3 = new String[7]; if (w1FreeLeft) { basesW2[0] = baseW2_1; basesW2[1] = baseW2_2 ; basesW2[2] = baseW2_1 + baseW2_2; extremetiesW3[0] = baseW1; extremetiesW3[1] = baseW3_1; extremetiesW3[2] = baseW3_2 ; extremetiesW3[3] = baseW1 + baseW3_1; extremetiesW3[4] = baseW1 + baseW3_2; extremetiesW3[5] = baseW3_1 + baseW3_2 ; extremetiesW3[6] = baseW1 + baseW3_1 + baseW3_2 ; } else { basesW2[0] = baseW2_1; basesW2[1] = baseW2_2 ; basesW2[2] = baseW2_1 + baseW2_2; extremetiesW3[0] = baseW1; extremetiesW3[1] = baseW3_1; extremetiesW3[2] = baseW3_2 ; extremetiesW3[3] = baseW3_1 + baseW1; extremetiesW3[4] = baseW3_2 + baseW1; extremetiesW3[5] = baseW3_1 + baseW3_2 ; extremetiesW3[6] = baseW3_1 + baseW3_2 + baseW1; } Destruct d1 = new Destruct("w1_" + baseW1 + "_" + baseW1); for (String baseW2 : basesW2) for (String extremityW3 : extremetiesW3) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-abcd-"; if (w1FreeLeft) name += "w1-w2w3inv_" + extremityW3 + "_" + baseW1 + baseW2; else name += "w2w3inv-w1_" + extremityW3 + "_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-abcd-"; if (w1FreeLeft) name += "w1-w2w3inv_" + baseW1 + baseW2 + "_" + extremityW3 ; else name += "w2w3inv-w1_" + baseW2 + baseW1 + "_" + extremityW3; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specificW2) { Destruct d2 = new Destruct(w2fun); if ((up && d2.bottom.equals(baseW2)) || (!up && d2.top.equals(baseW2))) { for (String w3fun : specificW3) { Destruct d3 = new Destruct(w3fun); if ((up && d3.top.equals(extremityW3) && overlaps(d3, d2) && !overlaps(d3, d1)) || (!up && d3.bottom.equals(extremityW3) && overlaps(d2, d3) && !overlaps(d1, d3))) { W4Case_vi_loop w4 = new W4Case_vi_loop("W4Case_vi_loop", fs.getFunction(w2fun), fs.getFunction(w3fun)); f.addTerm(w4); } } } } } } /* vii. A W1 pillar, and a W2 supporting a W3 adjacent to the territory of the W1. Consider equal the heights of the W1 and W2; the W3 bottom must overlap the W2 top OOO OO O OO Combinations: W1 on a, W2 top and bottom c,d,cd, W3 bottom any combination of bcd (but not b alone) and top bcd, etc W1 on d, W2 top and bottom a,b,ab, W3 bottom any combination of abc (but not c alone) and top abc, etc 2p-w1-w2w3adj */ SingleFunction case_vii_up = new SingleFunction("case_vii_up"); SingleFunction case_vii_down = new SingleFunction("case_vii_down"); void case_vii() { case_vii(p2_hash_up, case_vii_up, "a", "c", "d", "b", "c", "d", w2c_hash, w3b_hash, true, true); case_vii(p2_hash_up, case_vii_up, "d", "a", "b", "a", "b", "c", w2a_hash, w3a_hash, true, false); case_vii(p2_hash_down, case_vii_down, "a", "c", "d", "b", "c", "d", w2c_hash, w3b_hash, false, true); case_vii(p2_hash_down, case_vii_down, "d", "a", "b", "a", "b", "c", w2a_hash, w3a_hash, false, false); fs.add(case_vii_up); fs.add(case_vii_down); } void case_vii(ArrayList h, SingleFunction accum, String baseW1, String baseW2_1, String baseW2_2, String baseW3_1, String baseW3_2, String baseW3_3, ArrayList specificW2, ArrayList specificW3, boolean up, boolean w1FreeLeft) { String[] basesW2 = new String[3], extremetiesW3 = new String[7]; basesW2[0] = baseW2_1; basesW2[1] = baseW2_2 ; basesW2[2] = baseW2_1 + baseW2_2; extremetiesW3[0] = baseW3_1; extremetiesW3[1] = baseW3_2; extremetiesW3[2] = baseW3_3 ; extremetiesW3[3] = baseW3_1 + baseW3_2; extremetiesW3[4] = baseW3_1 + baseW3_3; extremetiesW3[5] = baseW3_2 + baseW3_3 ; extremetiesW3[6] = baseW3_1 + baseW3_2 + baseW3_3 ; Destruct d1 = new Destruct("w1_" + baseW1 + "_" + baseW1); for (String baseW2 : basesW2) for (String extremityW3 : extremetiesW3) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-abcd-"; if (w1FreeLeft) name += "w1-w2w3adj_" + extremityW3 + "_" + baseW1 + baseW2; else name += "w2w3adj-w1_" + extremityW3 + "_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-abcd-"; if (w1FreeLeft) name += "w1-w2w3adj_" + baseW1 + baseW2 + "_" + extremityW3 ; else name += "w2w3adj-w1_" + baseW2 + baseW1 + "_" + extremityW3; } if (h.contains(name)) { int qq = 1 / 0; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specificW2) { Destruct d2 = new Destruct(w2fun); if ((up && d2.bottom.equals(baseW2)) || (!up && d2.top.equals(baseW2))) { for (String w3fun : specificW3) { Destruct d3 = new Destruct(w3fun); if ((up && d3.top.equals(extremityW3) && overlaps(d3, d2) ) || (!up && d3.bottom.equals(extremityW3) && overlaps(d2, d3) )) { W4Case_vi_loop w4 = new W4Case_vi_loop("W4Case_vii_loop", fs.getFunction(w2fun), fs.getFunction(w3fun)); f.addTerm(w4); } } } } } } SingleFunction case_viii_up = new SingleFunction("case_viii_up"); SingleFunction case_viii_down = new SingleFunction("case_viii_down"); void case_viii() { Set> w2w2scanner = w2w2fs.getScanner(); for (Map.Entry w2w2Entry : w2w2scanner) { String w2w2Name = w2w2Entry.getKey(); if (!w2w2Name.startsWith("2p-abcd-w2-w2")) continue; Function f = w2w2fs.getFunction(w2w2Name); fs.add(f, w2w2Name); p2_hash_up.add(w2w2Name); p2_hash_down.add(w2w2Name); case_viii_up.addTerm(f); case_viii_down.addTerm(f); } fs.add(case_viii_up); fs.add(case_viii_down); } /* ix. Two W2 one of which supports a W3 that invades the territory of the other W2. Consider the height of the two W2 to be equal. OOO OO O OO OO O O OO */ SingleFunction case_ix_up = new SingleFunction("case_ix_up"); SingleFunction case_ix_down = new SingleFunction("case_ix_down"); void case_ix() { String[] listW3l = {"a", "b", "c", "ab", "ac", "bc", "abc"}; String[] listW3r = {"d", "b", "c", "bd", "cd", "bc", "bcd"}; case_ix(p2_hash_up, case_ix_up, "c", "b", w3a_hash, true, true, listW3l); case_ix(p2_hash_up, case_ix_up, "b", "c", w3b_hash, true, false, listW3r); case_ix(p2_hash_down, case_ix_down, "c", "b", w3a_hash, false, true, listW3l); case_ix(p2_hash_down, case_ix_down, "b", "c", w3b_hash, false, false, listW3r); fs.add(case_ix_up); fs.add(case_ix_down); } void case_ix( ArrayList h, SingleFunction accum, String colW3, String baseOptW3, ArrayList specificW3, boolean up, boolean w3Left, String[] w3list) { String[] w3ShortList = new String[2]; if (w3Left) { w3ShortList[0] = colW3; w3ShortList[1] = baseOptW3 + colW3; } else { w3ShortList[0] = colW3; w3ShortList[1] = colW3 + baseOptW3; } String[] w2w2BaseList = {"acd", "ac", "ad", "abd", "bd"}; for (String extremityW3 : w3list) { for (String w2w2Base : w2w2BaseList) { String name = "2p"; if (up) { name += "u-abcd-"; if (w3Left) name += "w2-w2w3inv_" + extremityW3 + "_" + w2w2Base; else name += "w2w3inv-w2_" + extremityW3 + "_" + w2w2Base; } else { name += "d-abcd-"; if (w3Left) name += "w2-w2w3inv_" + w2w2Base + "_" + extremityW3 ; else name += "w2w3inv-w2_" + w2w2Base + "_" + extremityW3; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); if (name.equals("2pu-w2-w2w3inv_d_acd")) { int dbg = 1; } Set> scanner = w2w2fs.getScanner(); for (Map.Entry w2w2Entry : scanner) { String w2w2 = w2w2Entry.getKey(); if (!w2w2.startsWith("2p")) continue; Destruct w2w2d = new Destruct(w2w2); if ((up && w2w2d.bottom.equals(w2w2Base) && w2w2d.top.contains(colW3)) || (!up && w2w2d.top.equals(w2w2Base) && w2w2d.bottom.contains(colW3))) { for (String w3 : specificW3) { Destruct d3 = new Destruct(w3); // W4Case_ix_loop 2p-w2-w2_abd_acd * w3a_ab_bc_srot if (w2w2.equals("2p-w2-w2_abd_acd" ) && w3.equals("w3a_ab_bc_srot")) { int dbg = 1; } if ((up && d3.top.equals(extremityW3) && (d3.bottom.equals(w3ShortList[0]) || d3.bottom.equals(w3ShortList[1]))) || (!up && d3.bottom.equals(extremityW3) && (d3.top.equals(w3ShortList[0]) || d3.top.equals(w3ShortList[1])))) { W4Case_ix_loop w4 = new W4Case_ix_loop("W4Case_ix_loop", fs.getFunction(w2w2), fs.getFunction(w3)); f.addTerm(w4); } } } } } } } /* xi. W1 and W2 supporting W4. W1 and W2 of equal height OOOO OO OO O O O OO 2p-w1-w2w4 */ SingleFunction case_xi_up = new SingleFunction("case_xi_up"); SingleFunction case_xi_down = new SingleFunction("case_xi_down"); void case_xi() { case_xi(p2_hash_up, case_xi_up, "a", "c", "d", w2c_hash, w4_hash, true, true); case_xi(p2_hash_up, case_xi_up, "d", "a", "b", w2a_hash, w4_hash, true, false); case_xi(p2_hash_down, case_xi_down, "a", "c", "d", w2c_hash, w4_hash, false, true); case_xi(p2_hash_down, case_xi_down, "d", "a", "b", w2a_hash, w4_hash, false, false); fs.add(case_xi_up); fs.add(case_xi_down); } void case_xi( ArrayList h, SingleFunction accum, String baseW1, String baseW2_1, String baseW2_2, ArrayList specificW2, ArrayList specificW4, boolean up, boolean w1FreeLeft) { String[] basesW2 = new String[3] // , extremetiesW4 = new String[15] ; basesW2[0] = baseW2_1; basesW2[1] = baseW2_2 ; basesW2[2] = baseW2_1 + baseW2_2; Destruct d1 = new Destruct("w1_" + baseW1 + "_" + baseW1); for (String baseW2 : basesW2) for (String extremityW4 : mix4) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-abcd-"; if (w1FreeLeft) name += "w1-w2w4_" + extremityW4 + "_" + baseW1 + baseW2; else name += "w2w4-w1_" + extremityW4 + "_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-abcd-"; if (w1FreeLeft) name += "w1-w2w4_" + baseW1 + baseW2 + "_" + extremityW4 ; else name += "w2w4-w1_" + baseW2 + baseW1 + "_" + extremityW4; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specificW2) { Destruct d2 = new Destruct(w2fun); if ((up && d2.bottom.equals(baseW2)) || (!up && d2.top.equals(baseW2))) { for (String w4fun : specificW4) { Destruct d4 = new Destruct(w4fun); if ((up && d4.top.equals(extremityW4) && overlaps(d4, d2) &&!overlaps(d4, d1) ) || (!up && d4.bottom.equals(extremityW4) && overlaps(d2, d4) && !overlaps(d1, d4) )) { W4Case_vi_loop w4 = new W4Case_vi_loop("W4Case_xi_loop", fs.getFunction(w2fun), fs.getFunction(substitute(w4fun))); f.addTerm(w4); } } } } } } /* x. Two W1 of equal height, one of which supports a W4 OOOO OO OO O O O O OOOO OO OO O O O O OOOO OO OO O O O O 2p-w1-w1w4 */ SingleFunction case_x_up = new SingleFunction("case_x_up"); SingleFunction case_x_down = new SingleFunction("case_x_down"); void case_x() { case_x(this.p2_hash_up, case_x_up, true, true, "a", "c"); case_x(this.p2_hash_up, case_x_up, true, true, "a", "d"); case_x(this.p2_hash_up, case_x_up, true, true, "b", "d"); case_x(this.p2_hash_up, case_x_up, true, false, "d", "b"); case_x(this.p2_hash_up, case_x_up, true, false, "d", "a"); case_x(this.p2_hash_up, case_x_up, true, false, "c", "a"); case_x(this.p2_hash_down, case_x_down, false, true, "a", "c"); case_x(this.p2_hash_down, case_x_down, false, true, "a", "d"); case_x(this.p2_hash_down, case_x_down, false, true, "b", "d"); case_x(this.p2_hash_down, case_x_down, false, false, "d", "b"); case_x(this.p2_hash_down, case_x_down, false, false, "d", "a"); case_x(this.p2_hash_down, case_x_down, false, false, "c", "a"); fs.add(case_x_up); fs.add(case_x_down); } void case_x( ArrayList h, SingleFunction accum, boolean up, boolean w1FreeLeft, String baseFreeW1, String baseSupportW1) { Destruct column = new Destruct("w1"+ baseSupportW1+ "_" + baseSupportW1 + "_" + baseSupportW1); for (String extremityW4 : mix4) { String name = "2p"; if (up) { // going up name += "u-abcd-"; if (w1FreeLeft) name += "w1-w1w4_" + extremityW4 + "_" + baseFreeW1 + baseSupportW1; else name += "w1w4-w1_" + extremityW4 + "_" + baseSupportW1 + baseFreeW1 ; } else { // going down name += "d-abcd-"; if (w1FreeLeft) name += "w1-w1w4_" + baseFreeW1 + baseSupportW1 + "_" + extremityW4 ; else name += "w1w4-w1_" + baseSupportW1 + baseFreeW1 + "_" + extremityW4 ; } boolean dbgb = false; //if (name.equals("2pd-w1w3inv-w1_ac_bc")) // dbgb = true; h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w4fun : w4_hash) { //System.out.println(x + ":" + w3fun + ":" + fs.getFunction(w3fun).getName()); if (!w4fun.startsWith("w4")) continue; Destruct d = new Destruct(w4fun); if ((up && d.bottom.contains(baseSupportW1) && !d.bottom.contains(baseFreeW1) && d.top.equals(extremityW4)) || (!up && d.top.contains(baseSupportW1) && !d.top.contains(baseFreeW1) && d.bottom.equals(extremityW4))) { W4Loop w = new W4Loop("loop-" + w4fun, fs.getFunction(substitute(w4fun))); f.addTerm(w); } } dbgb = false; } } /* xii. W1 supporting W4 and W2. W1 and W2 of equal height OOOO OO OO O O OO O 2p-w1w4-w2 */ SingleFunction case_xii_up = new SingleFunction("case_xii_up"); SingleFunction case_xii_down = new SingleFunction("case_xii_down"); void case_xii() { case_xii(p2_hash_up, case_xii_up, "a", "c", "d", w2c_hash, w4_hash, true, true); case_xii(p2_hash_up, case_xii_up, "d", "a", "b", w2a_hash, w4_hash, true, false); case_xii(p2_hash_down, case_xii_down, "a", "c", "d", w2c_hash, w4_hash, false, true); case_xii(p2_hash_down, case_xii_down, "d", "a", "b", w2a_hash, w4_hash, false, false); fs.add(case_xii_up); fs.add(case_xii_down); } void case_xii( ArrayList h, SingleFunction accum, String baseW1, String baseW2_1, String baseW2_2, ArrayList specificW2, ArrayList specificW4, boolean up, boolean w2FreeLeft) { String[] basesW2 = new String[3] ; basesW2[0] = baseW2_1; basesW2[1] = baseW2_2 ; basesW2[2] = baseW2_1 + baseW2_2; Destruct d1 = new Destruct("w1_" + baseW1 + "_" + baseW1); for (String baseW2 : basesW2) for (String extremityW4 : mix4) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-abcd-"; if (w2FreeLeft) name += "w2-w1w4_" + extremityW4 + "_" + baseW1 + baseW2; else name += "w1w4-w2_" + extremityW4 + "_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-abcd-"; if (w2FreeLeft) name += "w2-w1w4_" + baseW1 + baseW2 + "_" + extremityW4 ; else name += "w1w4-w2_" + baseW2 + baseW1 + "_" + extremityW4; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specificW2) { Destruct d2 = new Destruct(w2fun); if ((up && d2.bottom.equals(baseW2)) || (!up && d2.top.equals(baseW2))) { for (String w4fun : specificW4) { Destruct d4 = new Destruct(w4fun); if ((up && d4.top.equals(extremityW4) && overlaps(d4, d1) &&!overlaps(d4, d2) ) || (!up && d4.bottom.equals(extremityW4) && overlaps(d1, d4) && !overlaps(d2, d4) )) { W4Case_vi_loop w4 = new W4Case_vi_loop("W4Case_xii_loop", fs.getFunction(w2fun), fs.getFunction(substitute(w4fun))); f.addTerm(w4); } } } } } } /* xiii. W1 and W2 supporting W2 close. W1 and W2 of equal height OO O OO O O O OO */ SingleFunction case_xiii_up = new SingleFunction("case_xiii_up"); SingleFunction case_xiii_down = new SingleFunction("case_xiii_down"); void case_xiii() { case_xiii(p2_hash_up, case_xiii_up, "a", "c", "d", "b", "c", w2c_hash, w2b_hash, true, true); case_xiii(p2_hash_up, case_xiii_up, "d", "a", "b", "b", "c", w2a_hash, w2b_hash, true, false); case_xiii(p2_hash_down, case_xiii_down, "a", "c", "d", "b", "c", w2c_hash, w2b_hash, false, true); case_xiii(p2_hash_down, case_xiii_down, "d", "a", "b", "b", "c", w2a_hash, w2b_hash, false, false); fs.add(case_xiii_up); fs.add(case_xiii_down); } void case_xiii(ArrayList h, SingleFunction accum, String baseW1, String baseW2_1, String baseW2_2, String baseOtherW2_1, String baseOtherW2_2, ArrayList specificW2, ArrayList specificOtherW2, boolean up, boolean w1FreeLeft) { String[] basesW2 = new String[3], extremetiesW2 = new String[3]; basesW2[0] = baseW2_1; basesW2[1] = baseW2_2 ; basesW2[2] = baseW2_1 + baseW2_2; extremetiesW2[0] = baseOtherW2_1; extremetiesW2[1] = baseOtherW2_2; extremetiesW2[2] = baseOtherW2_1 + baseOtherW2_2; Destruct d1 = new Destruct("w1_" + baseW1 + "_" + baseW1); for (String baseW2 : basesW2) for (String extremityW2 : extremetiesW2) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-abcd-"; if (w1FreeLeft) name += "w1-w2w2adj_" + extremityW2 + "_" + baseW1 + baseW2; else name += "w2w2adj-w1_" + extremityW2 + "_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-abcd-"; if (w1FreeLeft) name += "w1-w2w2adj_" + baseW1 + baseW2 + "_" + extremityW2 ; else name += "w2w2adj-w1_" + baseW2 + baseW1 + "_" + extremityW2; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specificW2) { Destruct d2 = new Destruct(w2fun); if ((up && d2.bottom.equals(baseW2)) || (!up && d2.top.equals(baseW2))) { for (String otherW2fun : specificOtherW2) { Destruct dOther2 = new Destruct(otherW2fun); if ((up && dOther2.top.equals(extremityW2) && overlaps(dOther2, d2) ) || (!up && dOther2.bottom.equals(extremityW2) && overlaps(d2, dOther2) )) { W4Case_vi_loop w4 = new W4Case_vi_loop("W4Case_xiii_loop", fs.getFunction(w2fun), fs.getFunction(otherW2fun)); f.addTerm(w4); } } } } } } /* xiv. W2 and W2 supporting W3 close. W2 and W2 of equal height OOO O OO OO O O OO */ SingleFunction case_xiv_up = new SingleFunction("case_xiv_up"); SingleFunction case_xiv_down = new SingleFunction("case_xiv_down"); void case_xiv() { String[] listW3l = {"a", "b", "c", "ab", "ac", "bc", "abc"}; String[] listW3r = {"d", "b", "c", "bd", "cd", "bc", "bcd"}; case_xiv(p2_hash_up, case_xiv_up, "cd", "ab", w3b_hash, true, true, listW3r); case_xiv(p2_hash_up, case_xiv_up, "ab", "cd", w3a_hash, true, false, listW3l); case_xiv(p2_hash_down, case_xiv_down, "cd", "ab", w3b_hash, false, true, listW3r); case_xiv(p2_hash_down, case_xiv_down, "ab", "cd", w3a_hash, false, false, listW3l); fs.add(case_xiv_up); fs.add(case_xiv_down); } void case_xiv( ArrayList h, SingleFunction accum, String must, String mustnot, ArrayList specificW3, boolean up, boolean w3Right, String[] w3list) { String[] w2w2BaseList = {"acd", "ac", "ad", "abd", "bd"}; for (String extremityW3 : w3list) { for (String w2w2Base : w2w2BaseList) { String name = "2p"; if (up) { name += "u-abcd-"; if (w3Right) name += "w2-w2w3clo_" + extremityW3 + "_" + w2w2Base; else name += "w2w3clo-w2_" + extremityW3 + "_" + w2w2Base; } else { name += "d-abcd-"; if (w3Right) name += "w2-w2w3clo_" + w2w2Base + "_" + extremityW3 ; else name += "w2w3clo-w2_" + w2w2Base + "_" + extremityW3; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); if (name.equals("2pu-w2-w2w3inv_d_acd")) { int dbg = 1; } Set> scanner = w2w2fs.getScanner(); for (Map.Entry w2w2Entry : scanner) { String w2w2 = w2w2Entry.getKey(); if (!w2w2.startsWith("2p")) continue; Destruct w2w2d = new Destruct(w2w2); if ((up && w2w2d.bottom.equals(w2w2Base)) || (!up && w2w2d.top.equals(w2w2Base) )) { for (String w3 : specificW3) { Destruct d3 = new Destruct(w3); if (w2w2.equals("2p-w2-w2_abd_acd" ) && w3.equals("w3a_ab_bc_srot")) { int dbg = 1; } if ((up && d3.top.equals(extremityW3) && overlaps(d3, w2w2d, must) && !overlaps(d3, w2w2d, mustnot)) || (!up && d3.bottom.equals(extremityW3) && overlaps(w2w2d, d3, must) && !overlaps(w2w2d, d3, mustnot))) { W4Case_ix_loop w4 = new W4Case_ix_loop("W4Case_xiv_loop" , fs.getFunction(w2w2), fs.getFunction(w3)); f.addTerm(w4); } } } } } } } /* xv. W2 and W2 supporting W2 close. W2 and W2 of equal height OO O OO OO O O OO 2p-w2-w2w2 */ SingleFunction case_xv_up = new SingleFunction("case_xv_up"); SingleFunction case_xv_down = new SingleFunction("case_xv_down"); void case_xv() { String[] listW2 = { "b", "c", "bc"}; case_xv(p2_hash_up, case_xv_up, "cd", "ab", w2b_hash, true, true, listW2); case_xv(p2_hash_up, case_xv_up, "ab", "cd", w2b_hash, true, false, listW2); case_xv(p2_hash_down, case_xv_down, "cd", "ab", w2b_hash, false, true, listW2); case_xv(p2_hash_down, case_xv_down, "ab", "cd", w2b_hash, false, false, listW2); fs.add(case_xv_up); fs.add(case_xv_down); } void case_xv( ArrayList h, SingleFunction accum, String must, String mustnot, ArrayList specificW2, boolean up, boolean w2SupportRight, String[] w2list) { String[] w2w2BaseList = {"acd", "ac", "ad", "abd", "bd"}; for (String extremityW2 : w2list) { for (String w2w2Base : w2w2BaseList) { String name = "2p"; if (up) { name += "u-abcd-"; if (w2SupportRight) name += "w2-w2w2_" + extremityW2 + "_" + w2w2Base; else name += "w2w2-w2_" + extremityW2 + "_" + w2w2Base; } else { name += "d-abcd-"; if (w2SupportRight) name += "w2-w2w2_" + w2w2Base + "_" + extremityW2 ; else name += "w2w2-w2_" + w2w2Base + "_" + extremityW2; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); if (name.equals("2pu-w2-w2w3inv_d_acd")) { int dbg = 1; } Set> scanner = w2w2fs.getScanner(); for (Map.Entry w2w2Entry : scanner) { String w2w2 = w2w2Entry.getKey(); if (!w2w2.startsWith("2p")) continue; Destruct w2w2d = new Destruct(w2w2); if ((up && w2w2d.bottom.equals(w2w2Base)) || (!up && w2w2d.top.equals(w2w2Base) )) { for (String w2 : specificW2) { Destruct d2 = new Destruct(w2); if (w2w2.equals("2p-w2-w2_abd_acd" ) && w2.equals("w3a_ab_bc_srot")) { int dbg = 1; } if ((up && d2.top.equals(extremityW2) && overlaps(d2, w2w2d, must) && !overlaps(d2, w2w2d, mustnot)) || (!up && d2.bottom.equals(extremityW2) && overlaps(w2w2d, d2, must) && !overlaps(w2w2d, d2, mustnot))) { W4Case_ix_loop w4 = new W4Case_ix_loop("W4Case_xv_loop" , fs.getFunction(w2w2), fs.getFunction(w2)); f.addTerm(w4); } } } } } } } /* xvi. W2 and W2 supporting W4. W2 and W2 of equal height OOO OO OO O O OO 2p-w2-w2w4 */ SingleFunction case_xvi_up = new SingleFunction("case_xvi_up"); SingleFunction case_xvi_down = new SingleFunction("case_xvi_down"); void case_xvi() { case_xvi(p2_hash_up, case_xvi_up, "cd", "ab", w4_hash, true, true, mix4); case_xvi(p2_hash_up, case_xvi_up, "ab", "cd", w4_hash, true, false, mix4); case_xvi(p2_hash_down, case_xvi_down, "cd", "ab", w4_hash, false, true, mix4); case_xvi(p2_hash_down, case_xvi_down, "ab", "cd", w4_hash, false, false, mix4); fs.add(case_xvi_up); fs.add(case_xvi_down); } void case_xvi( ArrayList h, SingleFunction accum, String must, String mustnot, ArrayList specificW4, boolean up, boolean w4SupportRight, String[] w4list) { String[] w2w2BaseList = {"acd", "ac", "ad", "abd", "bd"}; for (String extremityW4 : w4list) { for (String w2w2Base : w2w2BaseList) { String name = "2p"; if (up) { name += "u-abcd-"; if (w4SupportRight) name += "w2-w2w4_" + extremityW4 + "_" + w2w2Base; else name += "w2w4-w2_" + extremityW4 + "_" + w2w2Base; } else { name += "d-abcd-"; if (w4SupportRight) name += "w2-w2w4_" + w2w2Base + "_" + extremityW4 ; else name += "w2w4-w2_" + w2w2Base + "_" + extremityW4; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); if (name.equals("2pu-w2-w2w3inv_d_acd")) { int dbg = 1; } Set> scanner = w2w2fs.getScanner(); for (Map.Entry w2w2Entry : scanner) { String w2w2 = w2w2Entry.getKey(); if (!w2w2.startsWith("2p")) continue; Destruct w2w2d = new Destruct(w2w2); if ((up && w2w2d.bottom.equals(w2w2Base)) || (!up && w2w2d.top.equals(w2w2Base) )) { for (String w4 : specificW4) { Destruct d4 = new Destruct(w4); if (w2w2.equals("2p-w2-w2_abd_acd" ) && w4.equals("w3a_ab_bc_srot")) { int dbg = 1; } if ((up && d4.top.equals(extremityW4) && overlaps(d4, w2w2d, must) && !overlaps(d4, w2w2d, mustnot)) || (!up && d4.bottom.equals(extremityW4) && overlaps(w2w2d, d4, must) && !overlaps(w2w2d, d4, mustnot))) { W4Case_ix_loop loop4 = new W4Case_ix_loop("W4Case_xvi_loop" , fs.getFunction(w2w2), fs.getFunction(substitute(w4))); f.addTerm(loop4); } } } } } } } /* xvii. W2 and W2 supporting W2 distant. W2 and W2 of equal height OO O OO OO O O OO */ SingleFunction case_xvii_up = new SingleFunction("case_xvii_up"); SingleFunction case_xvii_down = new SingleFunction("case_xvii_down"); void case_xvii() { String[] listW2r = { "c", "d", "cd"}; String[] listW2l = { "a", "b", "ab"}; case_xvii(p2_hash_up, case_xvii_up, "cd", "ab", w2c_hash, true, true, listW2r); case_xvii(p2_hash_up, case_xvii_up, "ab", "cd", w2a_hash, true, false, listW2l); case_xvii(p2_hash_down, case_xvii_down, "cd", "ab", w2c_hash, false, true, listW2r); case_xvii(p2_hash_down, case_xvii_down, "ab", "cd", w2a_hash, false, false, listW2l); fs.add(case_xvii_up); fs.add(case_xvii_down); } void case_xvii( ArrayList h, SingleFunction accum, String must, String mustnot, ArrayList specificW2, boolean up, boolean w2SupportRight, String[] w2list) { String[] w2w2BaseList = {"acd", "ac", "ad", "abd", "bd"}; for (String extremityW2 : w2list) { for (String w2w2Base : w2w2BaseList) { String name = "2p"; if (up) { name += "u-abcd-"; if (w2SupportRight) name += "w2-w2w2dist_" + extremityW2 + "_" + w2w2Base; else name += "w2w2dist-w2_" + extremityW2 + "_" + w2w2Base; } else { name += "d-abcd-"; if (w2SupportRight) name += "w2-w2w2dist_" + w2w2Base + "_" + extremityW2 ; else name += "w2w2dist-w2_" + w2w2Base + "_" + extremityW2; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); if (name.equals("2pu-w2-w2w3inv_d_acd")) { int dbg = 1; } Set> scanner = w2w2fs.getScanner(); for (Map.Entry w2w2Entry : scanner) { String w2w2 = w2w2Entry.getKey(); if (!w2w2.startsWith("2p")) continue; Destruct w2w2d = new Destruct(w2w2); if ((up && w2w2d.bottom.equals(w2w2Base)) || (!up && w2w2d.top.equals(w2w2Base) )) { for (String w2 : specificW2) { Destruct d2 = new Destruct(w2); if (w2w2.equals("2p-w2-w2_abd_acd" ) && w2.equals("w3a_ab_bc_srot")) { int dbg = 1; } if ((up && d2.top.equals(extremityW2) && overlaps(d2, w2w2d, must) && !overlaps(d2, w2w2d, mustnot)) || (!up && d2.bottom.equals(extremityW2) && overlaps(w2w2d, d2, must) && !overlaps(w2w2d, d2, mustnot))) { W4Case_ix_loop w4 = new W4Case_ix_loop("W4Case_xvii_loop" , fs.getFunction(w2w2), fs.getFunction(w2)); f.addTerm(w4); } } } } } } } /* xviii. W2 and W2 supporting W1. W2 and W2 of equal height O O OO OO O O OO */ SingleFunction case_xviii_up = new SingleFunction("case_xviii_up"); SingleFunction case_xviii_down = new SingleFunction("case_xviii_down"); void case_xviii() { String[] listW2r = { "c", "d", "cd"}; String[] listW2l = { "a", "b", "ab"}; case_xviii(p2_hash_up, case_xviii_up, "cd", "ab", true, true, "c"); case_xviii(p2_hash_up, case_xviii_up, "cd", "ab", true, true, "d"); case_xviii(p2_hash_up, case_xviii_up, "ab", "cd", true, false, "a"); case_xviii(p2_hash_up, case_xviii_up, "ab", "cd", true, false, "b"); case_xviii(p2_hash_down, case_xviii_down, "cd", "ab", false, true, "c"); case_xviii(p2_hash_down, case_xviii_down, "cd", "ab", false, true, "d"); case_xviii(p2_hash_down, case_xviii_down, "ab", "cd", false, false, "a"); case_xviii(p2_hash_down, case_xviii_down, "ab", "cd", false, false, "b"); fs.add(case_xviii_up); fs.add(case_xviii_down); } void case_xviii( ArrayList h, SingleFunction accum, String must, String mustnot, boolean up, boolean w2SupportRight, String w1col) { String[] w2w2BaseList = {"acd", "ac", "ad", "abd", "bd"}; for (String w2w2Base : w2w2BaseList) { String name = "2p"; if (up) { name += "u-abcd-"; if (w2SupportRight) name += "w2-w2w1_" + w1col + "_" + w2w2Base; else name += "w2w1-w2_" + w1col + "_" + w2w2Base; } else { name += "d-abcd-"; if (w2SupportRight) name += "w2-w2w1_" + w2w2Base + "_" + w1col ; else name += "w2w1-w2_" + w2w2Base + "_" + w1col; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); Set> scanner = w2w2fs.getScanner(); for (Map.Entry w2w2Entry : scanner) { String w2w2 = w2w2Entry.getKey(); if (!w2w2.startsWith("2p")) continue; Destruct w2w2d = new Destruct(w2w2); if ((up && w2w2d.bottom.equals(w2w2Base)) || (!up && w2w2d.top.equals(w2w2Base) )) { String w1 = "w1"+w1col+"_"+w1col+"_"+w1col; Destruct d1 = new Destruct(w1); if ((up && overlaps(d1, w2w2d, must) && !overlaps(d1, w2w2d, mustnot)) || (!up && overlaps(w2w2d, d1, must) && !overlaps(w2w2d, d1, mustnot))) { W4Case_xviii_loop w4 = new W4Case_xviii_loop("W4Case_xviii_loop" , fs.getFunction(w2w2)); f.addTerm(w4); } } } } } /* xix. W1 supporting W2 and W2 OO O OO */ SingleFunction case_xix_up = new SingleFunction("case_xix_up"); SingleFunction case_xix_down = new SingleFunction("case_xix_down"); void case_xix() { case_xix(p2_hash_up, case_xix_up, "a", "c", "d", "a", "b", w2c_hash, w2a_hash, true, true); case_xix(p2_hash_up, case_xix_up, "d", "a", "b", "c", "d", w2a_hash, w2c_hash, true, false); case_xix(p2_hash_down, case_xix_down, "a", "c", "d", "a", "b", w2c_hash, w2a_hash, false, true); case_xix(p2_hash_down, case_xix_down, "d", "a", "b", "c", "d", w2a_hash, w2c_hash, false, false); fs.add(case_xix_up); fs.add(case_xix_down); } void case_xix(ArrayList h, SingleFunction accum, String baseW1, String baseW2_1, String baseW2_2, String baseOtherW2_1, String baseOtherW2_2, ArrayList specificW2, ArrayList specificOtherW2, boolean up, boolean w1SupportLeft) { String[] basesW2 = new String[3], extremetiesW2 = new String[3]; basesW2[0] = baseW2_1; basesW2[1] = baseW2_2 ; basesW2[2] = baseW2_1 + baseW2_2; extremetiesW2[0] = baseOtherW2_1; extremetiesW2[1] = baseOtherW2_2; extremetiesW2[2] = baseOtherW2_1 + baseOtherW2_2; Destruct d1 = new Destruct("w1_" + baseW1 + "_" + baseW1); for (String baseW2 : basesW2) for (String extremityW2 : extremetiesW2) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-abcd-"; if (w1SupportLeft) name += "w1w2-w2_" + extremityW2 + "_" + baseW1 + baseW2; else name += "w2-w1w2_" + extremityW2 + "_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-abcd-"; if (w1SupportLeft) name += "w1w2-w2_" + baseW1 + baseW2 + "_" + extremityW2 ; else name += "w2-w1w2_" + baseW2 + baseW1 + "_" + extremityW2; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specificW2) { Destruct d2 = new Destruct(w2fun); if ((up && d2.bottom.equals(baseW2)) || (!up && d2.top.equals(baseW2))) { for (String otherW2fun : specificOtherW2) { Destruct dOther2 = new Destruct(otherW2fun); if ((up && dOther2.top.equals(extremityW2) && overlaps(dOther2, d1) ) || (!up && dOther2.bottom.equals(extremityW2) && overlaps(d1, dOther2) )) { W4Case_vi_loop w4 = new W4Case_vi_loop("W4Case_xix_loop", fs.getFunction(w2fun), fs.getFunction(otherW2fun)); f.addTerm(w4); } } } } } } /* xx. W2 and W1+W3 _OO_ OO__ O_OO */ SingleFunction case_xx_up = new SingleFunction("case_xx_up"); SingleFunction case_xx_down = new SingleFunction("case_xx_down"); void case_xx() { case_xx(p2_hash_up, case_xx_up, "a", "c", "d", "a", "b", "c", w2c_hash, w3a_hash, true, true); case_xx(p2_hash_up, case_xx_up, "d", "a", "b", "b", "c", "d", w2a_hash, w3b_hash, true, false); case_xx(p2_hash_down, case_xx_down, "a", "c", "d", "a", "b", "c", w2c_hash, w3a_hash, false, true); case_xx(p2_hash_down, case_xx_down, "d", "a", "b", "b", "c", "d", w2a_hash, w3b_hash, false, false); fs.add(case_xx_up); fs.add(case_xx_down); } void case_xx(ArrayList h, SingleFunction accum, String baseW1, String baseW2_1, String baseW2_2, String baseW3_1, String baseW3_2, String baseW3_3, ArrayList specificW2, ArrayList specificW3, boolean up, boolean w1SupportLeft) { String[] basesW2 = new String[3], extremetiesW3 = new String[7]; basesW2[0] = baseW2_1; basesW2[1] = baseW2_2 ; basesW2[2] = baseW2_1 + baseW2_2; extremetiesW3[0] = baseW3_1; extremetiesW3[1] = baseW3_2; extremetiesW3[2] = baseW3_3 ; extremetiesW3[3] = baseW3_1 + baseW3_2; extremetiesW3[4] = baseW3_1 + baseW3_3; extremetiesW3[5] = baseW3_2 + baseW3_3 ; extremetiesW3[6] = baseW3_1 + baseW3_2 + baseW3_3 ; Destruct d1 = new Destruct("w1_" + baseW1 + "_" + baseW1); for (String baseW2 : basesW2) for (String extremityW3 : extremetiesW3) { String name = "2p"; if (up) { // going up so top ia a (or d) and bottom is a+mix(cd) or mix(ab) + d name += "u-abcd-"; if (w1SupportLeft) name += "w1w3-w2_" + extremityW3 + "_" + baseW1 + baseW2; else name += "w2-w1w3_" + extremityW3 + "_" + baseW2 + baseW1; } else { // going down so bottom ia a (or d) and top is a+mix(cd) or mix(ab) + d name += "d-abcd-"; if (w1SupportLeft) name += "w1w3-w2_" + baseW1 + baseW2 + "_" + extremityW3 ; else name += "w2-w1w3_" + baseW2 + baseW1 + "_" + extremityW3; } h.add(name); SingleFunction f = new SingleFunction(name); fs.add(f); accum.addTerm(f); for (String w2fun : specificW2) { Destruct d2 = new Destruct(w2fun); if ((up && d2.bottom.equals(baseW2)) || (!up && d2.top.equals(baseW2))) { for (String w3fun : specificW3) { Destruct d3 = new Destruct(w3fun); if ((up && d3.top.equals(extremityW3) && overlaps(d3, d1) && !overlaps(d3, d2)) || (!up && d3.bottom.equals(extremityW3) && overlaps(d1, d3) && !overlaps(d2, d3))) { W4Case_vi_loop w4 = new W4Case_vi_loop("W4Case_xx_loop", fs.getFunction(w2fun), fs.getFunction(w3fun)); f.addTerm(w4); } } } } } } private class Destruct { boolean origSlr, sud, srot, all, newSlr; String list = "abcd"; String top, bottom, type, complete, width; Destruct(String s) { origSlr = s.contains("_slr"); sud = s.contains("_sud"); srot = s.contains("_srot"); all = origSlr && sud; String t[] = s.split("_"); if (t.length < 3) { int qq = 1 / 0; } type = t[0]; top = t[1]; bottom = t[2]; complete = s; switch (type) { //case "w2": case "w4": case "row": newSlr = origSlr; } if (type.startsWith("2p")) newSlr = origSlr; if (type.startsWith("w2b")) newSlr = origSlr; switch (type) { case "w4" : width = "abcd"; break; case "w3a" : width = "abc"; break; case "w3b" : width = "bcd"; break; case "w2a" : width = "ab"; break; case "w2b" : width = "bc"; break; case "w2c" : width = "cd"; break; case "w1a" : width = "a"; break; case "w1b" : width = "b"; break; case "w1c" : width = "c"; break; case "w1d" : width = "d"; break; case "row" : width = calcRowWidth(top); break; } if (type.startsWith("2p")) { String[] bits = type.split("-"); width = bits[1]; if (!width.contains("bc")) { int qq = 1 / 0; } } } String recompose() { String ret = type + "_" + top + "_" + bottom; if (origSlr) ret += "_slr"; if (sud) ret += "_sud"; if (srot) ret += "_srot"; return ret; } boolean sameSymmetry(Destruct other) { return (newSlr == other.newSlr) && (sud == other.sud) && (srot == other.srot); } boolean sameOrigSymmetry(Destruct other) { return (origSlr == other.origSlr) && (sud == other.sud) && (srot == other.srot); } String calcRowWidth(String s) { String ret = ""; String first = s.substring(0, 1); String last = s.substring(s.length() - 1); for (String letter : listLetters) { if (letter.compareTo(first) >= 0 && letter.compareTo(last) <= 0) ret += letter; } return ret; } void applyDelta(int delta) { type += list.substring(delta, delta + 1); top = applyDelta(top, delta); bottom = applyDelta(bottom, delta); if (type.equals("w2b") && origSlr) newSlr = true; } String applyDelta(String in, int delta) { String ret = ""; for (int i = 0; i < in.length(); i++) { String s = in.substring(i, i + 1); int pos = list.indexOf(s) + delta; if (pos < 0 || pos >= 4) { int qq = 1 / 0; } ret += list.substring(pos , pos + 1); } if (ret.equals("ada")) { int qq = 1 / 0; } return ret; } } /* class Container { ArrayList odd, even; } */ void loadShouldBes() { ((GenericFunction)(fs.getFunction("w4_abcd_abcd_slr_sud_srot"))).shouldBe(4, 1); ((GenericFunction)(fs.getFunction("w4_cd_abc"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_d_abcd"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_a_abcd"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_abcd_d"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_abcd_c"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_abcd_b"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_abcd_a"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_ab_bcd"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_bcd_ab"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_b_abcd"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_abc_cd"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_c_abcd"))).shouldBe(5, 1); ((GenericFunction)(fs.getFunction("w4_bcd_abd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abd_bcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_bd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_bcd_abc_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_c_ab"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_bc_abcd_slr"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_bc_slr"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_c_abc"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_cd_c"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_cd_b"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_cd_a"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_a_abcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_b_b_sud"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_c_abcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_a_bcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_ab_abcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_d"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_a_d_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_cd_abcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_c"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_bd_abcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_b"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_a"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_ad_slr"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_c_b_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_ac"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_ab"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_c_cd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abc_acd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_a_a_sud"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_cd_abc"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abc_bcd_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_d_ab"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abc_cd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_ab_bcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_ab_d"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_ab_c"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_ab_b"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_d_c"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_d_b"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_a_cd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abc_d"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abc_c"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_b_ab"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_c_d"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_d_d_sud"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_ab_cd_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_bcd_b"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_c_a"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_bcd_a"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_b_abcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_abcd_cd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_d_abcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_ac_abcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_b_d"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_b_c_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_b_a"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_ad_abcd_slr"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_bcd_ab"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_d_abc"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_cd_ab_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_a_c"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_a_b"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_c_c_sud"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_d_a_srot"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_b_bcd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_b_cd"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_acd_abc"))).shouldBe(6, 1); ((GenericFunction)(fs.getFunction("w4_a_cd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_b_cd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_d_bcd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abcd_cd"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_c_cd"))).shouldBe(7, 3); ((GenericFunction)(fs.getFunction("w4_d_cd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bcd_d"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bcd_c"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bcd_ab"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_bcd_b"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_bcd_a"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_a_bd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_a_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_d_d"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_abc_abcd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_d_c"))).shouldBe(7, 3); ((GenericFunction)(fs.getFunction("w4_abcd_bcd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_d_b"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_d_a"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_b_bd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_acd_abcd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_a_abcd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_c_d"))).shouldBe(7, 3); ((GenericFunction)(fs.getFunction("w4_c_c"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_abcd_acd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_c_b"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_abcd_bc"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_c_bd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_c_a"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_c_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_c_bcd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_d_abd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_d"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_d_abc"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_b_c"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_d_bd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_b"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_d_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_a"))).shouldBe(7, 3); ((GenericFunction)(fs.getFunction("w4_c_acd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_a_d"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_abd_d"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_a_c"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_abd_c"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abcd_d"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_a_b"))).shouldBe(7, 3); ((GenericFunction)(fs.getFunction("w4_abd_b"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abcd_c"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_a_a"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_abcd_b"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_abcd_a"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_cd_cd_sud"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_acd_c"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abc_d"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_acd_b"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abc_c"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_abc_b"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_acd_a"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abc_a"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_a_ad"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abd_abcd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_a_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_a_ab"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_ad"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_abcd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_b_ab"))).shouldBe(7, 3); ((GenericFunction)(fs.getFunction("w4_abcd_abd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_c_ad"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abcd_abc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_c_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abcd_ab"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_c_ab"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_d_ad"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_d_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_bcd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_d_ab"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_c_abd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_c_abc"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_b_acd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ab_ab_sud"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ad_d"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ad_c"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ad_b"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ad_a"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_c_abcd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_bd_d"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bd_c"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ac_d"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bd_b"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ac_c"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ac_b"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bd_a"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bc_abcd"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_ac_a"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_cd_d"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bc_bcd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_cd_c"))).shouldBe(7, 3); ((GenericFunction)(fs.getFunction("w4_bc_d"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_cd_b"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_bc_c"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ab_d"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_ab_c"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_bc_b"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_cd_a"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_ab_b"))).shouldBe(7, 3); ((GenericFunction)(fs.getFunction("w4_bc_a"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_cd_abcd"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_ab_a"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ab_bcd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_a_bcd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_b_abd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bc_cd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_abc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_cd_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ab_abcd"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_a_acd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bcd_abcd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_d_abcd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_cd_abc"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_bcd_abc"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_bc_abc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ab_cd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_cd_ac"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abc_cd"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_cd_ab"))).shouldBe(7, 4); ((GenericFunction)(fs.getFunction("w4_ac_cd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_a_abc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abc_bcd"))).shouldBe(7, 2); ((GenericFunction)(fs.getFunction("w4_ab_bd"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bcd_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_ab_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_abc_bc"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bc_ab"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_bd_ab"))).shouldBe(7, 1); ((GenericFunction)(fs.getFunction("w4_b_c_srot"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_d_cd"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_abc_bcd_srot"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_bcd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_c_b_srot"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_bc_ad_slr"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bc_bcd"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_bcd_abc_srot"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_d_a_srot"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w4_bcd_d"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_cd_ab_srot"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w4_bcd_c"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_bcd_b"))).shouldBe(8, 12); ((GenericFunction)(fs.getFunction("w4_ab_bcd"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_bcd_a"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_ad_abc"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_d_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ad_ad_slr_sud_srot"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_d_bc"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_c_acd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_abcd_abcd_slr_sud_srot"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_d_abcd"))).shouldBe(8, 9); ((GenericFunction)(fs.getFunction("w4_abd_d"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_abd_c"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_abd_b"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_abd_a"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ad_d"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ad_c"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ad_b"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ad_a"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_d"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_ab_c"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_ab_b"))).shouldBe(8, 12); ((GenericFunction)(fs.getFunction("w4_a_bcd"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_ab_a"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_d_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_d_ac"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_d_ab"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_c_abd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_c_abc"))).shouldBe(8, 12); ((GenericFunction)(fs.getFunction("w4_cd_cd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_bd_ac_srot"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abcd_d"))).shouldBe(8, 9); ((GenericFunction)(fs.getFunction("w4_abcd_c"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_abcd_b"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_c_d"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_c_c"))).shouldBe(8, 18); ((GenericFunction)(fs.getFunction("w4_abcd_a"))).shouldBe(8, 9); ((GenericFunction)(fs.getFunction("w4_c_b"))).shouldBe(8, 16); ((GenericFunction)(fs.getFunction("w4_c_a"))).shouldBe(8, 20); ((GenericFunction)(fs.getFunction("w4_abc_abc_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_b_b_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_a_d"))).shouldBe(8, 16); ((GenericFunction)(fs.getFunction("w4_a_c"))).shouldBe(8, 20); ((GenericFunction)(fs.getFunction("w4_a_b"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_a_a"))).shouldBe(8, 10); ((GenericFunction)(fs.getFunction("w4_bc_cd"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_ab_ab_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ac_ac_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ac_acd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_bc"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_d_bcd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_bc_abcd_slr"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_acd_d"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_acd_c"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_ab_cd"))).shouldBe(8, 10); ((GenericFunction)(fs.getFunction("w4_acd_b"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_a_abcd"))).shouldBe(8, 9); ((GenericFunction)(fs.getFunction("w4_acd_a"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_bd_abd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bd_abc"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bd_d"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bd_c"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bc_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bd_b"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_a_cd"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_bd_a"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_ac_abc"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_ac"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_cd_ab"))).shouldBe(8, 10); ((GenericFunction)(fs.getFunction("w4_acd_cd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_b_acd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_bcd_abcd"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w4_ad_abcd_slr"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_bd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_ab_bc"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_bcd_abd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bcd_abc"))).shouldBe(8, 6); ((GenericFunction)(fs.getFunction("w4_bc_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_a_bd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_abc_acd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bc_ab"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_a_bc"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_abc_cd"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_b_abd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_acd_bc"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_b_abc"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_cd_cd_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bd_cd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_abcd"))).shouldBe(8, 7); ((GenericFunction)(fs.getFunction("w4_ad_bcd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_acd_abc"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_ab"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_abcd_bc_slr"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_a_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ad_bc_slr"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_acd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_a_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_a_ab"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_abc_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abc_bc"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_abcd_cd"))).shouldBe(8, 7); ((GenericFunction)(fs.getFunction("w4_bc_acd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_acd_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_acd_ab"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ac_cd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_ab_acd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_d"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_cd_c"))).shouldBe(8, 12); ((GenericFunction)(fs.getFunction("w4_bd_bc"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_b"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_b_cd"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_cd_a"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_abcd_abc"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w4_b_abcd"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_c_bcd"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_cd_abd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_abc"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_a_a_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abc_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abc_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abc_ab"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_abcd_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bc_abd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abc_d"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_abcd_bc"))).shouldBe(8, 6); ((GenericFunction)(fs.getFunction("w4_d_d_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bc_abc"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_abc_c"))).shouldBe(8, 12); ((GenericFunction)(fs.getFunction("w4_abc_b"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_abc_a"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_ac_bc"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ac_d"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_ac_c"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_bcd_cd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_ac_b"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abd_bcd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_abd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_cd_srot"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w4_bd_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ab_abc"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_ac_a"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_b_bd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_b_bc"))).shouldBe(8, 6); ((GenericFunction)(fs.getFunction("w4_bd_ab"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_abd_cd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_a_acd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_bcd_bcd_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bc_abcd"))).shouldBe(8, 6); ((GenericFunction)(fs.getFunction("w4_abcd_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abcd_ab"))).shouldBe(8, 7); ((GenericFunction)(fs.getFunction("w4_ac_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ac_ab"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bcd_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_d_d"))).shouldBe(8, 10); ((GenericFunction)(fs.getFunction("w4_bcd_bc"))).shouldBe(8, 4); ((GenericFunction)(fs.getFunction("w4_d_c"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_d_b"))).shouldBe(8, 20); ((GenericFunction)(fs.getFunction("w4_b_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_d_a"))).shouldBe(8, 16); ((GenericFunction)(fs.getFunction("w4_b_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_b_ab"))).shouldBe(8, 12); ((GenericFunction)(fs.getFunction("w4_b_d"))).shouldBe(8, 20); ((GenericFunction)(fs.getFunction("w4_b_c"))).shouldBe(8, 16); ((GenericFunction)(fs.getFunction("w4_b_b"))).shouldBe(8, 18); ((GenericFunction)(fs.getFunction("w4_abd_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_a_abd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ac_abcd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bd_bcd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abd_bc"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_a_abc"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_b_a"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_ad_cd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ac_bcd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_c_cd"))).shouldBe(8, 12); ((GenericFunction)(fs.getFunction("w4_bcd_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bcd_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bcd_ab"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_d_acd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bc_bc_slr_sud_srot"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abc_abcd"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w4_abd_ab"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ad_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_c_abcd"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_bc_d"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_bc_c"))).shouldBe(8, 6); ((GenericFunction)(fs.getFunction("w4_bc_b"))).shouldBe(8, 6); ((GenericFunction)(fs.getFunction("w4_bc_a"))).shouldBe(8, 5); ((GenericFunction)(fs.getFunction("w4_c_bd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_c_bc"))).shouldBe(8, 6); ((GenericFunction)(fs.getFunction("w4_b_bcd"))).shouldBe(8, 12); ((GenericFunction)(fs.getFunction("w4_a_d_srot"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w4_bd_bd_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_d_abd"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_d_abc"))).shouldBe(8, 11); ((GenericFunction)(fs.getFunction("w4_abc_bcd"))).shouldBe(8, 6); ((GenericFunction)(fs.getFunction("w4_ad_ac"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_bd_abcd"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ad_ab"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_cd_abcd"))).shouldBe(8, 7); ((GenericFunction)(fs.getFunction("w4_c_ad"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_c_ac"))).shouldBe(8, 2); ((GenericFunction)(fs.getFunction("w4_c_ab"))).shouldBe(8, 15); ((GenericFunction)(fs.getFunction("w4_abcd_ad_slr"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_ac_bd_srot"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_c_c_sud"))).shouldBe(8, 1); ((GenericFunction)(fs.getFunction("w4_abcd_bcd"))).shouldBe(8, 3); ((GenericFunction)(fs.getFunction("w4_ad_acd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_d_cd"))).shouldBe(9, 20); ((GenericFunction)(fs.getFunction("w4_ad_abcd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_cd_bcd"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_bc_bcd"))).shouldBe(9, 13); ((GenericFunction)(fs.getFunction("w4_bcd_d"))).shouldBe(9, 11); ((GenericFunction)(fs.getFunction("w4_bcd_c"))).shouldBe(9, 23); ((GenericFunction)(fs.getFunction("w4_bcd_b"))).shouldBe(9, 40); ((GenericFunction)(fs.getFunction("w4_ab_bcd"))).shouldBe(9, 31); ((GenericFunction)(fs.getFunction("w4_bcd_a"))).shouldBe(9, 35); ((GenericFunction)(fs.getFunction("w4_ad_abd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_ad_abc"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_d_bd"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_d_bc"))).shouldBe(9, 25); ((GenericFunction)(fs.getFunction("w4_abd_abcd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_c_acd"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_acd_abcd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_d_abcd"))).shouldBe(9, 22); ((GenericFunction)(fs.getFunction("w4_abd_d"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w4_abd_c"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w4_abd_b"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_abd_a"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ad_d"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_ad_c"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_ad_b"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_ad_a"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_ab_d"))).shouldBe(9, 51); ((GenericFunction)(fs.getFunction("w4_ab_c"))).shouldBe(9, 55); ((GenericFunction)(fs.getFunction("w4_ab_b"))).shouldBe(9, 43); ((GenericFunction)(fs.getFunction("w4_a_bcd"))).shouldBe(9, 35); ((GenericFunction)(fs.getFunction("w4_ab_a"))).shouldBe(9, 20); ((GenericFunction)(fs.getFunction("w4_d_ad"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_d_ac"))).shouldBe(9, 9); ((GenericFunction)(fs.getFunction("w4_d_ab"))).shouldBe(9, 51); ((GenericFunction)(fs.getFunction("w4_c_abd"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w4_c_abc"))).shouldBe(9, 40); ((GenericFunction)(fs.getFunction("w4_cd_cd"))).shouldBe(9, 12); ((GenericFunction)(fs.getFunction("w4_abcd_d"))).shouldBe(9, 22); ((GenericFunction)(fs.getFunction("w4_abcd_c"))).shouldBe(9, 33); ((GenericFunction)(fs.getFunction("w4_abcd_b"))).shouldBe(9, 33); ((GenericFunction)(fs.getFunction("w4_c_d"))).shouldBe(9, 49); ((GenericFunction)(fs.getFunction("w4_c_c"))).shouldBe(9, 68); ((GenericFunction)(fs.getFunction("w4_abcd_a"))).shouldBe(9, 22); ((GenericFunction)(fs.getFunction("w4_c_b"))).shouldBe(9, 72); ((GenericFunction)(fs.getFunction("w4_abd_abc"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_c_a"))).shouldBe(9, 65); ((GenericFunction)(fs.getFunction("w4_abc_abc_sud"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_b_b_sud"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_a_d"))).shouldBe(9, 60); ((GenericFunction)(fs.getFunction("w4_a_c"))).shouldBe(9, 65); ((GenericFunction)(fs.getFunction("w4_a_b"))).shouldBe(9, 49); ((GenericFunction)(fs.getFunction("w4_bd_acd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_a_a"))).shouldBe(9, 30); ((GenericFunction)(fs.getFunction("w4_bc_cd"))).shouldBe(9, 20); ((GenericFunction)(fs.getFunction("w4_ab_ab_sud"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_ac_acd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_cd_bd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_cd_bc"))).shouldBe(9, 20); ((GenericFunction)(fs.getFunction("w4_abd_abd_sud"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_d_bcd"))).shouldBe(9, 11); ((GenericFunction)(fs.getFunction("w4_acd_d"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_acd_c"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_ab_cd"))).shouldBe(9, 42); ((GenericFunction)(fs.getFunction("w4_acd_b"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w4_a_abcd"))).shouldBe(9, 22); ((GenericFunction)(fs.getFunction("w4_acd_a"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w4_bcd_acd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_bd_abd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_bd_abc"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_bd_d"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_bc_bd"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_bd_c"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_bc_bc"))).shouldBe(9, 8); ((GenericFunction)(fs.getFunction("w4_bd_b"))).shouldBe(9, 10); ((GenericFunction)(fs.getFunction("w4_a_cd"))).shouldBe(9, 51); ((GenericFunction)(fs.getFunction("w4_bd_a"))).shouldBe(9, 9); ((GenericFunction)(fs.getFunction("w4_ac_abd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_cd_ad"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ac_abc"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_cd_ac"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_cd_ab"))).shouldBe(9, 42); ((GenericFunction)(fs.getFunction("w4_acd_cd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_b_acd"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w4_bcd_abcd"))).shouldBe(9, 9); ((GenericFunction)(fs.getFunction("w4_ab_bd"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_ab_bc"))).shouldBe(9, 20); ((GenericFunction)(fs.getFunction("w4_bcd_abd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_bcd_abc"))).shouldBe(9, 18); ((GenericFunction)(fs.getFunction("w4_bc_ad"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_bc_ac"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_a_bd"))).shouldBe(9, 9); ((GenericFunction)(fs.getFunction("w4_bc_ab"))).shouldBe(9, 20); ((GenericFunction)(fs.getFunction("w4_abc_acd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_a_bc"))).shouldBe(9, 25); ((GenericFunction)(fs.getFunction("w4_abc_cd"))).shouldBe(9, 31); ((GenericFunction)(fs.getFunction("w4_b_abd"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_acd_bd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_b_abc"))).shouldBe(9, 23); ((GenericFunction)(fs.getFunction("w4_acd_bc"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_cd_cd_sud"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_bd_cd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ab_abcd"))).shouldBe(9, 16); ((GenericFunction)(fs.getFunction("w4_ad_bcd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_ab_ad"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_acd_abc"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abcd_acd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ab_ac"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ab_ab"))).shouldBe(9, 12); ((GenericFunction)(fs.getFunction("w4_a_ad"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_cd_acd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_a_ac"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_abc_abd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abc_abc"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_a_ab"))).shouldBe(9, 20); ((GenericFunction)(fs.getFunction("w4_abc_bd"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_abc_bc"))).shouldBe(9, 13); ((GenericFunction)(fs.getFunction("w4_abcd_cd"))).shouldBe(9, 16); ((GenericFunction)(fs.getFunction("w4_bc_acd"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_acd_ad"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_acd_ac"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_ac_cd"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_acd_ab"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_ab_acd"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_cd_d"))).shouldBe(9, 20); ((GenericFunction)(fs.getFunction("w4_cd_c"))).shouldBe(9, 43); ((GenericFunction)(fs.getFunction("w4_bd_bc"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_cd_b"))).shouldBe(9, 55); ((GenericFunction)(fs.getFunction("w4_b_cd"))).shouldBe(9, 55); ((GenericFunction)(fs.getFunction("w4_cd_a"))).shouldBe(9, 51); ((GenericFunction)(fs.getFunction("w4_abcd_abd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abcd_abc"))).shouldBe(9, 9); ((GenericFunction)(fs.getFunction("w4_c_bcd"))).shouldBe(9, 23); ((GenericFunction)(fs.getFunction("w4_b_abcd"))).shouldBe(9, 33); ((GenericFunction)(fs.getFunction("w4_cd_abd"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_cd_abc"))).shouldBe(9, 31); ((GenericFunction)(fs.getFunction("w4_a_a_sud"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_abc_ad"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_abc_ac"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_abc_ab"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_abcd_bd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_bc_abd"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_abc_d"))).shouldBe(9, 35); ((GenericFunction)(fs.getFunction("w4_abcd_bc"))).shouldBe(9, 18); ((GenericFunction)(fs.getFunction("w4_d_d_sud"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_bc_abc"))).shouldBe(9, 13); ((GenericFunction)(fs.getFunction("w4_abc_c"))).shouldBe(9, 40); ((GenericFunction)(fs.getFunction("w4_abc_b"))).shouldBe(9, 23); ((GenericFunction)(fs.getFunction("w4_abc_a"))).shouldBe(9, 11); ((GenericFunction)(fs.getFunction("w4_ac_bc"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_ac_d"))).shouldBe(9, 9); ((GenericFunction)(fs.getFunction("w4_ac_c"))).shouldBe(9, 10); ((GenericFunction)(fs.getFunction("w4_bcd_cd"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_ac_b"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_ab_abd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abd_bcd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ab_abc"))).shouldBe(9, 6); ((GenericFunction)(fs.getFunction("w4_ac_a"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_acd_acd_sud"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_b_bd"))).shouldBe(9, 10); ((GenericFunction)(fs.getFunction("w4_bd_ab"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_b_bc"))).shouldBe(9, 29); ((GenericFunction)(fs.getFunction("w4_abd_cd"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_a_acd"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w4_bcd_bcd_sud"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_bc_abcd"))).shouldBe(9, 18); ((GenericFunction)(fs.getFunction("w4_abcd_ad"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abcd_ac"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abcd_ab"))).shouldBe(9, 16); ((GenericFunction)(fs.getFunction("w4_ac_ab"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_bcd_bd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_d_d"))).shouldBe(9, 30); ((GenericFunction)(fs.getFunction("w4_bcd_bc"))).shouldBe(9, 13); ((GenericFunction)(fs.getFunction("w4_d_c"))).shouldBe(9, 49); ((GenericFunction)(fs.getFunction("w4_d_b"))).shouldBe(9, 65); ((GenericFunction)(fs.getFunction("w4_b_ad"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_d_a"))).shouldBe(9, 60); ((GenericFunction)(fs.getFunction("w4_b_ac"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_b_ab"))).shouldBe(9, 43); ((GenericFunction)(fs.getFunction("w4_b_d"))).shouldBe(9, 65); ((GenericFunction)(fs.getFunction("w4_b_c"))).shouldBe(9, 72); ((GenericFunction)(fs.getFunction("w4_b_b"))).shouldBe(9, 68); ((GenericFunction)(fs.getFunction("w4_abd_bd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_a_abd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ac_abcd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abd_bc"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_a_abc"))).shouldBe(9, 11); ((GenericFunction)(fs.getFunction("w4_bd_bcd"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_b_a"))).shouldBe(9, 49); ((GenericFunction)(fs.getFunction("w4_abcd_abcd_sud"))).shouldBe(9, 4); ((GenericFunction)(fs.getFunction("w4_ad_cd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ac_bcd"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_c_cd"))).shouldBe(9, 43); ((GenericFunction)(fs.getFunction("w4_bcd_ad"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_bcd_ac"))).shouldBe(9, 3); ((GenericFunction)(fs.getFunction("w4_bcd_ab"))).shouldBe(9, 31); ((GenericFunction)(fs.getFunction("w4_d_acd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abd_ad"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_bcd_bcd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_abd_ac"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_abc_abcd"))).shouldBe(9, 9); ((GenericFunction)(fs.getFunction("w4_abd_ab"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ad_bc"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_c_abcd"))).shouldBe(9, 33); ((GenericFunction)(fs.getFunction("w4_bc_d"))).shouldBe(9, 25); ((GenericFunction)(fs.getFunction("w4_bc_c"))).shouldBe(9, 29); ((GenericFunction)(fs.getFunction("w4_bc_b"))).shouldBe(9, 29); ((GenericFunction)(fs.getFunction("w4_bc_a"))).shouldBe(9, 25); ((GenericFunction)(fs.getFunction("w4_c_bd"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_c_bc"))).shouldBe(9, 29); ((GenericFunction)(fs.getFunction("w4_b_bcd"))).shouldBe(9, 40); ((GenericFunction)(fs.getFunction("w4_d_abd"))).shouldBe(9, 5); ((GenericFunction)(fs.getFunction("w4_acd_bcd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_d_abc"))).shouldBe(9, 35); ((GenericFunction)(fs.getFunction("w4_abc_bcd"))).shouldBe(9, 18); ((GenericFunction)(fs.getFunction("w4_bd_abcd"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_ad_ab"))).shouldBe(9, 2); ((GenericFunction)(fs.getFunction("w4_cd_abcd"))).shouldBe(9, 16); ((GenericFunction)(fs.getFunction("w4_c_ad"))).shouldBe(9, 7); ((GenericFunction)(fs.getFunction("w4_c_ac"))).shouldBe(9, 10); ((GenericFunction)(fs.getFunction("w4_c_ab"))).shouldBe(9, 55); ((GenericFunction)(fs.getFunction("w4_c_c_sud"))).shouldBe(9, 1); ((GenericFunction)(fs.getFunction("w4_abcd_bcd"))).shouldBe(9, 9); ((GenericFunction)(fs.getFunction("w4_b_c_srot"))).shouldBe(10, 12); ((GenericFunction)(fs.getFunction("w4_d_cd"))).shouldBe(10, 64); ((GenericFunction)(fs.getFunction("w4_cd_bcd"))).shouldBe(10, 28); ((GenericFunction)(fs.getFunction("w4_abc_bcd_srot"))).shouldBe(10, 4); ((GenericFunction)(fs.getFunction("w4_c_b_srot"))).shouldBe(10, 12); ((GenericFunction)(fs.getFunction("w4_bc_ad_slr"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_bc_bcd"))).shouldBe(10, 48); ((GenericFunction)(fs.getFunction("w4_bcd_abc_srot"))).shouldBe(10, 4); ((GenericFunction)(fs.getFunction("w4_d_a_srot"))).shouldBe(10, 10); ((GenericFunction)(fs.getFunction("w4_bcd_d"))).shouldBe(10, 36); ((GenericFunction)(fs.getFunction("w4_cd_ab_srot"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_bcd_c"))).shouldBe(10, 78); ((GenericFunction)(fs.getFunction("w4_bcd_b"))).shouldBe(10, 118); ((GenericFunction)(fs.getFunction("w4_ab_bcd"))).shouldBe(10, 86); ((GenericFunction)(fs.getFunction("w4_bcd_a"))).shouldBe(10, 101); ((GenericFunction)(fs.getFunction("w4_ad_abc"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_d_bd"))).shouldBe(10, 14); ((GenericFunction)(fs.getFunction("w4_d_bc"))).shouldBe(10, 87); ((GenericFunction)(fs.getFunction("w4_abd_abcd"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_c_acd"))).shouldBe(10, 19); ((GenericFunction)(fs.getFunction("w4_acd_abcd"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_abcd_abcd_slr_sud_srot"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_d_abcd"))).shouldBe(10, 59); ((GenericFunction)(fs.getFunction("w4_abd_d"))).shouldBe(10, 15); ((GenericFunction)(fs.getFunction("w4_abd_c"))).shouldBe(10, 18); ((GenericFunction)(fs.getFunction("w4_abd_b"))).shouldBe(10, 19); ((GenericFunction)(fs.getFunction("w4_abd_a"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_ad_d"))).shouldBe(10, 13); ((GenericFunction)(fs.getFunction("w4_ad_c"))).shouldBe(10, 16); ((GenericFunction)(fs.getFunction("w4_ad_b"))).shouldBe(10, 16); ((GenericFunction)(fs.getFunction("w4_ad_a"))).shouldBe(10, 13); ((GenericFunction)(fs.getFunction("w4_ab_d"))).shouldBe(10, 154); ((GenericFunction)(fs.getFunction("w4_ab_c"))).shouldBe(10, 175); ((GenericFunction)(fs.getFunction("w4_ab_b"))).shouldBe(10, 138); ((GenericFunction)(fs.getFunction("w4_a_bcd"))).shouldBe(10, 101); ((GenericFunction)(fs.getFunction("w4_ab_a"))).shouldBe(10, 64); ((GenericFunction)(fs.getFunction("w4_d_ad"))).shouldBe(10, 13); ((GenericFunction)(fs.getFunction("w4_d_ac"))).shouldBe(10, 23); ((GenericFunction)(fs.getFunction("w4_d_ab"))).shouldBe(10, 154); ((GenericFunction)(fs.getFunction("w4_c_abd"))).shouldBe(10, 18); ((GenericFunction)(fs.getFunction("w4_c_abc"))).shouldBe(10, 118); ((GenericFunction)(fs.getFunction("w4_cd_cd"))).shouldBe(10, 46); ((GenericFunction)(fs.getFunction("w4_bd_ac_srot"))).shouldBe(10, 1); ((GenericFunction)(fs.getFunction("w4_abcd_d"))).shouldBe(10, 59); ((GenericFunction)(fs.getFunction("w4_abcd_c"))).shouldBe(10, 93); ((GenericFunction)(fs.getFunction("w4_abcd_b"))).shouldBe(10, 93); ((GenericFunction)(fs.getFunction("w4_c_d"))).shouldBe(10, 173); ((GenericFunction)(fs.getFunction("w4_c_c"))).shouldBe(10, 246); ((GenericFunction)(fs.getFunction("w4_abcd_a"))).shouldBe(10, 59); ((GenericFunction)(fs.getFunction("w4_c_b"))).shouldBe(10, 252); ((GenericFunction)(fs.getFunction("w4_abd_abc"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_c_a"))).shouldBe(10, 221); ((GenericFunction)(fs.getFunction("w4_abc_abc_sud"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_b_b_sud"))).shouldBe(10, 7); ((GenericFunction)(fs.getFunction("w4_a_d"))).shouldBe(10, 180); ((GenericFunction)(fs.getFunction("w4_a_c"))).shouldBe(10, 221); ((GenericFunction)(fs.getFunction("w4_a_b"))).shouldBe(10, 173); ((GenericFunction)(fs.getFunction("w4_a_a"))).shouldBe(10, 98); ((GenericFunction)(fs.getFunction("w4_bc_cd"))).shouldBe(10, 73); ((GenericFunction)(fs.getFunction("w4_ab_ab_sud"))).shouldBe(10, 4); ((GenericFunction)(fs.getFunction("w4_ac_acd"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_cd_bd"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_cd_bc"))).shouldBe(10, 73); ((GenericFunction)(fs.getFunction("w4_abd_abd_sud"))).shouldBe(10, 1); ((GenericFunction)(fs.getFunction("w4_d_bcd"))).shouldBe(10, 36); ((GenericFunction)(fs.getFunction("w4_bc_abcd_slr"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_acd_d"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_acd_c"))).shouldBe(10, 19); ((GenericFunction)(fs.getFunction("w4_ab_cd"))).shouldBe(10, 120); ((GenericFunction)(fs.getFunction("w4_acd_b"))).shouldBe(10, 18); ((GenericFunction)(fs.getFunction("w4_a_abcd"))).shouldBe(10, 59); ((GenericFunction)(fs.getFunction("w4_acd_a"))).shouldBe(10, 15); ((GenericFunction)(fs.getFunction("w4_bd_abd"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_bcd_acd"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_bd_abc"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_bd_d"))).shouldBe(10, 14); ((GenericFunction)(fs.getFunction("w4_bc_bd"))).shouldBe(10, 13); ((GenericFunction)(fs.getFunction("w4_bd_c"))).shouldBe(10, 19); ((GenericFunction)(fs.getFunction("w4_bc_bc"))).shouldBe(10, 32); ((GenericFunction)(fs.getFunction("w4_bd_b"))).shouldBe(10, 27); ((GenericFunction)(fs.getFunction("w4_a_cd"))).shouldBe(10, 154); ((GenericFunction)(fs.getFunction("w4_bd_a"))).shouldBe(10, 23); ((GenericFunction)(fs.getFunction("w4_ac_abc"))).shouldBe(10, 6); ((GenericFunction)(fs.getFunction("w4_cd_ad"))).shouldBe(10, 10); ((GenericFunction)(fs.getFunction("w4_cd_ac"))).shouldBe(10, 21); ((GenericFunction)(fs.getFunction("w4_cd_ab"))).shouldBe(10, 120); ((GenericFunction)(fs.getFunction("w4_acd_cd"))).shouldBe(10, 7); ((GenericFunction)(fs.getFunction("w4_b_acd"))).shouldBe(10, 18); ((GenericFunction)(fs.getFunction("w4_bcd_abcd"))).shouldBe(10, 24); ((GenericFunction)(fs.getFunction("w4_ad_abcd_slr"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_ab_bd"))).shouldBe(10, 21); ((GenericFunction)(fs.getFunction("w4_ab_bc"))).shouldBe(10, 73); ((GenericFunction)(fs.getFunction("w4_bcd_abd"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_bcd_abc"))).shouldBe(10, 48); ((GenericFunction)(fs.getFunction("w4_bc_ad"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_bc_ac"))).shouldBe(10, 13); ((GenericFunction)(fs.getFunction("w4_a_bd"))).shouldBe(10, 23); ((GenericFunction)(fs.getFunction("w4_bc_ab"))).shouldBe(10, 73); ((GenericFunction)(fs.getFunction("w4_abc_acd"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_a_bc"))).shouldBe(10, 87); ((GenericFunction)(fs.getFunction("w4_abc_cd"))).shouldBe(10, 86); ((GenericFunction)(fs.getFunction("w4_b_abd"))).shouldBe(10, 19); ((GenericFunction)(fs.getFunction("w4_acd_bc"))).shouldBe(10, 9); ((GenericFunction)(fs.getFunction("w4_b_abc"))).shouldBe(10, 78); ((GenericFunction)(fs.getFunction("w4_cd_cd_sud"))).shouldBe(10, 4); ((GenericFunction)(fs.getFunction("w4_bd_cd"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_ab_abcd"))).shouldBe(10, 44); ((GenericFunction)(fs.getFunction("w4_ad_bcd"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_acd_abc"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_ab_ad"))).shouldBe(10, 10); ((GenericFunction)(fs.getFunction("w4_abcd_acd"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_ab_ac"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_ab_ab"))).shouldBe(10, 46); ((GenericFunction)(fs.getFunction("w4_abcd_bc_slr"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_a_ad"))).shouldBe(10, 13); ((GenericFunction)(fs.getFunction("w4_ad_bc_slr"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_cd_acd"))).shouldBe(10, 7); ((GenericFunction)(fs.getFunction("w4_a_ac"))).shouldBe(10, 14); ((GenericFunction)(fs.getFunction("w4_abc_abd"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_abc_abc"))).shouldBe(10, 14); ((GenericFunction)(fs.getFunction("w4_a_ab"))).shouldBe(10, 64); ((GenericFunction)(fs.getFunction("w4_abc_bd"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_abc_bc"))).shouldBe(10, 48); ((GenericFunction)(fs.getFunction("w4_abcd_cd"))).shouldBe(10, 44); ((GenericFunction)(fs.getFunction("w4_bc_acd"))).shouldBe(10, 9); ((GenericFunction)(fs.getFunction("w4_acd_ac"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_acd_ab"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_ac_cd"))).shouldBe(10, 21); ((GenericFunction)(fs.getFunction("w4_ab_acd"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_cd_d"))).shouldBe(10, 64); ((GenericFunction)(fs.getFunction("w4_bd_bd"))).shouldBe(10, 4); ((GenericFunction)(fs.getFunction("w4_cd_c"))).shouldBe(10, 138); ((GenericFunction)(fs.getFunction("w4_bd_bc"))).shouldBe(10, 13); ((GenericFunction)(fs.getFunction("w4_b_cd"))).shouldBe(10, 175); ((GenericFunction)(fs.getFunction("w4_cd_b"))).shouldBe(10, 175); ((GenericFunction)(fs.getFunction("w4_bc_bc_slr"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_cd_a"))).shouldBe(10, 154); ((GenericFunction)(fs.getFunction("w4_abcd_abd"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_abcd_abc"))).shouldBe(10, 24); ((GenericFunction)(fs.getFunction("w4_b_abcd"))).shouldBe(10, 93); ((GenericFunction)(fs.getFunction("w4_c_bcd"))).shouldBe(10, 78); ((GenericFunction)(fs.getFunction("w4_cd_abd"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_cd_abc"))).shouldBe(10, 86); ((GenericFunction)(fs.getFunction("w4_a_a_sud"))).shouldBe(10, 6); ((GenericFunction)(fs.getFunction("w4_abc_ad"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_abc_ac"))).shouldBe(10, 6); ((GenericFunction)(fs.getFunction("w4_abc_ab"))).shouldBe(10, 28); ((GenericFunction)(fs.getFunction("w4_abcd_bd"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_bc_abd"))).shouldBe(10, 9); ((GenericFunction)(fs.getFunction("w4_abcd_bc"))).shouldBe(10, 50); ((GenericFunction)(fs.getFunction("w4_abc_d"))).shouldBe(10, 101); ((GenericFunction)(fs.getFunction("w4_d_d_sud"))).shouldBe(10, 6); ((GenericFunction)(fs.getFunction("w4_bc_abc"))).shouldBe(10, 48); ((GenericFunction)(fs.getFunction("w4_abc_c"))).shouldBe(10, 118); ((GenericFunction)(fs.getFunction("w4_abc_b"))).shouldBe(10, 78); ((GenericFunction)(fs.getFunction("w4_abc_a"))).shouldBe(10, 36); ((GenericFunction)(fs.getFunction("w4_ac_bd"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_ac_bc"))).shouldBe(10, 13); ((GenericFunction)(fs.getFunction("w4_ac_d"))).shouldBe(10, 23); ((GenericFunction)(fs.getFunction("w4_ac_c"))).shouldBe(10, 27); ((GenericFunction)(fs.getFunction("w4_bcd_cd"))).shouldBe(10, 28); ((GenericFunction)(fs.getFunction("w4_ab_cd_srot"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_ac_b"))).shouldBe(10, 19); ((GenericFunction)(fs.getFunction("w4_ab_abd"))).shouldBe(10, 7); ((GenericFunction)(fs.getFunction("w4_abd_bcd"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_bd_ad"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_ab_abc"))).shouldBe(10, 28); ((GenericFunction)(fs.getFunction("w4_ac_a"))).shouldBe(10, 14); ((GenericFunction)(fs.getFunction("w4_bd_ac"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_acd_acd_sud"))).shouldBe(10, 1); ((GenericFunction)(fs.getFunction("w4_b_bd"))).shouldBe(10, 27); ((GenericFunction)(fs.getFunction("w4_b_bc"))).shouldBe(10, 107); ((GenericFunction)(fs.getFunction("w4_bd_ab"))).shouldBe(10, 21); ((GenericFunction)(fs.getFunction("w4_abd_cd"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_a_acd"))).shouldBe(10, 15); ((GenericFunction)(fs.getFunction("w4_bcd_bcd_sud"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_bc_abcd"))).shouldBe(10, 50); ((GenericFunction)(fs.getFunction("w4_abcd_ac"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_abcd_ab"))).shouldBe(10, 44); ((GenericFunction)(fs.getFunction("w4_ac_ad"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_ac_ac"))).shouldBe(10, 4); ((GenericFunction)(fs.getFunction("w4_ac_ab"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_bcd_bd"))).shouldBe(10, 6); ((GenericFunction)(fs.getFunction("w4_d_d"))).shouldBe(10, 98); ((GenericFunction)(fs.getFunction("w4_bcd_bc"))).shouldBe(10, 48); ((GenericFunction)(fs.getFunction("w4_d_c"))).shouldBe(10, 173); ((GenericFunction)(fs.getFunction("w4_abd_acd_srot"))).shouldBe(10, 1); ((GenericFunction)(fs.getFunction("w4_d_b"))).shouldBe(10, 221); ((GenericFunction)(fs.getFunction("w4_b_ad"))).shouldBe(10, 16); ((GenericFunction)(fs.getFunction("w4_d_a"))).shouldBe(10, 180); ((GenericFunction)(fs.getFunction("w4_b_ac"))).shouldBe(10, 19); ((GenericFunction)(fs.getFunction("w4_b_ab"))).shouldBe(10, 138); ((GenericFunction)(fs.getFunction("w4_b_d"))).shouldBe(10, 221); ((GenericFunction)(fs.getFunction("w4_b_c"))).shouldBe(10, 252); ((GenericFunction)(fs.getFunction("w4_abd_bd"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_b_b"))).shouldBe(10, 246); ((GenericFunction)(fs.getFunction("w4_a_abd"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_ac_abcd"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_bd_bcd"))).shouldBe(10, 6); ((GenericFunction)(fs.getFunction("w4_abd_bc"))).shouldBe(10, 9); ((GenericFunction)(fs.getFunction("w4_a_abc"))).shouldBe(10, 36); ((GenericFunction)(fs.getFunction("w4_b_a"))).shouldBe(10, 173); ((GenericFunction)(fs.getFunction("w4_abcd_abcd_sud"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_ad_cd"))).shouldBe(10, 10); ((GenericFunction)(fs.getFunction("w4_ac_bcd"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_c_cd"))).shouldBe(10, 138); ((GenericFunction)(fs.getFunction("w4_bc_bc_srot"))).shouldBe(10, 6); ((GenericFunction)(fs.getFunction("w4_bcd_ad"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_bcd_ac"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_bcd_ab"))).shouldBe(10, 86); ((GenericFunction)(fs.getFunction("w4_d_acd"))).shouldBe(10, 11); ((GenericFunction)(fs.getFunction("w4_bcd_bcd"))).shouldBe(10, 14); ((GenericFunction)(fs.getFunction("w4_abc_abcd"))).shouldBe(10, 24); ((GenericFunction)(fs.getFunction("w4_abd_ab"))).shouldBe(10, 7); ((GenericFunction)(fs.getFunction("w4_ad_bd"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_ad_bc"))).shouldBe(10, 8); ((GenericFunction)(fs.getFunction("w4_c_abcd"))).shouldBe(10, 93); ((GenericFunction)(fs.getFunction("w4_bc_d"))).shouldBe(10, 87); ((GenericFunction)(fs.getFunction("w4_bc_c"))).shouldBe(10, 107); ((GenericFunction)(fs.getFunction("w4_bc_b"))).shouldBe(10, 107); ((GenericFunction)(fs.getFunction("w4_bc_a"))).shouldBe(10, 87); ((GenericFunction)(fs.getFunction("w4_c_bd"))).shouldBe(10, 19); ((GenericFunction)(fs.getFunction("w4_c_bc"))).shouldBe(10, 107); ((GenericFunction)(fs.getFunction("w4_b_bcd"))).shouldBe(10, 118); ((GenericFunction)(fs.getFunction("w4_bc_bc_sud"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_a_d_srot"))).shouldBe(10, 10); ((GenericFunction)(fs.getFunction("w4_acd_abd_srot"))).shouldBe(10, 1); ((GenericFunction)(fs.getFunction("w4_d_abd"))).shouldBe(10, 15); ((GenericFunction)(fs.getFunction("w4_acd_bcd"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_d_abc"))).shouldBe(10, 101); ((GenericFunction)(fs.getFunction("w4_abc_bcd"))).shouldBe(10, 48); ((GenericFunction)(fs.getFunction("w4_ad_ac"))).shouldBe(10, 3); ((GenericFunction)(fs.getFunction("w4_bd_abcd"))).shouldBe(10, 5); ((GenericFunction)(fs.getFunction("w4_ad_ab"))).shouldBe(10, 10); ((GenericFunction)(fs.getFunction("w4_cd_abcd"))).shouldBe(10, 44); ((GenericFunction)(fs.getFunction("w4_c_ad"))).shouldBe(10, 16); ((GenericFunction)(fs.getFunction("w4_c_ac"))).shouldBe(10, 27); ((GenericFunction)(fs.getFunction("w4_c_ab"))).shouldBe(10, 175); ((GenericFunction)(fs.getFunction("w4_abcd_ad_slr"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_ac_bd_srot"))).shouldBe(10, 1); ((GenericFunction)(fs.getFunction("w4_ad_ad_slr"))).shouldBe(10, 2); ((GenericFunction)(fs.getFunction("w4_c_c_sud"))).shouldBe(10, 7); ((GenericFunction)(fs.getFunction("w4_abcd_bcd"))).shouldBe(10, 24); ((GenericFunction)(fs.getFunction("w4_ad_acd"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_d_cd"))).shouldBe(11, 222); ((GenericFunction)(fs.getFunction("w4_ad_abcd"))).shouldBe(11, 10); ((GenericFunction)(fs.getFunction("w4_cd_bcd"))).shouldBe(11, 93); ((GenericFunction)(fs.getFunction("w4_bc_bcd"))).shouldBe(11, 152); ((GenericFunction)(fs.getFunction("w4_bcd_d"))).shouldBe(11, 124); ((GenericFunction)(fs.getFunction("w4_bcd_c"))).shouldBe(11, 261); ((GenericFunction)(fs.getFunction("w4_bcd_b"))).shouldBe(11, 356); ((GenericFunction)(fs.getFunction("w4_ab_bcd"))).shouldBe(11, 240); ((GenericFunction)(fs.getFunction("w4_bcd_a"))).shouldBe(11, 287); ((GenericFunction)(fs.getFunction("w4_ad_abd"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_ad_abc"))).shouldBe(11, 14); ((GenericFunction)(fs.getFunction("w4_d_bd"))).shouldBe(11, 45); ((GenericFunction)(fs.getFunction("w4_d_bc"))).shouldBe(11, 301); ((GenericFunction)(fs.getFunction("w4_abd_abcd"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_c_acd"))).shouldBe(11, 49); ((GenericFunction)(fs.getFunction("w4_acd_abcd"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_d_abcd"))).shouldBe(11, 150); ((GenericFunction)(fs.getFunction("w4_abd_d"))).shouldBe(11, 35); ((GenericFunction)(fs.getFunction("w4_abd_c"))).shouldBe(11, 47); ((GenericFunction)(fs.getFunction("w4_abd_b"))).shouldBe(11, 49); ((GenericFunction)(fs.getFunction("w4_abd_a"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_ad_d"))).shouldBe(11, 35); ((GenericFunction)(fs.getFunction("w4_ad_c"))).shouldBe(11, 51); ((GenericFunction)(fs.getFunction("w4_ad_b"))).shouldBe(11, 51); ((GenericFunction)(fs.getFunction("w4_ad_a"))).shouldBe(11, 35); ((GenericFunction)(fs.getFunction("w4_ab_d"))).shouldBe(11, 458); ((GenericFunction)(fs.getFunction("w4_ab_c"))).shouldBe(11, 553); ((GenericFunction)(fs.getFunction("w4_ab_b"))).shouldBe(11, 447); ((GenericFunction)(fs.getFunction("w4_a_bcd"))).shouldBe(11, 287); ((GenericFunction)(fs.getFunction("w4_ab_a"))).shouldBe(11, 222); ((GenericFunction)(fs.getFunction("w4_d_ad"))).shouldBe(11, 35); ((GenericFunction)(fs.getFunction("w4_d_ac"))).shouldBe(11, 68); ((GenericFunction)(fs.getFunction("w4_d_ab"))).shouldBe(11, 458); ((GenericFunction)(fs.getFunction("w4_c_abd"))).shouldBe(11, 47); ((GenericFunction)(fs.getFunction("w4_c_abc"))).shouldBe(11, 356); ((GenericFunction)(fs.getFunction("w4_cd_cd"))).shouldBe(11, 158); ((GenericFunction)(fs.getFunction("w4_abcd_d"))).shouldBe(11, 150); ((GenericFunction)(fs.getFunction("w4_abcd_c"))).shouldBe(11, 255); ((GenericFunction)(fs.getFunction("w4_abcd_b"))).shouldBe(11, 255); ((GenericFunction)(fs.getFunction("w4_c_d"))).shouldBe(11, 554); ((GenericFunction)(fs.getFunction("w4_abd_abd"))).shouldBe(11, 2); ((GenericFunction)(fs.getFunction("w4_c_c"))).shouldBe(11, 822); ((GenericFunction)(fs.getFunction("w4_abcd_a"))).shouldBe(11, 150); ((GenericFunction)(fs.getFunction("w4_abd_abc"))).shouldBe(11, 13); ((GenericFunction)(fs.getFunction("w4_c_b"))).shouldBe(11, 872); ((GenericFunction)(fs.getFunction("w4_c_a"))).shouldBe(11, 687); ((GenericFunction)(fs.getFunction("w4_abc_abc_sud"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_b_b_sud"))).shouldBe(11, 11); ((GenericFunction)(fs.getFunction("w4_a_d"))).shouldBe(11, 566); ((GenericFunction)(fs.getFunction("w4_a_c"))).shouldBe(11, 687); ((GenericFunction)(fs.getFunction("w4_a_b"))).shouldBe(11, 554); ((GenericFunction)(fs.getFunction("w4_bd_acd"))).shouldBe(11, 5); ((GenericFunction)(fs.getFunction("w4_a_a"))).shouldBe(11, 306); ((GenericFunction)(fs.getFunction("w4_bc_cd"))).shouldBe(11, 240); ((GenericFunction)(fs.getFunction("w4_ab_ab_sud"))).shouldBe(11, 7); ((GenericFunction)(fs.getFunction("w4_ac_acd"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_cd_bd"))).shouldBe(11, 27); ((GenericFunction)(fs.getFunction("w4_cd_bc"))).shouldBe(11, 240); ((GenericFunction)(fs.getFunction("w4_d_bcd"))).shouldBe(11, 124); ((GenericFunction)(fs.getFunction("w4_abcd_abcd"))).shouldBe(11, 24); ((GenericFunction)(fs.getFunction("w4_acd_d"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_acd_c"))).shouldBe(11, 49); ((GenericFunction)(fs.getFunction("w4_ab_cd"))).shouldBe(11, 372); ((GenericFunction)(fs.getFunction("w4_acd_b"))).shouldBe(11, 47); ((GenericFunction)(fs.getFunction("w4_a_abcd"))).shouldBe(11, 150); ((GenericFunction)(fs.getFunction("w4_acd_a"))).shouldBe(11, 35); ((GenericFunction)(fs.getFunction("w4_bcd_acd"))).shouldBe(11, 13); ((GenericFunction)(fs.getFunction("w4_bd_abd"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_bd_abc"))).shouldBe(11, 32); ((GenericFunction)(fs.getFunction("w4_bd_d"))).shouldBe(11, 45); ((GenericFunction)(fs.getFunction("w4_bc_bd"))).shouldBe(11, 37); ((GenericFunction)(fs.getFunction("w4_bd_c"))).shouldBe(11, 68); ((GenericFunction)(fs.getFunction("w4_bc_bc"))).shouldBe(11, 160); ((GenericFunction)(fs.getFunction("w4_bd_b"))).shouldBe(11, 89); ((GenericFunction)(fs.getFunction("w4_a_cd"))).shouldBe(11, 458); ((GenericFunction)(fs.getFunction("w4_bd_a"))).shouldBe(11, 68); ((GenericFunction)(fs.getFunction("w4_ac_abd"))).shouldBe(11, 5); ((GenericFunction)(fs.getFunction("w4_ac_abc"))).shouldBe(11, 16); ((GenericFunction)(fs.getFunction("w4_cd_ad"))).shouldBe(11, 23); ((GenericFunction)(fs.getFunction("w4_cd_ac"))).shouldBe(11, 56); ((GenericFunction)(fs.getFunction("w4_cd_ab"))).shouldBe(11, 372); ((GenericFunction)(fs.getFunction("w4_acd_cd"))).shouldBe(11, 23); ((GenericFunction)(fs.getFunction("w4_b_acd"))).shouldBe(11, 47); ((GenericFunction)(fs.getFunction("w4_bcd_abcd"))).shouldBe(11, 71); ((GenericFunction)(fs.getFunction("w4_acd_acd"))).shouldBe(11, 2); ((GenericFunction)(fs.getFunction("w4_ab_bd"))).shouldBe(11, 56); ((GenericFunction)(fs.getFunction("w4_ab_bc"))).shouldBe(11, 240); ((GenericFunction)(fs.getFunction("w4_bcd_abd"))).shouldBe(11, 14); ((GenericFunction)(fs.getFunction("w4_bcd_abc"))).shouldBe(11, 146); ((GenericFunction)(fs.getFunction("w4_bc_ad"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_bc_ac"))).shouldBe(11, 37); ((GenericFunction)(fs.getFunction("w4_a_bd"))).shouldBe(11, 68); ((GenericFunction)(fs.getFunction("w4_abc_acd"))).shouldBe(11, 14); ((GenericFunction)(fs.getFunction("w4_bc_ab"))).shouldBe(11, 240); ((GenericFunction)(fs.getFunction("w4_a_bc"))).shouldBe(11, 301); ((GenericFunction)(fs.getFunction("w4_abc_cd"))).shouldBe(11, 240); ((GenericFunction)(fs.getFunction("w4_acd_bd"))).shouldBe(11, 5); ((GenericFunction)(fs.getFunction("w4_b_abd"))).shouldBe(11, 49); ((GenericFunction)(fs.getFunction("w4_acd_bc"))).shouldBe(11, 28); ((GenericFunction)(fs.getFunction("w4_b_abc"))).shouldBe(11, 261); ((GenericFunction)(fs.getFunction("w4_cd_cd_sud"))).shouldBe(11, 7); ((GenericFunction)(fs.getFunction("w4_bd_cd"))).shouldBe(11, 27); ((GenericFunction)(fs.getFunction("w4_ab_abcd"))).shouldBe(11, 121); ((GenericFunction)(fs.getFunction("w4_ad_bcd"))).shouldBe(11, 14); ((GenericFunction)(fs.getFunction("w4_acd_abc"))).shouldBe(11, 14); ((GenericFunction)(fs.getFunction("w4_ab_ad"))).shouldBe(11, 23); ((GenericFunction)(fs.getFunction("w4_abcd_acd"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_ab_ac"))).shouldBe(11, 27); ((GenericFunction)(fs.getFunction("w4_ab_ab"))).shouldBe(11, 158); ((GenericFunction)(fs.getFunction("w4_a_ad"))).shouldBe(11, 35); ((GenericFunction)(fs.getFunction("w4_abc_abd"))).shouldBe(11, 13); ((GenericFunction)(fs.getFunction("w4_cd_acd"))).shouldBe(11, 23); ((GenericFunction)(fs.getFunction("w4_a_ac"))).shouldBe(11, 45); ((GenericFunction)(fs.getFunction("w4_abc_abc"))).shouldBe(11, 56); ((GenericFunction)(fs.getFunction("w4_a_ab"))).shouldBe(11, 222); ((GenericFunction)(fs.getFunction("w4_abc_bd"))).shouldBe(11, 32); ((GenericFunction)(fs.getFunction("w4_abc_bc"))).shouldBe(11, 152); ((GenericFunction)(fs.getFunction("w4_abcd_cd"))).shouldBe(11, 121); ((GenericFunction)(fs.getFunction("w4_bc_acd"))).shouldBe(11, 28); ((GenericFunction)(fs.getFunction("w4_acd_ad"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_acd_ac"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_acd_ab"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_ac_cd"))).shouldBe(11, 56); ((GenericFunction)(fs.getFunction("w4_ab_acd"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_cd_d"))).shouldBe(11, 222); ((GenericFunction)(fs.getFunction("w4_bd_bd"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_cd_c"))).shouldBe(11, 447); ((GenericFunction)(fs.getFunction("w4_bd_bc"))).shouldBe(11, 37); ((GenericFunction)(fs.getFunction("w4_cd_b"))).shouldBe(11, 553); ((GenericFunction)(fs.getFunction("w4_b_cd"))).shouldBe(11, 553); ((GenericFunction)(fs.getFunction("w4_cd_a"))).shouldBe(11, 458); ((GenericFunction)(fs.getFunction("w4_abcd_abd"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_abcd_abc"))).shouldBe(11, 71); ((GenericFunction)(fs.getFunction("w4_b_abcd"))).shouldBe(11, 255); ((GenericFunction)(fs.getFunction("w4_c_bcd"))).shouldBe(11, 261); ((GenericFunction)(fs.getFunction("w4_cd_abd"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_cd_abc"))).shouldBe(11, 240); ((GenericFunction)(fs.getFunction("w4_a_a_sud"))).shouldBe(11, 10); ((GenericFunction)(fs.getFunction("w4_abc_ad"))).shouldBe(11, 14); ((GenericFunction)(fs.getFunction("w4_abc_ac"))).shouldBe(11, 16); ((GenericFunction)(fs.getFunction("w4_abc_ab"))).shouldBe(11, 93); ((GenericFunction)(fs.getFunction("w4_abcd_bd"))).shouldBe(11, 17); ((GenericFunction)(fs.getFunction("w4_bc_abd"))).shouldBe(11, 28); ((GenericFunction)(fs.getFunction("w4_abcd_bc"))).shouldBe(11, 146); ((GenericFunction)(fs.getFunction("w4_abc_d"))).shouldBe(11, 287); ((GenericFunction)(fs.getFunction("w4_d_d_sud"))).shouldBe(11, 10); ((GenericFunction)(fs.getFunction("w4_bc_abc"))).shouldBe(11, 152); ((GenericFunction)(fs.getFunction("w4_abc_c"))).shouldBe(11, 356); ((GenericFunction)(fs.getFunction("w4_abc_b"))).shouldBe(11, 261); ((GenericFunction)(fs.getFunction("w4_abc_a"))).shouldBe(11, 124); ((GenericFunction)(fs.getFunction("w4_ac_bd"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_ac_bc"))).shouldBe(11, 37); ((GenericFunction)(fs.getFunction("w4_ac_d"))).shouldBe(11, 68); ((GenericFunction)(fs.getFunction("w4_ac_c"))).shouldBe(11, 89); ((GenericFunction)(fs.getFunction("w4_bcd_cd"))).shouldBe(11, 93); ((GenericFunction)(fs.getFunction("w4_abd_bcd"))).shouldBe(11, 14); ((GenericFunction)(fs.getFunction("w4_ab_abd"))).shouldBe(11, 23); ((GenericFunction)(fs.getFunction("w4_ac_b"))).shouldBe(11, 68); ((GenericFunction)(fs.getFunction("w4_bd_ad"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_ab_abc"))).shouldBe(11, 93); ((GenericFunction)(fs.getFunction("w4_ac_a"))).shouldBe(11, 45); ((GenericFunction)(fs.getFunction("w4_bd_ac"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_b_bd"))).shouldBe(11, 89); ((GenericFunction)(fs.getFunction("w4_bd_ab"))).shouldBe(11, 56); ((GenericFunction)(fs.getFunction("w4_b_bc"))).shouldBe(11, 392); ((GenericFunction)(fs.getFunction("w4_abd_cd"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_a_acd"))).shouldBe(11, 35); ((GenericFunction)(fs.getFunction("w4_bcd_bcd_sud"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_bc_abcd"))).shouldBe(11, 146); ((GenericFunction)(fs.getFunction("w4_abcd_ad"))).shouldBe(11, 10); ((GenericFunction)(fs.getFunction("w4_abcd_ac"))).shouldBe(11, 17); ((GenericFunction)(fs.getFunction("w4_abcd_ab"))).shouldBe(11, 121); ((GenericFunction)(fs.getFunction("w4_ac_ad"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_ac_ac"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_ac_ab"))).shouldBe(11, 27); ((GenericFunction)(fs.getFunction("w4_bcd_bd"))).shouldBe(11, 16); ((GenericFunction)(fs.getFunction("w4_d_d"))).shouldBe(11, 306); ((GenericFunction)(fs.getFunction("w4_bcd_bc"))).shouldBe(11, 152); ((GenericFunction)(fs.getFunction("w4_d_c"))).shouldBe(11, 554); ((GenericFunction)(fs.getFunction("w4_d_b"))).shouldBe(11, 687); ((GenericFunction)(fs.getFunction("w4_b_ad"))).shouldBe(11, 51); ((GenericFunction)(fs.getFunction("w4_d_a"))).shouldBe(11, 566); ((GenericFunction)(fs.getFunction("w4_b_ac"))).shouldBe(11, 68); ((GenericFunction)(fs.getFunction("w4_b_ab"))).shouldBe(11, 447); ((GenericFunction)(fs.getFunction("w4_b_d"))).shouldBe(11, 687); ((GenericFunction)(fs.getFunction("w4_b_c"))).shouldBe(11, 872); ((GenericFunction)(fs.getFunction("w4_abd_bd"))).shouldBe(11, 6); ((GenericFunction)(fs.getFunction("w4_ac_abcd"))).shouldBe(11, 17); ((GenericFunction)(fs.getFunction("w4_b_b"))).shouldBe(11, 822); ((GenericFunction)(fs.getFunction("w4_a_abd"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_bd_bcd"))).shouldBe(11, 16); ((GenericFunction)(fs.getFunction("w4_abd_bc"))).shouldBe(11, 28); ((GenericFunction)(fs.getFunction("w4_a_abc"))).shouldBe(11, 124); ((GenericFunction)(fs.getFunction("w4_b_a"))).shouldBe(11, 554); ((GenericFunction)(fs.getFunction("w4_abcd_abcd_sud"))).shouldBe(11, 8); ((GenericFunction)(fs.getFunction("w4_ad_cd"))).shouldBe(11, 23); ((GenericFunction)(fs.getFunction("w4_ac_bcd"))).shouldBe(11, 32); ((GenericFunction)(fs.getFunction("w4_c_cd"))).shouldBe(11, 447); ((GenericFunction)(fs.getFunction("w4_bcd_ad"))).shouldBe(11, 14); ((GenericFunction)(fs.getFunction("w4_bcd_ac"))).shouldBe(11, 32); ((GenericFunction)(fs.getFunction("w4_bcd_ab"))).shouldBe(11, 240); ((GenericFunction)(fs.getFunction("w4_d_acd"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_abd_ad"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_abd_ac"))).shouldBe(11, 5); ((GenericFunction)(fs.getFunction("w4_bcd_bcd"))).shouldBe(11, 56); ((GenericFunction)(fs.getFunction("w4_abc_abcd"))).shouldBe(11, 71); ((GenericFunction)(fs.getFunction("w4_abd_ab"))).shouldBe(11, 23); ((GenericFunction)(fs.getFunction("w4_ad_bd"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_ad_bc"))).shouldBe(11, 26); ((GenericFunction)(fs.getFunction("w4_c_abcd"))).shouldBe(11, 255); ((GenericFunction)(fs.getFunction("w4_bc_d"))).shouldBe(11, 301); ((GenericFunction)(fs.getFunction("w4_bc_c"))).shouldBe(11, 392); ((GenericFunction)(fs.getFunction("w4_bc_b"))).shouldBe(11, 392); ((GenericFunction)(fs.getFunction("w4_bc_a"))).shouldBe(11, 301); ((GenericFunction)(fs.getFunction("w4_c_bd"))).shouldBe(11, 68); ((GenericFunction)(fs.getFunction("w4_c_bc"))).shouldBe(11, 392); ((GenericFunction)(fs.getFunction("w4_b_bcd"))).shouldBe(11, 356); ((GenericFunction)(fs.getFunction("w4_bc_bc_sud"))).shouldBe(11, 2); ((GenericFunction)(fs.getFunction("w4_d_abd"))).shouldBe(11, 35); ((GenericFunction)(fs.getFunction("w4_acd_bcd"))).shouldBe(11, 13); ((GenericFunction)(fs.getFunction("w4_d_abc"))).shouldBe(11, 287); ((GenericFunction)(fs.getFunction("w4_abc_bcd"))).shouldBe(11, 146); ((GenericFunction)(fs.getFunction("w4_ad_ad"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_ad_ac"))).shouldBe(11, 4); ((GenericFunction)(fs.getFunction("w4_bd_abcd"))).shouldBe(11, 17); ((GenericFunction)(fs.getFunction("w4_ad_ab"))).shouldBe(11, 23); ((GenericFunction)(fs.getFunction("w4_cd_abcd"))).shouldBe(11, 121); ((GenericFunction)(fs.getFunction("w4_c_ad"))).shouldBe(11, 51); ((GenericFunction)(fs.getFunction("w4_c_ac"))).shouldBe(11, 89); ((GenericFunction)(fs.getFunction("w4_c_ab"))).shouldBe(11, 553); ((GenericFunction)(fs.getFunction("w4_c_c_sud"))).shouldBe(11, 11); ((GenericFunction)(fs.getFunction("w4_abcd_bcd"))).shouldBe(11, 71); ((GenericFunction)(fs.getFunction("w4_b_c_srot"))).shouldBe(12, 38); ((GenericFunction)(fs.getFunction("w4_ad_acd"))).shouldBe(12, 5); ((GenericFunction)(fs.getFunction("w4_d_cd"))).shouldBe(12, 700); ((GenericFunction)(fs.getFunction("w4_ad_abcd"))).shouldBe(12, 14); ((GenericFunction)(fs.getFunction("w4_abc_bcd_srot"))).shouldBe(12, 14); ((GenericFunction)(fs.getFunction("w4_cd_bcd"))).shouldBe(12, 313); ((GenericFunction)(fs.getFunction("w4_c_b_srot"))).shouldBe(12, 38); ((GenericFunction)(fs.getFunction("w4_bc_ad_slr"))).shouldBe(12, 4); ((GenericFunction)(fs.getFunction("w4_bc_bcd"))).shouldBe(12, 476); ((GenericFunction)(fs.getFunction("w4_bcd_abc_srot"))).shouldBe(12, 14); ((GenericFunction)(fs.getFunction("w4_d_a_srot"))).shouldBe(12, 27); ((GenericFunction)(fs.getFunction("w4_bcd_d"))).shouldBe(12, 405); ((GenericFunction)(fs.getFunction("w4_cd_ab_srot"))).shouldBe(12, 23); ((GenericFunction)(fs.getFunction("w4_bcd_c"))).shouldBe(12, 828); ((GenericFunction)(fs.getFunction("w4_bcd_b"))).shouldBe(12, 1055); ((GenericFunction)(fs.getFunction("w4_ab_bcd"))).shouldBe(12, 667); ((GenericFunction)(fs.getFunction("w4_bcd_a"))).shouldBe(12, 817); ((GenericFunction)(fs.getFunction("w4_ad_abd"))).shouldBe(12, 5); ((GenericFunction)(fs.getFunction("w4_ad_abc"))).shouldBe(12, 37); ((GenericFunction)(fs.getFunction("w4_d_bd"))).shouldBe(12, 124); ((GenericFunction)(fs.getFunction("w4_ad_ad_slr_sud_srot"))).shouldBe(12, 2); ((GenericFunction)(fs.getFunction("w4_d_bc"))).shouldBe(12, 958); ((GenericFunction)(fs.getFunction("w4_abd_abcd"))).shouldBe(12, 21); ((GenericFunction)(fs.getFunction("w4_c_acd"))).shouldBe(12, 141); ((GenericFunction)(fs.getFunction("w4_acd_abcd"))).shouldBe(12, 21); ((GenericFunction)(fs.getFunction("w4_abcd_abcd_slr_sud_srot"))).shouldBe(12, 3); ((GenericFunction)(fs.getFunction("w4_d_abcd"))).shouldBe(12, 413); ((GenericFunction)(fs.getFunction("w4_abd_d"))).shouldBe(12, 93); ((GenericFunction)(fs.getFunction("w4_abd_c"))).shouldBe(12, 139); ((GenericFunction)(fs.getFunction("w4_abd_b"))).shouldBe(12, 141); ((GenericFunction)(fs.getFunction("w4_abd_a"))).shouldBe(12, 79); ((GenericFunction)(fs.getFunction("w4_ad_d"))).shouldBe(12, 98); ((GenericFunction)(fs.getFunction("w4_ad_c"))).shouldBe(12, 146); ((GenericFunction)(fs.getFunction("w4_ad_b"))).shouldBe(12, 146); ((GenericFunction)(fs.getFunction("w4_ad_a"))).shouldBe(12, 98); ((GenericFunction)(fs.getFunction("w4_ab_d"))).shouldBe(12, 1319); ((GenericFunction)(fs.getFunction("w4_ab_c"))).shouldBe(12, 1672); ((GenericFunction)(fs.getFunction("w4_abd_acd"))).shouldBe(12, 6); ((GenericFunction)(fs.getFunction("w4_ab_b"))).shouldBe(12, 1385); ((GenericFunction)(fs.getFunction("w4_a_bcd"))).shouldBe(12, 817); ((GenericFunction)(fs.getFunction("w4_ab_a"))).shouldBe(12, 700); ((GenericFunction)(fs.getFunction("w4_d_ad"))).shouldBe(12, 98); ((GenericFunction)(fs.getFunction("w4_d_ac"))).shouldBe(12, 194); ((GenericFunction)(fs.getFunction("w4_d_ab"))).shouldBe(12, 1319); ((GenericFunction)(fs.getFunction("w4_c_abd"))).shouldBe(12, 139); ((GenericFunction)(fs.getFunction("w4_c_abc"))).shouldBe(12, 1055); ((GenericFunction)(fs.getFunction("w4_cd_cd"))).shouldBe(12, 520); ((GenericFunction)(fs.getFunction("w4_bd_ac_srot"))).shouldBe(12, 3); ((GenericFunction)(fs.getFunction("w4_abcd_d"))).shouldBe(12, 413); ((GenericFunction)(fs.getFunction("w4_abcd_c"))).shouldBe(12, 719); ((GenericFunction)(fs.getFunction("w4_abcd_b"))).shouldBe(12, 719); ((GenericFunction)(fs.getFunction("w4_c_d"))).shouldBe(12, 1732); ((GenericFunction)(fs.getFunction("w4_abd_abd"))).shouldBe(12, 6); ((GenericFunction)(fs.getFunction("w4_c_c"))).shouldBe(12, 2652); ((GenericFunction)(fs.getFunction("w4_abcd_a"))).shouldBe(12, 413); ((GenericFunction)(fs.getFunction("w4_c_b"))).shouldBe(12, 2766); ((GenericFunction)(fs.getFunction("w4_abd_abc"))).shouldBe(12, 35); ((GenericFunction)(fs.getFunction("w4_c_a"))).shouldBe(12, 2087); ((GenericFunction)(fs.getFunction("w4_abc_abc_sud"))).shouldBe(12, 13); ((GenericFunction)(fs.getFunction("w4_b_b_sud"))).shouldBe(12, 30); ((GenericFunction)(fs.getFunction("w4_a_d"))).shouldBe(12, 1598); ((GenericFunction)(fs.getFunction("w4_a_c"))).shouldBe(12, 2087); ((GenericFunction)(fs.getFunction("w4_a_b"))).shouldBe(12, 1732); ((GenericFunction)(fs.getFunction("w4_bd_acd"))).shouldBe(12, 7); ((GenericFunction)(fs.getFunction("w4_a_a"))).shouldBe(12, 928); ((GenericFunction)(fs.getFunction("w4_bc_cd"))).shouldBe(12, 769); ((GenericFunction)(fs.getFunction("w4_ab_ab_sud"))).shouldBe(12, 20); ((GenericFunction)(fs.getFunction("w4_ac_ac_sud"))).shouldBe(12, 3); ((GenericFunction)(fs.getFunction("w4_ac_acd"))).shouldBe(12, 11); ((GenericFunction)(fs.getFunction("w4_cd_bd"))).shouldBe(12, 91); ((GenericFunction)(fs.getFunction("w4_cd_bc"))).shouldBe(12, 769); ((GenericFunction)(fs.getFunction("w4_abd_abd_sud"))).shouldBe(12, 1); ((GenericFunction)(fs.getFunction("w4_d_bcd"))).shouldBe(12, 405); ((GenericFunction)(fs.getFunction("w4_bc_abcd_slr"))).shouldBe(12, 4); ((GenericFunction)(fs.getFunction("w4_abcd_abcd"))).shouldBe(12, 76); ((GenericFunction)(fs.getFunction("w4_acd_d"))).shouldBe(12, 79); ((GenericFunction)(fs.getFunction("w4_acd_c"))).shouldBe(12, 141); ((GenericFunction)(fs.getFunction("w4_ab_cd"))).shouldBe(12, 1048); ((GenericFunction)(fs.getFunction("w4_acd_b"))).shouldBe(12, 139); ((GenericFunction)(fs.getFunction("w4_a_abcd"))).shouldBe(12, 413); ((GenericFunction)(fs.getFunction("w4_acd_a"))).shouldBe(12, 93); ((GenericFunction)(fs.getFunction("w4_bd_abd"))).shouldBe(12, 11); ((GenericFunction)(fs.getFunction("w4_bcd_acd"))).shouldBe(12, 35); ((GenericFunction)(fs.getFunction("w4_bd_abc"))).shouldBe(12, 90); ((GenericFunction)(fs.getFunction("w4_bd_d"))).shouldBe(12, 124); ((GenericFunction)(fs.getFunction("w4_bc_bd"))).shouldBe(12, 122); ((GenericFunction)(fs.getFunction("w4_bd_c"))).shouldBe(12, 208); ((GenericFunction)(fs.getFunction("w4_bc_bc"))).shouldBe(12, 564); ((GenericFunction)(fs.getFunction("w4_bd_b"))).shouldBe(12, 257); ((GenericFunction)(fs.getFunction("w4_a_cd"))).shouldBe(12, 1319); ((GenericFunction)(fs.getFunction("w4_bd_a"))).shouldBe(12, 194); ((GenericFunction)(fs.getFunction("w4_ac_abd"))).shouldBe(12, 7); ((GenericFunction)(fs.getFunction("w4_ac_abc"))).shouldBe(12, 52); ((GenericFunction)(fs.getFunction("w4_cd_ad"))).shouldBe(12, 69); ((GenericFunction)(fs.getFunction("w4_cd_ac"))).shouldBe(12, 158); ((GenericFunction)(fs.getFunction("w4_cd_ab"))).shouldBe(12, 1048); ((GenericFunction)(fs.getFunction("w4_acd_cd"))).shouldBe(12, 61); ((GenericFunction)(fs.getFunction("w4_b_acd"))).shouldBe(12, 139); ((GenericFunction)(fs.getFunction("w4_bcd_abcd"))).shouldBe(12, 195); ((GenericFunction)(fs.getFunction("w4_ad_abcd_slr"))).shouldBe(12, 4); ((GenericFunction)(fs.getFunction("w4_acd_acd"))).shouldBe(12, 6); ((GenericFunction)(fs.getFunction("w4_ab_bd"))).shouldBe(12, 158); ((GenericFunction)(fs.getFunction("w4_ab_bc"))).shouldBe(12, 769); ((GenericFunction)(fs.getFunction("w4_bcd_abd"))).shouldBe(12, 39); ((GenericFunction)(fs.getFunction("w4_bcd_abc"))).shouldBe(12, 386); ((GenericFunction)(fs.getFunction("w4_bc_ad"))).shouldBe(12, 76); ((GenericFunction)(fs.getFunction("w4_bc_ac"))).shouldBe(12, 122); ((GenericFunction)(fs.getFunction("w4_a_bd"))).shouldBe(12, 194); ((GenericFunction)(fs.getFunction("w4_abc_acd"))).shouldBe(12, 39); ((GenericFunction)(fs.getFunction("w4_bc_ab"))).shouldBe(12, 769); ((GenericFunction)(fs.getFunction("w4_a_bc"))).shouldBe(12, 958); ((GenericFunction)(fs.getFunction("w4_abc_cd"))).shouldBe(12, 667); ((GenericFunction)(fs.getFunction("w4_acd_bd"))).shouldBe(12, 7); ((GenericFunction)(fs.getFunction("w4_b_abd"))).shouldBe(12, 141); ((GenericFunction)(fs.getFunction("w4_acd_bc"))).shouldBe(12, 76); ((GenericFunction)(fs.getFunction("w4_b_abc"))).shouldBe(12, 828); ((GenericFunction)(fs.getFunction("w4_cd_cd_sud"))).shouldBe(12, 20); ((GenericFunction)(fs.getFunction("w4_bd_cd"))).shouldBe(12, 91); ((GenericFunction)(fs.getFunction("w4_ab_abcd"))).shouldBe(12, 324); ((GenericFunction)(fs.getFunction("w4_ad_bcd"))).shouldBe(12, 37); ((GenericFunction)(fs.getFunction("w4_acd_abd"))).shouldBe(12, 6); ((GenericFunction)(fs.getFunction("w4_acd_abc"))).shouldBe(12, 39); ((GenericFunction)(fs.getFunction("w4_ab_ad"))).shouldBe(12, 69); ((GenericFunction)(fs.getFunction("w4_abcd_acd"))).shouldBe(12, 21); ((GenericFunction)(fs.getFunction("w4_ab_ac"))).shouldBe(12, 91); ((GenericFunction)(fs.getFunction("w4_ab_ab"))).shouldBe(12, 520); ((GenericFunction)(fs.getFunction("w4_abcd_bc_slr"))).shouldBe(12, 4); ((GenericFunction)(fs.getFunction("w4_a_ad"))).shouldBe(12, 98); ((GenericFunction)(fs.getFunction("w4_ad_bc_slr"))).shouldBe(12, 4); ((GenericFunction)(fs.getFunction("w4_abc_abd"))).shouldBe(12, 35); ((GenericFunction)(fs.getFunction("w4_cd_acd"))).shouldBe(12, 61); ((GenericFunction)(fs.getFunction("w4_a_ac"))).shouldBe(12, 124); ((GenericFunction)(fs.getFunction("w4_abc_abc"))).shouldBe(12, 184); ((GenericFunction)(fs.getFunction("w4_a_ab"))).shouldBe(12, 700); ((GenericFunction)(fs.getFunction("w4_abc_bd"))).shouldBe(12, 90); ((GenericFunction)(fs.getFunction("w4_abc_bc"))).shouldBe(12, 476); ((GenericFunction)(fs.getFunction("w4_abcd_cd"))).shouldBe(12, 324); ((GenericFunction)(fs.getFunction("w4_bc_acd"))).shouldBe(12, 76); ((GenericFunction)(fs.getFunction("w4_acd_ad"))).shouldBe(12, 5); ((GenericFunction)(fs.getFunction("w4_acd_ac"))).shouldBe(12, 11); ((GenericFunction)(fs.getFunction("w4_acd_ab"))).shouldBe(12, 65); ((GenericFunction)(fs.getFunction("w4_ac_cd"))).shouldBe(12, 158); ((GenericFunction)(fs.getFunction("w4_ab_acd"))).shouldBe(12, 65); ((GenericFunction)(fs.getFunction("w4_cd_d"))).shouldBe(12, 700); ((GenericFunction)(fs.getFunction("w4_bd_bd"))).shouldBe(12, 14); ((GenericFunction)(fs.getFunction("w4_cd_c"))).shouldBe(12, 1385); ((GenericFunction)(fs.getFunction("w4_bd_bc"))).shouldBe(12, 122); ((GenericFunction)(fs.getFunction("w4_cd_b"))).shouldBe(12, 1672); ((GenericFunction)(fs.getFunction("w4_b_cd"))).shouldBe(12, 1672); ((GenericFunction)(fs.getFunction("w4_bc_bc_slr"))).shouldBe(12, 2); ((GenericFunction)(fs.getFunction("w4_cd_a"))).shouldBe(12, 1319); ((GenericFunction)(fs.getFunction("w4_abcd_abd"))).shouldBe(12, 21); ((GenericFunction)(fs.getFunction("w4_abcd_abc"))).shouldBe(12, 195); ((GenericFunction)(fs.getFunction("w4_b_abcd"))).shouldBe(12, 719); ((GenericFunction)(fs.getFunction("w4_c_bcd"))).shouldBe(12, 828); ((GenericFunction)(fs.getFunction("w4_cd_abd"))).shouldBe(12, 65); ((GenericFunction)(fs.getFunction("w4_cd_abc"))).shouldBe(12, 667); ((GenericFunction)(fs.getFunction("w4_a_a_sud"))).shouldBe(12, 25); ((GenericFunction)(fs.getFunction("w4_abc_ad"))).shouldBe(12, 37); ((GenericFunction)(fs.getFunction("w4_abc_ac"))).shouldBe(12, 52); ((GenericFunction)(fs.getFunction("w4_abc_ab"))).shouldBe(12, 313); ((GenericFunction)(fs.getFunction("w4_abcd_bd"))).shouldBe(12, 42); ((GenericFunction)(fs.getFunction("w4_bc_abd"))).shouldBe(12, 76); ((GenericFunction)(fs.getFunction("w4_abcd_bc"))).shouldBe(12, 396); ((GenericFunction)(fs.getFunction("w4_abc_d"))).shouldBe(12, 817); ((GenericFunction)(fs.getFunction("w4_d_d_sud"))).shouldBe(12, 25); ((GenericFunction)(fs.getFunction("w4_bc_abc"))).shouldBe(12, 476); ((GenericFunction)(fs.getFunction("w4_abc_c"))).shouldBe(12, 1055); ((GenericFunction)(fs.getFunction("w4_abc_b"))).shouldBe(12, 828); ((GenericFunction)(fs.getFunction("w4_abc_a"))).shouldBe(12, 405); ((GenericFunction)(fs.getFunction("w4_ac_bd"))).shouldBe(12, 16); ((GenericFunction)(fs.getFunction("w4_ac_bc"))).shouldBe(12, 122); ((GenericFunction)(fs.getFunction("w4_ac_d"))).shouldBe(12, 194); ((GenericFunction)(fs.getFunction("w4_bcd_cd"))).shouldBe(12, 313); ((GenericFunction)(fs.getFunction("w4_ac_c"))).shouldBe(12, 257); ((GenericFunction)(fs.getFunction("w4_ab_cd_srot"))).shouldBe(12, 23); ((GenericFunction)(fs.getFunction("w4_abd_bcd"))).shouldBe(12, 39); ((GenericFunction)(fs.getFunction("w4_ab_abd"))).shouldBe(12, 61); ((GenericFunction)(fs.getFunction("w4_ac_b"))).shouldBe(12, 208); ((GenericFunction)(fs.getFunction("w4_bd_ad"))).shouldBe(12, 10); ((GenericFunction)(fs.getFunction("w4_ab_abc"))).shouldBe(12, 313); ((GenericFunction)(fs.getFunction("w4_ac_a"))).shouldBe(12, 124); ((GenericFunction)(fs.getFunction("w4_acd_acd_sud"))).shouldBe(12, 1); ((GenericFunction)(fs.getFunction("w4_bd_ac"))).shouldBe(12, 16); ((GenericFunction)(fs.getFunction("w4_b_bd"))).shouldBe(12, 257); ((GenericFunction)(fs.getFunction("w4_bd_ab"))).shouldBe(12, 158); ((GenericFunction)(fs.getFunction("w4_b_bc"))).shouldBe(12, 1309); ((GenericFunction)(fs.getFunction("w4_abd_cd"))).shouldBe(12, 65); ((GenericFunction)(fs.getFunction("w4_a_acd"))).shouldBe(12, 93); ((GenericFunction)(fs.getFunction("w4_bcd_bcd_sud"))).shouldBe(12, 13); ((GenericFunction)(fs.getFunction("w4_bc_abcd"))).shouldBe(12, 396); ((GenericFunction)(fs.getFunction("w4_abcd_ad"))).shouldBe(12, 14); ((GenericFunction)(fs.getFunction("w4_abcd_ac"))).shouldBe(12, 42); ((GenericFunction)(fs.getFunction("w4_abcd_ab"))).shouldBe(12, 324); ((GenericFunction)(fs.getFunction("w4_ac_ad"))).shouldBe(12, 10); ((GenericFunction)(fs.getFunction("w4_ac_ac"))).shouldBe(12, 14); ((GenericFunction)(fs.getFunction("w4_ac_ab"))).shouldBe(12, 91); ((GenericFunction)(fs.getFunction("w4_bcd_bd"))).shouldBe(12, 52); ((GenericFunction)(fs.getFunction("w4_d_d"))).shouldBe(12, 928); ((GenericFunction)(fs.getFunction("w4_bcd_bc"))).shouldBe(12, 476); ((GenericFunction)(fs.getFunction("w4_d_c"))).shouldBe(12, 1732); ((GenericFunction)(fs.getFunction("w4_abd_acd_srot"))).shouldBe(12, 1); ((GenericFunction)(fs.getFunction("w4_d_b"))).shouldBe(12, 2087); ((GenericFunction)(fs.getFunction("w4_b_ad"))).shouldBe(12, 146); ((GenericFunction)(fs.getFunction("w4_d_a"))).shouldBe(12, 1598); ((GenericFunction)(fs.getFunction("w4_b_ac"))).shouldBe(12, 208); ((GenericFunction)(fs.getFunction("w4_b_ab"))).shouldBe(12, 1385); ((GenericFunction)(fs.getFunction("w4_b_d"))).shouldBe(12, 2087); ((GenericFunction)(fs.getFunction("w4_b_c"))).shouldBe(12, 2766); ((GenericFunction)(fs.getFunction("w4_b_b"))).shouldBe(12, 2652); ((GenericFunction)(fs.getFunction("w4_abd_bd"))).shouldBe(12, 11); ((GenericFunction)(fs.getFunction("w4_ac_abcd"))).shouldBe(12, 42); ((GenericFunction)(fs.getFunction("w4_a_abd"))).shouldBe(12, 79); ((GenericFunction)(fs.getFunction("w4_abd_bc"))).shouldBe(12, 76); ((GenericFunction)(fs.getFunction("w4_bd_bcd"))).shouldBe(12, 52); ((GenericFunction)(fs.getFunction("w4_a_abc"))).shouldBe(12, 405); ((GenericFunction)(fs.getFunction("w4_b_a"))).shouldBe(12, 1732); ((GenericFunction)(fs.getFunction("w4_abcd_abcd_sud"))).shouldBe(12, 14); ((GenericFunction)(fs.getFunction("w4_ad_cd"))).shouldBe(12, 69); ((GenericFunction)(fs.getFunction("w4_ac_bcd"))).shouldBe(12, 90); ((GenericFunction)(fs.getFunction("w4_abcd_abcd_srot"))).shouldBe(12, 2); ((GenericFunction)(fs.getFunction("w4_c_cd"))).shouldBe(12, 1385); ((GenericFunction)(fs.getFunction("w4_bc_bc_srot"))).shouldBe(12, 18); ((GenericFunction)(fs.getFunction("w4_bcd_ad"))).shouldBe(12, 37); ((GenericFunction)(fs.getFunction("w4_bcd_ac"))).shouldBe(12, 90); ((GenericFunction)(fs.getFunction("w4_bcd_ab"))).shouldBe(12, 667); ((GenericFunction)(fs.getFunction("w4_d_acd"))).shouldBe(12, 79); ((GenericFunction)(fs.getFunction("w4_abd_ad"))).shouldBe(12, 5); ((GenericFunction)(fs.getFunction("w4_bc_bc_slr_sud_srot"))).shouldBe(12, 2); ((GenericFunction)(fs.getFunction("w4_abd_ac"))).shouldBe(12, 7); ((GenericFunction)(fs.getFunction("w4_bcd_bcd"))).shouldBe(12, 184); ((GenericFunction)(fs.getFunction("w4_abc_abcd"))).shouldBe(12, 195); ((GenericFunction)(fs.getFunction("w4_abd_ab"))).shouldBe(12, 61); ((GenericFunction)(fs.getFunction("w4_ad_bd"))).shouldBe(12, 10); ((GenericFunction)(fs.getFunction("w4_ad_bc"))).shouldBe(12, 76); ((GenericFunction)(fs.getFunction("w4_c_abcd"))).shouldBe(12, 719); ((GenericFunction)(fs.getFunction("w4_bc_d"))).shouldBe(12, 958); ((GenericFunction)(fs.getFunction("w4_bc_c"))).shouldBe(12, 1309); ((GenericFunction)(fs.getFunction("w4_bc_b"))).shouldBe(12, 1309); ((GenericFunction)(fs.getFunction("w4_bc_a"))).shouldBe(12, 958); ((GenericFunction)(fs.getFunction("w4_c_bd"))).shouldBe(12, 208); ((GenericFunction)(fs.getFunction("w4_c_bc"))).shouldBe(12, 1309); ((GenericFunction)(fs.getFunction("w4_b_bcd"))).shouldBe(12, 1055); ((GenericFunction)(fs.getFunction("w4_bc_bc_sud"))).shouldBe(12, 8); ((GenericFunction)(fs.getFunction("w4_a_d_srot"))).shouldBe(12, 27); ((GenericFunction)(fs.getFunction("w4_bd_bd_sud"))).shouldBe(12, 3); ((GenericFunction)(fs.getFunction("w4_acd_abd_srot"))).shouldBe(12, 1); ((GenericFunction)(fs.getFunction("w4_d_abd"))).shouldBe(12, 93); ((GenericFunction)(fs.getFunction("w4_acd_bcd"))).shouldBe(12, 35); ((GenericFunction)(fs.getFunction("w4_d_abc"))).shouldBe(12, 817); ((GenericFunction)(fs.getFunction("w4_abc_bcd"))).shouldBe(12, 386); ((GenericFunction)(fs.getFunction("w4_ad_ac"))).shouldBe(12, 10); ((GenericFunction)(fs.getFunction("w4_bd_abcd"))).shouldBe(12, 42); ((GenericFunction)(fs.getFunction("w4_ad_ab"))).shouldBe(12, 69); ((GenericFunction)(fs.getFunction("w4_cd_abcd"))).shouldBe(12, 324); ((GenericFunction)(fs.getFunction("w4_c_ad"))).shouldBe(12, 146); ((GenericFunction)(fs.getFunction("w4_c_ac"))).shouldBe(12, 257); ((GenericFunction)(fs.getFunction("w4_c_ab"))).shouldBe(12, 1672); ((GenericFunction)(fs.getFunction("w4_abcd_ad_slr"))).shouldBe(12, 4); ((GenericFunction)(fs.getFunction("w4_ac_bd_srot"))).shouldBe(12, 3); ((GenericFunction)(fs.getFunction("w4_ad_ad_slr"))).shouldBe(12, 2); ((GenericFunction)(fs.getFunction("w4_c_c_sud"))).shouldBe(12, 30); ((GenericFunction)(fs.getFunction("w4_abcd_bcd"))).shouldBe(12, 195); } void loadMinimums() { ((DoubleFunction)(fs.getFunction("w4_abcd_abcd_slr_sud_srot"))).setMinimum(4); ((DoubleFunction)(fs.getFunction("w4_abcd_abcd_slr_sud_srot"))).addForce(4, 1); ((DoubleFunction)(fs.getFunction("w4_cd_abc"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_cd_abc"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_d_abcd"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_d_abcd"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_a_abcd"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_a_abcd"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_d"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_abcd_d"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_c"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_abcd_c"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_b"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_abcd_b"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_a"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_abcd_a"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_ab_bcd"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_ab_bcd"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_ab"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_bcd_ab"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_b_abcd"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_b_abcd"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_abc_cd"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_abc_cd"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_c_abcd"))).setMinimum(5); ((DoubleFunction)(fs.getFunction("w4_c_abcd"))).addForce(5, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_abd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_bcd_abd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abd_bcd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abd_bcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_bd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abcd_bd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_abc_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_bcd_abc_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_c_ab"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_c_ab"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_bc_abcd_slr"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_bc_abcd_slr"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_bc_slr"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abcd_bc_slr"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_c_abc"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_c_abc"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_cd_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_cd_c"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_cd_b"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_cd_b"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_cd_a"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_cd_a"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_a_abcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_b_b_sud"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_b_b_sud"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_c_abcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_a_bcd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_a_bcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_ab_abcd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_ab_abcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_d"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_a_d_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_a_d_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_cd_abcd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_cd_abcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_c"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_bd_abcd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_bd_abcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_b"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_a"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_ad_slr"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abcd_ad_slr"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_c_b_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_c_b_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_ac"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abcd_ac"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_ab"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abcd_ab"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_c_cd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_c_cd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abc_acd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abc_acd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_a_a_sud"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_a_a_sud"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_cd_abc"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abc_bcd_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abc_bcd_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_d_ab"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_d_ab"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abc_cd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_ab_bcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_ab_d"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_ab_d"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_ab_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_ab_c"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_ab_b"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_ab_b"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_d_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_d_c"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_d_b"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_d_b"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_a_cd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_a_cd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abc_d"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abc_d"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abc_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abc_c"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_b_ab"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_b_ab"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_c_d"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_c_d"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_d_d_sud"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_d_d_sud"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_ab_cd_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_ab_cd_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_b"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_bcd_b"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_c_a"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_c_a"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_a"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_bcd_a"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_b_abcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_cd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_abcd_cd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_d_abcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_ac_abcd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_ac_abcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_b_d"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_b_d"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_b_c_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_b_c_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_b_a"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_b_a"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_ad_abcd_slr"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_ad_abcd_slr"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_ab"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_d_abc"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_d_abc"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_cd_ab_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_cd_ab_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_a_c"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_a_c"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_a_b"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_a_b"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_c_c_sud"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_c_c_sud"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_d_a_srot"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_d_a_srot"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_b_bcd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_b_bcd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_b_cd"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_b_cd"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_acd_abc"))).setMinimum(6); ((DoubleFunction)(fs.getFunction("w4_acd_abc"))).addForce(6, 1); ((DoubleFunction)(fs.getFunction("w4_a_cd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_b_cd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_d_bcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_bcd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_cd"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_c_cd"))).addForce(7, 3); ((DoubleFunction)(fs.getFunction("w4_d_cd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_cd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bcd_d"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bcd_c"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_ab"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_bcd_b"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_bcd_a"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_a_bd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_bd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_a_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_d_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_d"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_abc_abcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abc_abcd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_d_c"))).addForce(7, 3); ((DoubleFunction)(fs.getFunction("w4_abcd_bcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abcd_bcd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_d_b"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_d_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_a"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_b_bd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_bd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_acd_abcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_acd_abcd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_a_abcd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_c_d"))).addForce(7, 3); ((DoubleFunction)(fs.getFunction("w4_c_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_c"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_abcd_acd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abcd_acd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_c_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_b"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_abcd_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abcd_bc"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_c_bd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_bd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_c_a"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_c_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_c_bcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_bcd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_d_abd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_abd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_d"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_d_abc"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_b_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_c"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_d_bd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_bd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_b"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_d_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_a"))).addForce(7, 3); ((DoubleFunction)(fs.getFunction("w4_c_acd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_acd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_a_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_d"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_abd_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abd_d"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_a_c"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_abd_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abd_c"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_d"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_a_b"))).addForce(7, 3); ((DoubleFunction)(fs.getFunction("w4_abd_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abd_b"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_c"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_a_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_a"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_abcd_b"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_abcd_a"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_cd_cd_sud"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_cd_cd_sud"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_acd_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_acd_c"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abc_d"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_acd_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_acd_b"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abc_c"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_abc_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abc_b"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_acd_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_acd_a"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abc_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abc_a"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_a_ad"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_ad"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abd_abcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abd_abcd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_a_ac"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_a_ab"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_ab"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_ad"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_ad"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_ac"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_abcd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_b_ab"))).addForce(7, 3); ((DoubleFunction)(fs.getFunction("w4_abcd_abd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abcd_abd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_c_ad"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_ad"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_abc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abcd_abc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_c_ac"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abcd_ab"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_c_ab"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_d_ad"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_ad"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_d_ac"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_d_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_bcd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_d_ab"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_c_abd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_c_abd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_c_abc"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_b_acd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_acd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ab_ab_sud"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ab_ab_sud"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ad_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ad_d"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ad_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ad_c"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ad_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ad_b"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ad_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ad_a"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_c_abcd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_bd_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bd_d"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bd_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bd_c"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ac_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ac_d"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bd_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bd_b"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ac_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ac_c"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ac_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ac_b"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bd_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bd_a"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bc_abcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_abcd"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_ac_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ac_a"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_cd_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_cd_d"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bc_bcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_bcd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_cd_c"))).addForce(7, 3); ((DoubleFunction)(fs.getFunction("w4_bc_d"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_d"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_cd_b"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_bc_c"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_c"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ab_d"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_ab_c"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_bc_b"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_b"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_cd_a"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_ab_b"))).addForce(7, 3); ((DoubleFunction)(fs.getFunction("w4_bc_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_a"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_cd_abcd"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_ab_a"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ab_a"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ab_bcd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_a_bcd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_b_abd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_abd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bc_cd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_cd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_b_abc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_b_abc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_cd_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_cd_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ab_abcd"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_a_acd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_acd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_abcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bcd_abcd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_d_abcd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_cd_abc"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_bcd_abc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bcd_abc"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_bc_abc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_abc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ab_cd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ab_cd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_cd_ac"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_cd_ac"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abc_cd"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_cd_ab"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_cd_ab"))).addForce(7, 4); ((DoubleFunction)(fs.getFunction("w4_ac_cd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ac_cd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_a_abc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_a_abc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abc_bcd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abc_bcd"))).addForce(7, 2); ((DoubleFunction)(fs.getFunction("w4_ab_bd"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ab_bd"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bcd_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bcd_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_ab_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_ab_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_abc_bc"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_abc_bc"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bc_ab"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bc_ab"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_bd_ab"))).setMinimum(7); ((DoubleFunction)(fs.getFunction("w4_bd_ab"))).addForce(7, 1); ((DoubleFunction)(fs.getFunction("w4_cd_bcd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bc_ad_slr"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_abc"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_ad_slr_sud_srot"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abd_a"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_cd_cd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bd_ac_srot"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abc_abc_sud"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ac_ac_sud"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ac_acd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_cd_bd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_acd_d"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bd_abd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bd_abc"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bc_bd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ac_abc"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_cd_ad"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_acd_cd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bc_ac"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_acd_bc"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bd_cd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_bcd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ab_ad"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ab_ac"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ab_ab"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_bc_slr"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_cd_acd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abc_bd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bc_acd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_acd_ac"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_acd_ab"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ab_acd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bd_bc"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_cd_abd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abc_ad"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abc_ac"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abc_ab"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bc_abd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ac_bc"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bcd_cd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ab_abd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bd_ad"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ab_abc"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abd_cd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bcd_bcd_sud"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ac_ad"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ac_ab"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bcd_bd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abd_bd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_a_abd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bd_bcd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abd_bc"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_cd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ac_bcd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bcd_ad"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bcd_ac"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_d_acd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bc_bc_slr_sud_srot"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_abd_ab"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_bd"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_bd_bd_sud"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_ac"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_ab"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ac_bd_srot"))).setMinimum(8); ((DoubleFunction)(fs.getFunction("w4_ad_acd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_ad_abcd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_ad_abd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_abd_abc"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_bd_acd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_abd_abd_sud"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_bcd_acd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_bc_bc"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_ac_abd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_bc_ad"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_acd_bd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_abc_abd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_abc_abc"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_acd_ad"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_acd_acd_sud"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_abcd_ad"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_abcd_abcd_sud"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_abd_ad"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_bcd_bcd"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_abd_ac"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_ad_bc"))).setMinimum(9); ((DoubleFunction)(fs.getFunction("w4_acd_bcd"))).setMinimum(9); } }/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.ArrayList; /** * * @author mason */ public class Call extends Term { Function f; int divisor, subtractor, preDecrement; public Call(Function f, int divisor, int subtractor) { this.f = f; this.divisor = divisor; this.subtractor = subtractor; } public Call(Function f, int preDecrement, int divisor, int subtractor) { this.f = f; this.divisor = divisor; this.subtractor = subtractor; this.preDecrement = preDecrement; } public BigInteger value(int n) { return f.value(((n - preDecrement) / divisor) - subtractor); } public BigInteger value(int n, int h) { return f.value(((n - preDecrement) / divisor) - subtractor, h); } public String toString() { String ret = f.getName(); String n = "n"; if (preDecrement > 0) n = "(n - " + preDecrement + ")"; if (divisor == 1 && subtractor == 0) ret += "(" + n + ")"; else if (divisor == 1) ret += "((" + n + ") - " + subtractor + ")"; else if (subtractor == 0) ret += "((" + n + ") / " + divisor + ")"; else ret += "(((" + n + ") / " + divisor + ") - " + subtractor + ")"; if (comment == null) return ret; return ret + " (" + comment + ")"; } public String toStringH() { return toStringH("n", "h"); } public String toStringH(String n , String h) { String ret = f.getName(); if (preDecrement > 0) n = "(n - " + preDecrement + ")"; if (divisor == 1 && subtractor == 0) ret += "(" + n + ", " + h + ")"; else if (divisor == 1) ret += "((" + n + ") - " + subtractor + ", " + h + ")"; else if (subtractor == 0) ret += "((" + n + ") / " + divisor + ", " + h + ")"; else ret += "(((" + n + ") / " + divisor + ") - " + subtractor + ", " + h + ")"; return ret; } public String dump(int n) { String coeff = "m"; if (subtractor > 0) coeff += " - " + subtractor; return f.getName() + "(" + coeff + ")" + comment; } public ArrayList getDependentFunctions(boolean goDeeper) { ArrayList ret = new ArrayList<>(); f.addToDependencies(ret); return ret; } public boolean equals(Object other) { if (!this.getClass().getCanonicalName().equals(other.getClass().getCanonicalName())) return false; Call otherCall = (Call)(other); return this.f.getName().equals(otherCall.f.getName()) && this.divisor == otherCall.divisor && this.subtractor == otherCall.subtractor && this.preDecrement == otherCall.preDecrement; } /* Function f; int divisor, subtractor, preDecrement; */ } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; /** * * @author mason */ public class Constant extends Term { BigInteger v; int vint; public Constant(int v) { this.v = BigInteger.valueOf(v); vint = v; } public BigInteger value(int n) { return v; } public BigInteger value(int n, int h) { return v; } public String toString() { return v.toString(); } public String toStringH() { return v.toString(); } public String dump(int n) { switch(vint) { case 1: return "one"; case 2: return "two"; default: return "" + vint; } } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.ArrayList; /** * * @author mason */ public class Division extends Term { Term t1, t2; public Division(Term t1, Term t2) { this.t1 = t1; this.t2 = t2; } public BigInteger value(int n) { BigInteger ret = t1.value(n); BigInteger divisor = t2.value(n); if (!ret.remainder(divisor).equals(BigInteger.ZERO)) { System.err.println(this.toString() + " cannot divide " + ret + " by " + divisor); int qq = 1 / 0; } ret = ret.divide(divisor); return ret; } public BigInteger value(int n, int h) { BigInteger ret = t1.value(n, h); BigInteger divisor = t2.value(n, h); if (!ret.remainder(divisor).equals(BigInteger.ZERO)) { System.err.println(this.toString() + " cannot divide " + ret + " by " + divisor); int qq = 1 / 0; } ret = ret.divide(divisor); return ret; } public String toString() { return t1.toString() + " / " + t2.toString(); } public String toStringH() { return t1.toStringH() + " / " + t2.toStringH(); } public String dump(int n) { return "Division"; } public ArrayList getDependentFunctions(boolean goDeeper) { ArrayList ret = new ArrayList<>(); ret.addAll(t1.getDependentFunctions(false)); ret.addAll(t2.getDependentFunctions(false)); return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.*; /** * * @author mason */ public class DoubleFunction extends GenericFunction { SingleFunction odd; SingleFunction even; public DoubleFunction(String inName) { super(inName); odd = new SingleFunction(name + "_odd"); even = new SingleFunction(name + "_even"); } public void setMinimum(int inMinimum) { //odd.setMinimum(inMinimum); //even.setMinimum(inMinimum); minimum = inMinimum; } public void setMinimum(int inMinimum, int minHeight) { //odd.setMinimum(inMinimum); //even.setMinimum(inMinimum); minimum = inMinimum; this.minHeight = minHeight; } public void addTerm(Term t, boolean isEven) { this.hasBeenDefined = true; even.hasBeenDefined = true; odd.hasBeenDefined = true; if (isEven) even.addTerm(t); else odd.addTerm(t); } public BigInteger innerValue(int n) { BigInteger ret; if (n % 2 == 0) ret = even.value(n); else ret = odd.value(n); BigInteger shouldBe = this.obligedValues.get("" + n); if (shouldBe != null) if(!shouldBe.equals(ret)) { System.err.println(this.name + "(" + n + ") should be " + shouldBe.toString() + " but = " + ret.toString()); ArrayList a; if (n % 2 == 0) a = even.dumpList(n); else a = odd.dumpList(n); Collections.sort(a); for (String s : a) { System.err.println(s); } //int qq = 1 / 0; } if (shouldBe == null && n <= 12 && !ret.equals(BigInteger.ZERO) && name.startsWith("w4") && !name.contains("+")) { System.err.println(this.name + "(" + n + ") should be zero but = " + ret.toString()); if (n % 2 == 0) ret = even.debugValue(n); else ret = odd.debugValue(n); int qq = 1 / 0; } return ret; } public BigInteger innerValue(int n, int h) { BigInteger ret; if (n % 2 == 0) ret = even.value(n, h); else ret = odd.value(n, h); BigInteger shouldBe = this.obligedValues.get(n + " " + h); if (shouldBe != null) if(!shouldBe.equals(ret)) { System.err.println(this.name + "(" + n + ", " + h + ") should be " + shouldBe.toString() + " but = " + ret.toString()); ArrayList a = even.dumpList(n, h); Collections.sort(a); for (String s : a) { System.err.println(s); } int qq = 1 / 0; } if (shouldBe == null && n <= 12 && !ret.equals(BigInteger.ZERO) && name.startsWith("w4")) { System.err.println(this.name + "(" + n + ", " + h + ") should be zero but = " + ret.toString()); if (n % 2 == 0) ret = even.debugValue(n); else ret = odd.debugValue(n); int qq = 1 / 0; } return ret; } public BigInteger debugValue(int n) { BigInteger ret; if (n < minimum) return BigInteger.ZERO; for (Force force : forceList) { if (force.defined && n == force.getN()) { return force.getV(); } } if (n % 2 == 0) ret = even.debugValue(n); else ret = odd.debugValue(n); return ret; } public String toString() { String ret = name + "(n)" ; return ret; } public String toStringH() { String ret = name + "(n, h)" ; return ret; } public String toStringH(String n, String h) { String ret = name + "(" + n + ", " + h + ")" ; return ret; } public String expression() { String ret = name + "(n) = " ; for (Force force : forceList) { if (!force.defined) continue; if (force.hDefined) continue; ret += force.toString(); } if (minimum > 0) ret += "if n < " + minimum + " then 0\r\n"; ret += "if n is even then " + even.getName() + "(n)\r\n"; ret += "if n is odd then " + odd.getName() + "(n)\r\n"; ret += even.expression() + "\r\n"; ret += odd.expression() + "\r\n"; return ret + "\r\n" ; } public String expressionH() { String ret = name + "(n, h) = " ; for (Force force : forceList) { if (!force.defined) continue; if (!force.hDefined) continue; ret += force.toStringH(); } if (minimum > 0) ret += "if n < " + minimum + " then 0\r\n"; ret += "if n is even then " + even.getName() + "(n, h)\r\n"; ret += "if n is odd then " + odd.getName() + "(n, h)\r\n"; ret += even.expressionH() + "\r\n"; ret += odd.expressionH() + "\r\n"; return ret; } public String dump(int n) { String ret = name + "(" + n + ") = " + value(n) + "\r\n"; if (n % 2 == 0) ret += even.dump(n); else ret += odd.dump(n); return ret; } public ArrayList getDependentFunctions(boolean goDeeper) { if (!goDeeper) { ArrayList list = new ArrayList<>(); list.add(this); return list; } ArrayList ret1 = even.getDependentFunctions(goDeeper); ArrayList ret2 = odd.getDependentFunctions(goDeeper); ret1.addAll(ret2); return ret1; } public void optimise() { even.optimise(); odd.optimise(); } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public class DoubleLoopW1Higher extends GenericSumLoop { public DoubleLoopW1Higher(String inName) { super(inName); this.hasBeenDefined = true; } public BigInteger innerValue(int n) { /* For hw1 = 2 hw1 < n; hw1++ For hw2 = 1 hw2 < hw1 ; hw2++ Tot += w2_x_y.value(n – hw1, hw2) */ BigInteger ret = BigInteger.ZERO; for (int hw1 = 2; hw1 < n; hw1++) { for (int hw2 = 1; hw2 < hw1; hw2++) { ret = ret.add(sum.value(n - hw1, hw2)); } } return ret; } public BigInteger innerValue(int n, int h) { Runner.notImplemented(this.getClass().getSimpleName()); return null; } public String expression() { String ret = this.name + "(n) = sum of\r\n" ; ret += " for hw1 = 2 hw1 < n; hw1++\r\n" + " for hw2 = 1 hw2 < hw1 ; hw2++\r\n" + " inner sum(n - hw1, hw2)\r\n"; ret += " where inner sum(n, h) = \r\n"; ret += sum.expressionH(); return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public class DoubleLoopW1Lower extends GenericSumLoop { public DoubleLoopW1Lower(String inName) { super(inName); this.hasBeenDefined = true; } public BigInteger innerValue(int n) { BigInteger ret = null; /* For hw2 = 1; hw2 < n - 1; hw2++ For hw1 = 1 hw1 < hw2 ; hw1++ Tot += w2_x_y.value(n – hw1, hw2) */ ret = BigInteger.ZERO; for (int hw2 = 1; hw2 < n; hw2++) { for (int hw1 = 1; hw1 < hw2; hw1++) { ret = ret.add(sum.value(n - hw1, hw2)); } } return ret; } public String dump(int n) { String ret = name + "(n) = "; /* For hw2 = 1; hw2 < n - 1; hw2++ For hw1 = 1 hw1 < hw2 ; hw1++ Tot += w2_x_y.value(n – hw1, hw2) */ for (int hw2 = 1; hw2 < n; hw2++) { for (int hw1 = 1; hw1 < hw2; hw1++) { BigInteger v = sum.value(n - hw1, hw2); if (!v.equals(BigInteger.ZERO)) { ret += sum.expressionH() + " n=" + (n - hw1) + " h=" + hw2 + " v=" + v + "\r\n"; ret += sum.dump(n - hw1, hw2); } } } return ret; } public BigInteger innerValue(int n, int h) { Runner.notImplemented(this.getClass().getSimpleName()); return null; } public String expression() { String ret = this.name + "(n) = sum of\r\n" ; ret += "For hw2 = 1; hw2 < n - 1; hw2++\r\n" + "For hw1 = 1 hw1 < hw2 ; hw1++\r\n" + "inner sum(n - hw1, hw2)\r\n"; ret += "where inner sum(n, h) = \r\n"; ret += sum.expressionH(); return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; /** * * @author mason */ public class Force { int n, h; BigInteger v; boolean defined, hDefined; public Force(int n, int v) { this.n = n; this.v = BigInteger.valueOf(v); this.defined = true; } public Force(int n, int h, int v) { this.n = n; this.h = h; this.v = BigInteger.valueOf(v); this.defined = true; hDefined = true; } public Force(int n, BigInteger v) { this.n = n; this.v = v; } public Force(int n, int h, BigInteger v) { this.n = n; this.v = v; this.h = h; hDefined = true; } public int getN() { return n; } public BigInteger getV() { return v; } public int getH() { return h; } public String toString() { if (defined) return "if n = " + n + " then " + v + "\r\n"; else return ""; } public String toStringH() { if (defined) return "if n = " + n + " and h = " + h + " then " + v + "\r\n"; else return ""; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; /** * * @author mason */ public abstract class Function extends Term { String name; boolean hasBeenDefined; Function(String inName) { super(); name = inName; } public String getName() { return name; } public void addToDependencies(ArrayList list) { } public Call call(int divisor, int subtractor) { return new Call(this, divisor, subtractor); } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; /** * * @author mason */ public class FunctionPair { GenericFunction left, right; public FunctionPair(GenericFunction left, GenericFunction right) { this.left = left; this.right = right; } public GenericFunction getLeft() { return left; } public GenericFunction getRight() { return right; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.*; /** * * @author mason */ public class FunctionSet { Hashtable h; public FunctionSet() { h = new Hashtable<>(); } public void add(Function f) { h.put(f.getName(), f); } public void add(Function f, String alias) { h.put(alias, f); } public Function getFunction(String s) { Function f = h.get(s); if (f == null) { System.err.println("getFunction: missing " + s); int qq = 1 / 0; System.exit(1); } return f; } public Set> getScanner() { return h.entrySet(); } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.*; /** * * @author mason */ public abstract class GenericFunction extends Function { Hashtable obligedValues; ArrayList forceList; int minimum, minHeight; boolean exludeFromList; BigInteger hard, soft; public int debug = 0; public GenericFunction(String inName) { super(inName); forceList = new ArrayList<>(); obligedValues = new Hashtable<>(); } public void addForce(int n, int v){ forceList.add(new Force(n, v)); } public void shouldBe(int n, int v) { obligedValues.put("" + n, BigInteger.valueOf(v)); } public void addForce(int n, int h, int v){ forceList.add(new Force(n, h, v)); } public void shouldBe(int n, int h, int v) { obligedValues.put(n + " " + h, BigInteger.valueOf(v)); } public void addToDependencies(ArrayList list) { list.add(this); } public void setMinimum(int inMinimum) { minimum = inMinimum; } public void setMinimum(int inMinimum, int minHeight) { //odd.setMinimum(inMinimum); //even.setMinimum(inMinimum); minimum = inMinimum; this.minHeight = minHeight; } public void addForce(int n, BigInteger v) { forceList.add(new Force(n, v)); this.hasBeenDefined = true; } public void addForce(int n, int h, BigInteger v) { forceList.add(new Force(n, h, v)); this.hasBeenDefined = true; } public final BigInteger value(int n) { if (this.hasBeenDefined != true) { System.err.println(name + " has not been defined"); int qq = 1 / 0; } if (n > 0 && n == debug) { int dbg = 1; } BigInteger ret = null; if (n == 0) { ret = BigInteger.ZERO; } if (ret == null) for (Force force : forceList) { if (force.hDefined) continue; if (n == force.getN()) { ret = force.getV(); break; } } if (ret == null && n < minimum) ret = BigInteger.ZERO; if (ret == null && hard != null) ret = hard; if (ret == null) { ret = innerValue(n); if (ret.compareTo(BigInteger.ZERO) < 0) { ret = innerValue(n); int qq = 1 / 0; } addForce(n, ret); } if (name.equals("w3_lc_cr") && n == 4) { int dbg = 1; } return ret; } public final BigInteger value(int n, int h) { BigInteger ret = null; for (Force force : forceList) { if (!force.hDefined) continue; if (n == force.getN() && h == force.getH()) { ret = force.getV(); break; } } if (ret == null && n < minimum) ret = BigInteger.ZERO; if (h < minHeight) return BigInteger.ZERO; if (ret == null && soft != null) { if (n == h) ret = hard; else ret = BigInteger.ZERO; } if (ret == null) { ret = innerValue(n, h); addForce(n, h, ret); } return ret; } abstract BigInteger innerValue(int n) ; abstract BigInteger innerValue(int n, int h) ; public void exclude() { this.exludeFromList = true; } public boolean isExcluded() { return this.exludeFromList; } public void optimise() { // noop } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public abstract class GenericLoop extends GenericFunction { public GenericLoop(String inName) { super(inName); } public void setMinimum(int inMinimum) { minimum = inMinimum; } public void setMinimum(int inMinimum, int minHeight) { //odd.setMinimum(inMinimum); //even.setMinimum(inMinimum); minimum = inMinimum; this.minHeight = minHeight; } public void addForce(int n, BigInteger v) { forceList.add(new Force(n, v)); } public void addForce(int n, int h, BigInteger v) { forceList.add(new Force(n, h, v)); } public void setHard(int v) { hard = BigInteger.valueOf(v); } public void setSoft(int v) { soft = BigInteger.valueOf(v); } public BigInteger innerValue(int n, int h) { Runner.notImplemented(this.getClass().getSimpleName() + ".value(n, h)"); return null; } public BigInteger debugValue(int n) { BigInteger ret = null; return ret; } public String toString() { String ret = name + "(n)"; return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public abstract class GenericSumLoop extends GenericFunction { Sum sum; public GenericSumLoop(String inName) { super(inName); sum = new Sum(); } public void addTerm(Term t) { sum.addTerm(t); } public String dump(int n) { return sum.dump(n); } public ArrayList dumpList(int n) { return sum.dumpList(n); } public ArrayList getDependentFunctions(boolean goDeeper) { if (!goDeeper) { ArrayList list = new ArrayList<>(); list.add(this); return list; } return sum.getDependentFunctions(false); } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.ArrayList; /** * * @author mason */ public class HeightCall extends Call { int rowHeight; public HeightCall(Function f, int divisor, int subtractor, int rowHeight) { super(f, divisor, subtractor); this.rowHeight = rowHeight; } public BigInteger value(int n, int h) { h -= rowHeight; if (h % 2 != 0) return BigInteger.ZERO; BigInteger ret = f.value(((n - preDecrement) / divisor) - subtractor, h / 2); return ret; } public String toStringH() { String ret = f.getName(); String n = "n"; if (preDecrement > 0) n = "(n - " + preDecrement + ")"; if (divisor == 1 && subtractor == 0) ret += "(" + n + ", h - " + rowHeight + ")"; else if (divisor == 1) ret += "((" + n + ") - " + subtractor + ", h - " + rowHeight + ")"; else if (subtractor == 0) ret += "((" + n + ") / " + divisor + ", h - " + rowHeight + ")"; else ret += "(((" + n + ") / " + divisor + ") - " + subtractor + ", h - " + rowHeight + ")"; return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.ArrayList; /** * * @author mason */ public class HeightProduct extends Product { int rowHeight; public HeightProduct(Term t1, Term t2, int rowHeight, int subtract) { super(t1, t2, subtract); if (this.t1 == null) { int qq = 1 / 0; } this.rowHeight = rowHeight; } public BigInteger value(int n, int h) { BigInteger ret = BigInteger.ZERO; h -= rowHeight; for (int i = 1; i < h; i++) { BigInteger v1 = t1.value(n, i); BigInteger v2 = t2.value(n, h - i); if (i == h - i) v2 = v2.subtract(subtract); ret = ret.add(v1.multiply(v2)); } return ret; } public String toStringH() { String ret = "for i = 1 thru h - 1 sum of " + t1.toStringH("n", "i") + " * " + t2.toStringH("n", "h - i"); return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; /** * * @author mason */ public abstract class Loop extends GenericFunction { Function base; int firstDecrement, limit, loopDecrement; public Loop(String inName, Function base, int firstDecrement, int limit, int loopDecrement) { super(inName); this.base = base; this.firstDecrement = firstDecrement; this.limit=limit; this.loopDecrement = loopDecrement; this.hasBeenDefined = true; } public BigInteger innerValue(int n) { BigInteger ret = BigInteger.ZERO; for (int i = n - firstDecrement; i >= limit; i -= loopDecrement) ret = ret.add(base.value(i)); return ret; } public BigInteger innerValue(int n, int h) { BigInteger ret = BigInteger.ZERO; for (int i = n - firstDecrement; i >= limit; i -= loopDecrement) ret = ret.add(base.value(i)); return ret; } public String toString() { return "sum(" + base.getName() + "(i)) for i = n - " + firstDecrement + ", i >= " + limit + ", i -= " + loopDecrement; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.ArrayList; /** * * @author mason */ public class Product extends Term { Term t1, t2; BigInteger subtract; String row; public Product(Term t1, Term t2) { this.t1 = t1; this.t2 = t2; subtract = BigInteger.ZERO; termCount++; } public Product(Term t1, Term t2, int x) { this.t1 = t1; this.t2 = t2; subtract = BigInteger.valueOf(x); termCount++; } public void setRow(String row) { this.row = row; } public BigInteger value(int n) { BigInteger v1 = t1.value(n); BigInteger v2 = t2.value(n); v2 = v2.subtract(subtract); BigInteger ret = v1.multiply(v2); return ret; } public BigInteger value(int n, int h) { BigInteger ret = t1.value(n, h); ret = ret.multiply(t2.value(n, h).subtract(subtract)); return ret; } public String toString() { String ret = t1.toString(); String s = t2.toString(); if (!s.equals("1")) ret += " * " + s; if (!subtract.equals(BigInteger.ZERO)) ret = "(" + ret + " - " + subtract + ")"; if (row != null) ret += " (row = " + row + ")"; if (comment != null) ret += " (" + comment + ")"; return ret; } public String toStringH() { String ret = t1.toStringH(); String s = t2.toStringH(); if (!s.equals("1")) ret += " * " + s; if (!subtract.equals(BigInteger.ZERO)) ret = "(" + ret + " - " + subtract + ")"; return ret; } public String dump(int n) { String ret = "prod(" + t1.dump(n) + ", " + t2.dump(n); ret += ") "; ret += value(n); ret += " " + comment; return ret; } public ArrayList getDependentFunctions(boolean goDeeper) { ArrayList ret = new ArrayList<>(); ret.addAll(t1.getDependentFunctions(false)); ret.addAll(t2.getDependentFunctions(false)); return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; /** * * @author mason */ public class SingleFunction extends GenericFunction { Sum sum; boolean fun_n, fun_one_if_even; public SingleFunction(String inName) { super(inName); sum = new Sum(); } public void setFunN() { fun_n = true; this.hasBeenDefined = true; } public void setOneIfEven() { fun_one_if_even = true; this.hasBeenDefined = true; } public void addTerm(Term t) { sum.addTerm(t); this.hasBeenDefined = true; } public void setHard(int v) { hard = BigInteger.valueOf(v); this.hasBeenDefined = true; } public void setSoft(int v) { soft = BigInteger.valueOf(v); this.hasBeenDefined = true; } public BigInteger innerValue(int n) { BigInteger ret = null; if (ret == null && fun_n) ret = BigInteger.valueOf(n); if (ret == null && fun_one_if_even) { if (n > 0 && n % 2 == 0) ret = BigInteger.ONE; else ret = BigInteger.ZERO; } if (ret == null) { ret = sum.value(n); } return ret; } public BigInteger innerValue(int n, int h) { BigInteger ret = sum.value(n, h); return ret; } public BigInteger debugValue(int n) { BigInteger ret = null; for (Force force : forceList) { if (force.defined && n == force.getN()) { ret = force.getV(); break; } } if (ret == null && n < minimum) ret = BigInteger.ZERO; if (ret == null && hard != null) ret = hard; if (ret == null) { ret = sum.value(n); System.err.println(name + "(" + n + ") = " + ret); ret = sum.debugValue(n); } return ret; } public String toString() { String ret = name + "(n)"; return ret; } public String toStringH() { String ret = name + "(n, h)"; return ret; } public String expression() { boolean b = false; String ret = name + "(n) = \r\n" ; for (Force force : forceList) { if (!force.defined) continue; if (force.hDefined) continue; ret += force.toString(); b = true; } if (minimum > 0) { ret += "if n < " + minimum + " then 0\r\n"; b = true; } if (this.fun_n) { if (b) { ret += "otherwise " + name + "(n) = n\r\n"; } else { ret = name + "(n) = n\r\n"; } return ret; } if (this.fun_one_if_even) { if (b) { ret += "otherwise " + name + "(n) = 1 if n even\r\n"; } else { ret = name + "(n) = 1 if n even\r\n"; } return ret; } if (hard != null) { if (b) { ret += "otherwise " + name + "(n) = " + hard + "\r\n"; } else { ret = name + "(n) = " + hard + "\r\n"; } } else { if (b) ret += "Otherwise:\r\n"; ret = ret + sum.expression(); } return ret + "\r\n"; } public String expressionH() { boolean b = false; String ret = name + "(n, h) = \r\n" ; for (Force force : forceList) { if (!force.defined) continue; if (!force.hDefined) continue; ret += force.toString(); b = true; } if (minimum > 0) { ret += "if n < " + minimum + " then 0\r\n"; b = true; } if (hard != null) { if (b) { ret += "otherwise " + name + "(n) = " + hard + "\r\n"; } else { ret = name + "(n) = " + hard + "\r\n"; } } else { if (b) ret += "Otherwise:\r\n"; ret = ret + sum.expressionH(); } return ret; } public String dump(int n) { return sum.dump(n); } public ArrayList dumpList(int n) { return sum.dumpList(n); } public ArrayList dumpList(int n, int h) { return sum.dumpList(n, h); } public ArrayList getDependentFunctions(boolean goDeeper) { if (!goDeeper) { ArrayList list = new ArrayList<>(); list.add(this); return list; } return sum.getDependentFunctions(false); } public void optimise() { sum.optimise(); } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public class SingleLoop extends GenericSumLoop { public SingleLoop(String inName) { super(inName); this.hasBeenDefined = true; } public BigInteger innerValue(int n) { BigInteger ret = BigInteger.ZERO; if (name.equals("2p-w1-w2_acd_acd")) { int dbg = 1; } for (int hw1 = 1; hw1 < n; hw1++) { ret = ret.add(sum.value(n - hw1, hw1)); } return ret; } public String dump(int n) { String ret = name + "(n, h) = "; if (name.equals("2p-w1-w2_acd_acd")) { int dbg = 1; } for (int hw1 = 1; hw1 < n; hw1++) { ret += (sum.dump(n - hw1, hw1)); } return ret; } public BigInteger innerValue(int n, int h) { Runner.notImplemented(this.getClass().getSimpleName()); return null; } public String expression() { String ret = this.name + "(n) = sum of\r\n" ; ret += "For hw1 = 2 hw1 < n; hw1++\r\n" + "inner sum(n – hw1, hw1)\r\n"; ret += "where inner sum(n) = \r\n"; ret += sum.expression(); return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.ArrayList; /** * * @author mason */ public class Subtraction extends Term { Term t1, t2; public Subtraction(Term t1, Term t2) { this.t1 = t1; this.t2 = t2; } public BigInteger value(int n) { BigInteger ret = t1.value(n); ret = ret.subtract(t2.value(n)); return ret; } public BigInteger value(int n, int h) { BigInteger ret = t1.value(n, h); ret = ret.subtract(t2.value(n, h)); return ret; } public String expression() { return t1.toString() + " - " + t2.toString(); } public String toString() { return "(" + t1.toString() + "(n) - " + t2.toString() + "(n))"; } public String toStringH() { return "(" + t1.toString() + "(n, h) - " + t2.toString() + "(n, h))"; } public String dump(int n) { return t1.dump(n) + ".subtract(" + t2.dump(n) + ")"; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.*; import java.math.BigInteger; /** * * @author mason */ public class Sum extends Term { ArrayList array; public Sum() { array = new ArrayList<>(); } public void addTerm(Term t) { array.add(t); } public BigInteger value(int n) { BigInteger ret = BigInteger.ZERO; for (Term t : array) { BigInteger tmp = t.value(n); if (tmp.compareTo(BigInteger.ZERO) < 0) { tmp = t.value(n); //int qq = 1 / 0; } ret = ret.add(tmp); } return ret; } public BigInteger value(int n, int h) { BigInteger ret = BigInteger.ZERO; for (Term t : array) ret = ret.add(t.value(n, h)); return ret; } public BigInteger debugValue(int n) { BigInteger ret = BigInteger.ZERO; for (Term t : array) { BigInteger tmp = t.value(n); if (!tmp.equals(BigInteger.ZERO)) { System.err.println(t.toString() + "(" + n + ") = " + tmp); tmp = t.value(n); } ret = ret.add(tmp); } return ret; } public String expression() { if (array.size() == 0) return "(null)"; String ret = " " + array.get(0).toString(); for (int i = 1; i < array.size(); i++) { Term t = array.get(i); String comment = ""; //if (t.comment != null) // comment = " (" + t.comment + ")"; ret += "\r\n + " + t.toString() + comment; } return ret; } public String expressionH() { if (array.size() == 0) return "(null)"; String ret = " " + array.get(0).toStringH(); for (int i = 1; i < array.size(); i++) ret += "\r\n + " + array.get(i).toStringH(); return ret; } public String toString() { return "sum"; } public String dump(int n) { String ret = ""; for (Term t : array) { BigInteger v = t.value(n); if (!v.equals(BigInteger.ZERO)) { //ret += (t).dump(n) + "\r\n"; ret += t.toString() + " = " + v + "\r\n"; } } return ret; } public String dump(int n, int h) { String ret = ""; for (Term t : array) { BigInteger v = t.value(n, h); if (!v.equals(BigInteger.ZERO)) { //ret += (t).dump(n) + "\r\n"; ret += t.toStringH() + " = " + v + "\r\n"; } } return ret; } public ArrayList dumpList(int n) { ArrayList ret = new ArrayList<>(); for (Term t : array) { BigInteger v = t.value(n); if (!v.equals(BigInteger.ZERO)) { for (int i = 0; i < v.intValue(); i++) { String s = (t).dump(n); s += " (" + t.comment + ")"; ret.add(s); } } } return ret; } public ArrayList dumpList(int n, int h) { ArrayList ret = new ArrayList<>(); for (Term t : array) { BigInteger v = t.value(n, h); if (!v.equals(BigInteger.ZERO)) { String s = t.toStringH() + "(" + n + ", " + h + ") = " + v; if (t.comment != null) { s += " (" + t.comment + ")"; } ret.add(s); } } return ret; } public ArrayList getDependentFunctions(boolean goDeeper) { ArrayList ret = new ArrayList<>(); for (Term t : array) ret.addAll(t.getDependentFunctions(false)); return ret; } public void optimise() { for (int i = 0; i < array.size(); i++) { optimise(i); } } void optimise(int n) { int count = 1; for (int i = array.size() - 1; i > n; i--) { if (array.get(i).equals(array.get(n))) { count++; array.remove(i); } } if (count > 1) { array.set(n, new Product(array.get(n), new Constant(count))); } } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; import java.util.*; import polyutil.Runner; /** * * @author mason */ public abstract class Term { public String comment; public static int termCount ; public abstract BigInteger value(int n); public abstract BigInteger value(int n, int h); public abstract String dump(int n); public Term() { } public ArrayList getDependentFunctions(boolean goDeeper) { return new ArrayList(); } public String expression() { return toString(); } public String expressionH() { return toStringH(); } public String toStringH() { Runner.notImplemented(this.getClass().getSimpleName() + ".toStringH"); return null; } public String toStringH(String n, String h) { Runner.notImplemented(this.getClass().getSimpleName() + ".toStringH"); return null; } //public void addToDependencies(ArrayList list) { } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public class W1W2Loop extends GenericLoop { Function right; public W1W2Loop(String name, Function right) { super(name); this.right = right; this.hasBeenDefined = true; } public BigInteger innerValue(int n) { BigInteger ret = BigInteger.ZERO; for (int w1Size = 1; w1Size <= n - 2; w1Size++) { int w2Size = n - w1Size; BigInteger v1 = right.value(w2Size, w1Size); ret = ret.add(v1); } return ret; } public String dump(int n) { Runner.notImplemented(this.getClass().getSimpleName() + " dump"); return null; } public String toString() { String ret = "sum of " + right.getName() + "(i, h) for h = 1 thru n-2 and i = n - h"; return ret; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; /** * * @author mason */ public class W2Loop extends Loop { public W2Loop(String inName, Function base) { super(inName, base, 1,2,2); } public String dump(int n) { return "w2loop"; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; /** * * @author mason */ public class W3Loop extends Loop { public W3Loop(String inName, Function base) { super(inName, base, 2,3,2); } public String dump(int n) { return "w3loop"; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public class W4Case_ix_loop extends GenericLoop { Function left, right; public W4Case_ix_loop(String name, Function left, Function right) { super(name); this.left = left; this.right = right; this.hasBeenDefined = true; } public BigInteger innerValue(int n) { BigInteger ret = BigInteger.ZERO; for (int w2w2Size = 4; w2w2Size <= n - 2; w2w2Size++) { // case xv needs 2 BigInteger v1 = left.value( w2w2Size); int w3Size = n - w2w2Size; BigInteger v2 = right.value(w3Size); ret = ret.add(v1.multiply(v2)); } return ret; } public String dump(int n) { Runner.notImplemented(this.getClass().getSimpleName() + " dump"); return null; } public String toString() { return "sum of \r\n for w2 = 4 thru n - 2\r\n " + left.name + "(w2) * " + right.name + "(n - w2)"; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public class W4Case_vi_loop extends GenericLoop { Function left, right; public W4Case_vi_loop(String name, Function left, Function right) { super(name); this.left = left; this.right = right; this.hasBeenDefined = true; } public BigInteger innerValue(int n) { BigInteger ret = BigInteger.ZERO; for (int w1Size = 1; w1Size <= n - 4; w1Size++) { for (int w2Size = 2; w2Size <= n - 3; w2Size++) { BigInteger v1 = left.value(w2Size, w1Size); int w3Size = n - w2Size - w1Size; BigInteger v2 = right.value(w3Size); ret = ret.add(v1.multiply(v2)); } } return ret; } public String dump(int n) { Runner.notImplemented(this.getClass().getSimpleName() + " dump"); return null; } public String toString() { return "sum of\r\n for w1 = 1 thru n - 4\r\n for w2 = 2 thru n - 3\r\n" + " " + left.name + "(w2, w1) * " + right.name + "(n - w2 - w1)"; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.util.ArrayList; import java.math.BigInteger; import polyutil.Runner; /** * * @author mason */ public class W4Case_xviii_loop extends GenericLoop { Function left; public W4Case_xviii_loop(String name, Function left) { super(name); this.left = left; this.hasBeenDefined = true; } public BigInteger innerValue(int n) { BigInteger ret = BigInteger.ZERO; for (int w2w2Size = 4; w2w2Size <= n - 1; w2w2Size++) { // case xv needs 2 BigInteger v1 = left.value( w2w2Size); ret = ret.add(v1); } return ret; } public String dump(int n) { Runner.notImplemented(this.getClass().getSimpleName() + " dump"); return null; } public String toString() { return "sum of " + left.name + "(i) for i = 4 thru n - 1" ; } } /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package polyutil.functions; import java.math.BigInteger; /** * * @author mason */ public class W4Loop extends Loop { public W4Loop(String inName, Function base) { super(inName, base, 2,2,2); } public String dump(int n) { return "w4loop"; } }