Example #1
0
 CalculateValues()
 {
     Cream.Network network = new Cream.Network();
     foreach (KeyValuePair <string, Cell> kvp in _cells)
     {
         kvp.Value.Variable = new Cream.IntVariable(network, kvp.Key);
     }
     foreach (KeyValuePair <string, Cell> kvp in _cells)
     {
         CP.Semantics semantics =
             new CP.Semantics(kvp.Value, _cells, network, _spreadSheet);
         FP.Parser fp = new FP.Parser(kvp.Value.Formula, semantics);
         fp.Parse();
     }
     Cream.Solver solver = new Cream.DefaultSolver(network);
     _lastSolution = solver.FindFirst();
 }
Example #2
0
 /// <summary>
 ///   Converts the constrained cells to a CSP, and gets the solution
 ///   from the solver.
 /// </summary>
 private void CalculateValues()
 {
     Cream.Network network = new Cream.Network();
       foreach(KeyValuePair<string, Cell> kvp in _cells) {
     kvp.Value.Variable = new Cream.IntVariable(network, kvp.Key);
       }
       foreach(KeyValuePair<string, Cell> kvp in _cells) {
     CP.Semantics semantics =
       new CP.Semantics(kvp.Value, _cells, network, _spreadSheet);
     FP.Parser fp = new FP.Parser(kvp.Value.Formula, semantics);
     fp.Parse();
       }
       Cream.Solver solver = new Cream.DefaultSolver(network);
       _lastSolution = solver.FindFirst();
 }