Esempio n. 1
0
            internal SolverContext Load(string path)
            {
                var model = new CpModel();

                using (var ms = File.Open(path, Open))
                {
                    model.MergeFrom(ms);
                }

                // TODO: TBD: careful that ModelLoader is disposable...
                Assert.That(Solver.ModelLoader(), Is.Null);

                if (Monitors.Any())
                {
                    using (var vector = new SearchMonitorVector())
                    {
                        foreach (var monitor in Monitors)
                        {
                            vector.Add(monitor);
                        }

                        Assert.That(Solver.LoadModelWithSearchMonitors(model, vector), Is.True);
                    }
                }
                else
                {
                    // TODO: TBD: or s.LoadModelWithSearchMonitors; which also implies that somehow the model has been at least prepared, with variables, monitors, and/or decision builder
                    Assert.That(Solver.LoadModel(model), Is.True);
                }

                var loader = Solver.ModelLoader();

                Assert.That(loader, Is.Not.Null);

                return(this);
            }