0

I am using the IBM cplex optimizer to solve a MIP model. What I want is cplex to log not to console, but to a .txt file. I found a method that mentions this here: http://yalma.fime.uanl.mx/cplex11-manual/refdotnetcplex/html/ILOG.CPLEX.Cplex.SetOut.html

Cplex.SetOut(TextWriter s)

But when I call the method like this, the text file remains empty:

public Cplex Model= new Cplex();    
TextWriter TWoutput = File.CreateText("RunOutput.txt"));
//Add variables, constraints and solve the model
Model.SetOut(TWoutput);

I can't find how am i supposed to use this method. I am new to c# and cplex so please explain as simple as you can :)

rrh
  • 105
  • 1
  • 2
  • 8

1 Answers1

1

Just a quick check, but you are calling SetOut() before you build and solve the model aren't you? If you are calling it after you have run Cplex (as might be inferred from the comment) then it wouldn´t be surprising that the file would be empty.

creyD
  • 1,972
  • 3
  • 26
  • 55
TimChippingtonDerrick
  • 2,042
  • 1
  • 12
  • 13
  • i can't believe i missed that! thanks a lot. I called before solving the model and it works. – rrh Feb 25 '14 at 09:11