1

我希望 SCIP 可调用将所有消息打印到 stderr(将其用作 flatzinc 求解器)。我试过了

SCIP_DECL_MESSAGEWARNING(printMsg) {
  cerr << msg << flush;
}
...
      SCIP_MESSAGEHDLR* pHndl=0;
      SCIP_CALL ( SCIPmessagehdlrCreate ( &pHndl, FALSE, NULL, FALSE, printMsg, printMsg, printMsg, NULL, NULL) );

没有效果...

4

1 回答 1

1

尝试让 SCIP 了解您的消息处理程序:

  SCIP_CALL( SCIPsetMessagehdlr(scip, pHndl) );

这将使 SCIP 也捕获您的消息处理程序,因此如果您不再需要它,您可以释放它:

  SCIP_CALL( SCIPmessagehdlrRelease(&pHndl) );

这不会覆盖错误消息的处理程序,因为当还没有 SCIP 时可能必须打印这些消息。您可以通过 SCIPmessageSetErrorPrinting() 为这个处理程序设置一个处理程序。但是他们已经去了stderr。

于 2016-01-28T04:19:36.710 回答