Changeset 300


Ignore:
Timestamp:
Oct 29, 2009 4:52:00 PM (10 years ago)
Author:
bjarni
Message:

Initialize MessageLogCallback?, IterationCallback? and MipNodeCallback? to NULL and check if they have been set before calling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/1.4/CoinMP/src/CoinMP.cpp

    r282 r300  
    528528        strcpy(pCoin->SolutionText, "");
    529529
     530        pCoin->MessageLogCallback = NULL;
     531        pCoin->IterationCallback = NULL;
     532        pCoin->MipNodeCallback = NULL;
     533
    530534        return (HPROB)pCoin;
    531535}
     
    11851189        va_start(pVa,FormatStr);
    11861190        vsprintf(strbuf,FormatStr,pVa);
    1187         global_pCoin->MessageLogCallback(strbuf);
     1191        if (global_pCoin->MessageLogCallback) {
     1192                global_pCoin->MessageLogCallback(strbuf);
     1193        }
    11881194        return SOLV_CALL_SUCCESS;
    11891195}
     
    12021208                }
    12031209        }
    1204         global_pCoin->IterationCallback(IterCount, ObjectValue, IsFeasible, InfeasValue);
     1210        if (global_pCoin->IterationCallback) {
     1211                global_pCoin->IterationCallback(IterCount, ObjectValue, IsFeasible, InfeasValue);
     1212        }
    12051213        return SOLV_CALL_SUCCESS;
    12061214}
     
    12131221                                   NodeCount, (IsMipImproved) ? "*" : " ", BestBound, BestObject);
    12141222        }
    1215         global_pCoin->MipNodeCallback(IterCount, NodeCount, BestBound, BestObject, IsMipImproved);
     1223        if (global_pCoin->MipNodeCallback) {
     1224                global_pCoin->MipNodeCallback(IterCount, NodeCount, BestBound, BestObject, IsMipImproved);
     1225        }
    12161226        return SOLV_CALL_SUCCESS;
    12171227}
Note: See TracChangeset for help on using the changeset viewer.