yoghadj / or-tools

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

CBC Solver.EnableOutput() does not work in .NET #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here's a simple code example to reproduce the problem :

    static void Main(string[] args)
    {
        var solver = Solver.CreateSolver("IntegerProgramming", "CBC_MIXED_INTEGER_PROGRAMMING");
        var a = solver.MakeBoolVar("A");
        var b = solver.MakeBoolVar("B");
        var c = solver.MakeBoolVar("C");
        solver.Add(a + b + c == 1);
        solver.Minimize(30 * a + 10 * b + 100 * c);
        solver.EnableOutput(); // <-- useless
        solver.Solve();
        Console.WriteLine("A={0},B={1},C={2}", a.SolutionValue(), b.SolutionValue(), c.SolutionValue());
        Console.ReadLine();
    }

This simple MIP problem is correctly solved, but no solver log is printed on 
the console even if solver.EnableOutput() has been called. 

or-tools version: 2322 
Both 32 and 64 bit binaries are affected; 
Binaries downloaded from http://code.google.com/p/or-tools/downloads/list

Original issue reported on code.google.com by giunto.c...@gmail.com on 5 Nov 2012 at 6:12

GoogleCodeExporter commented 9 years ago
I noticed that the problem appears only in the Visual Studio 2010 IDE.

It seems that when you debug mixed-mode assemblies compiled in release mode in 
VS 2010 (and 2008, but is not usable in this case since target .net 4.0) the 
native calls to printf and std:cout<< are not shown in the console.

This happens only when you run the application in VS with debugger attached, 
while it works fine when you run the application with "start without debugging" 
or outside visual studio.

To sum up, you can close the issue :)

Thanks

Original comment by giunto.c...@gmail.com on 22 Feb 2013 at 9:48

GoogleCodeExporter commented 9 years ago
This is a 'feature' of visual studio 2010.

Original comment by laurent....@gmail.com on 22 Feb 2013 at 10:44