Changeset 1817


Ignore:
Timestamp:
Nov 3, 2011 5:26:23 AM (8 years ago)
Author:
forrest
Message:

add ClpTraceDebug?

Location:
trunk/Clp/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpHelperFunctions.cpp

    r1722 r1817  
    115115     }
    116116}
     117#ifndef NDEBUG
     118#include "ClpModel.hpp"
     119#include "ClpMessage.hpp"
     120ClpModel * clpTraceModel=NULL; // Set to trap messages
     121void ClpTracePrint(std::string fileName, std::string message, int lineNumber)
     122{
     123  if (!clpTraceModel) {
     124    std::cout<<fileName<<":"<<lineNumber<<" : \'"
     125             <<message<<"\' failed."<<std::endl;       
     126  } else {
     127    char line[1000];
     128    sprintf(line,"%s: %d : \'%s\' failed.",fileName.c_str(),lineNumber,message.c_str());
     129    clpTraceModel->messageHandler()->message(CLP_GENERAL_WARNING, clpTraceModel->messages())
     130      << line
     131      << CoinMessageEol;
     132  }
     133}
     134#endif
    117135#if COIN_LONG_WORK
    118136// For long double versions
  • trunk/Clp/src/ClpHelperFunctions.hpp

    r1722 r1817  
    8282}
    8383#endif
    84 
     84/// Trace
     85#   ifdef NDEBUG
     86#      define ClpTraceDebug(expression)         {}
     87#   else
     88void ClpTracePrint(std::string fileName, std::string message, int line);
     89#      define ClpTraceDebug(expression) { \
     90       if (!(expression)) { ClpTracePrint(__FILE__,__STRING(expression),__LINE__); } \
     91  }
     92#   endif
    8593/// Following only included if ClpPdco defined
    8694#ifdef ClpPdco_H
  • trunk/Clp/src/ClpMessage.cpp

    r1729 r1817  
    110110     {CLP_GENERAL, 1000, 1, "%s"},
    111111     {CLP_GENERAL2, 1001, 2, "%s"},
     112     {CLP_GENERAL_WARNING, 3006, 1, "%s"},
    112113     {CLP_DUMMY_END, 999999, 0, ""}
    113114};
  • trunk/Clp/src/ClpMessage.hpp

    r1729 r1817  
    106106     CLP_GENERAL,
    107107     CLP_GENERAL2,
     108     CLP_GENERAL_WARNING,
    108109#ifndef NO_FATHOM_PRINT
    109110     CLP_FATHOM_STATUS,
  • trunk/Clp/src/ClpSimplexOther.cpp

    r1795 r1817  
    29702970    returnCode = reinterpret_cast<ClpSimplexDual *> (this)->startupSolve(0, NULL, 0);
    29712971    if (!returnCode) {
     2972      double saveDualBound=dualBound_;
     2973      dualBound_=CoinMax(dualBound_,1.0e15);
    29722974      swapped=true;
    29732975      double * temp;
     
    30813083        }
    30823084      }
     3085      dualBound_ = saveDualBound;
    30833086      //reinterpret_cast<ClpSimplexDual *> (this)->gutsOfDual(0, saveDuals, -1, data);
    30843087    }
     
    43914394    if (thetaCoefficientLower > 1.0e-8) {
    43924395      double currentLower = lower_[iSequence];
    4393       assert (currentSolution >= currentLower - 100.0*primalTolerance_);
     4396      ClpTraceDebug (currentSolution >= currentLower - 100.0*primalTolerance_);
    43944397      double gap=currentSolution-currentLower;
    43954398      if (thetaCoefficientLower*theta_>gap) {
     
    44014404    if (thetaCoefficientUpper < -1.0e-8) {
    44024405      double currentUpper = upper_[iSequence];
    4403       assert (currentSolution <= currentUpper + 100.0*primalTolerance_);
     4406      ClpTraceDebug (currentSolution <= currentUpper + 100.0*primalTolerance_);
    44044407      double gap=currentSolution-currentUpper; //negative
    44054408      if (thetaCoefficientUpper*theta_<gap) {
     
    44174420      double currentSolution = solution_[iSequence];
    44184421      double currentLower = lower_[iSequence];
    4419       assert (currentSolution >= currentLower - 100.0*primalTolerance_);
     4422      ClpTraceDebug (currentSolution >= currentLower - 100.0*primalTolerance_);
    44204423      double thetaCoefficient = lowerChange[iSequence];
    44214424      if (thetaCoefficient > 0.0) {
     
    44354438      double currentSolution = solution_[iSequence];
    44364439      double currentUpper = upper_[iSequence];
    4437       assert (currentSolution <= currentUpper + 100.0*primalTolerance_);
     4440      ClpTraceDebug (currentSolution <= currentUpper + 100.0*primalTolerance_);
    44384441      double thetaCoefficient = upperChange[iSequence];
    44394442      if (thetaCoefficient < 0) {
Note: See TracChangeset for help on using the changeset viewer.