gtrsk / or-tools

Automatically exported from code.google.com/p/or-tools
0 stars 0 forks source link

Crash if custom search monitor is created in NewSearch #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Solver solver = new Google.OrTools.ConstraintSolver.Solver("p");

// creating dummy variables
List<IntVar> vars = new List<IntVar>();
for (int i = 0; i < 200000; i++)
{
       vars.Add(solver.MakeIntVar(0, 1));
}

IntExpr globalSum = solver.MakeSum(vars.ToArray());

DecisionBuilder db = solver.MakePhase(vars.ToArray(),
                                            Google.OrTools.ConstraintSolver.Solver.INT_VAR_SIMPLE,
                                            Google.OrTools.ConstraintSolver.Solver.INT_VALUE_SIMPLE);

// works
         //   OptimizeVar obj = new OptimizeVar(solver, true, globalSum.Var(), 100);
         //   solver.NewSearch(db, obj);

// crashes
solver.NewSearch(db, new OptimizeVar(solver, true, globalSum.Var(), 100));

while (solver.NextSolution())
{
     Console.WriteLine("solution " + globalSum.Var().Value());
}
Console.WriteLine("fini");
Console.ReadLine();

Original issue reported on code.google.com by laurent....@gmail.com on 15 Jan 2013 at 10:32

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2506.

Original comment by lper...@google.com on 15 Jan 2013 at 1:31