您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CoinError函数代码示例

51自学网 2021-06-01 20:12:10
  C++
这篇教程C++ CoinError函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CoinError函数的典型用法代码示例。如果您正苦于以下问题:C++ CoinError函数的具体用法?C++ CoinError怎么用?C++ CoinError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CoinError函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getNumElements

std::set<int> *CoinPackedVectorBase::indexSet(const char* methodName,			      const char * className) const{   testedDuplicateIndex_ = true;   if ( indexSetPtr_ == NULL ) {      // create a set of the indices      indexSetPtr_ = new std::set<int>;      const int s = getNumElements();      const int * inds = getIndices();      for (int j=0; j < s; ++j) {	 if (!indexSetPtr_->insert(inds[j]).second) {	    testedDuplicateIndex_ = false;	    delete indexSetPtr_;	    indexSetPtr_ = NULL;	    if (methodName != NULL) {	       throw CoinError("Duplicate index found", methodName, className);	    } else {	       throw CoinError("Duplicate index found",			      "indexSet", "CoinPackedVectorBase");	    }	 }      }   }   return indexSetPtr_;}
开发者ID:Teino1978-Corp,项目名称:CoinUtils,代码行数:26,


示例2: CoinError

voidCoinPackedVector::truncate( int n ){   if ( n > nElements_ )       throw CoinError("n > size()","truncate","CoinPackedVector");   if ( n < 0 )       throw CoinError("n < 0","truncate","CoinPackedVector");   nElements_ = n;   clearBase();}
开发者ID:rafapaz,项目名称:FlopCpp,代码行数:10,


示例3: overlap

/** This helper function copies an array to another location. The two arrays	must not overlap (otherwise an exception is thrown). For speed 8 entries	are copied at a time. The arrays are given by pointers to their first	entries and by the size of the source array.	Note JJF - the speed claim seems to be false on IA32 so I have added	CoinMemcpyN which can be used for atomic data */template <class T> inline voidCoinDisjointCopyN(register const T* from, const int size, register T* to){#ifndef _MSC_VER    if (size == 0 || from == to)        return;#ifndef NDEBUG    if (size < 0)        throw CoinError("trying to copy negative number of entries",                        "CoinDisjointCopyN", "");#endif#if 0    /* There is no point to do this test. If to and from are from different       blocks then dist is undefined, so this can crash correct code. It's       better to trust the user that the arrays are really disjoint. */    const long dist = to - from;    if (-size < dist && dist < size)        throw CoinError("overlapping arrays", "CoinDisjointCopyN", "");#endif    for (register int n = size / 8; n > 0; --n, from += 8, to += 8) {        to[0] = from[0];        to[1] = from[1];        to[2] = from[2];        to[3] = from[3];        to[4] = from[4];        to[5] = from[5];        to[6] = from[6];        to[7] = from[7];    }    switch (size % 8) {    case 7:        to[6] = from[6];    case 6:        to[5] = from[5];    case 5:        to[4] = from[4];    case 4:        to[3] = from[3];    case 3:        to[2] = from[2];    case 2:        to[1] = from[1];    case 1:        to[0] = from[0];    case 0:        break;    }#else    CoinCopyN(from, size, to);#endif}
开发者ID:tonyju,项目名称:QuickFlow,代码行数:61,


示例4: CoinError

voidCoinIndexedVector::setElement(int index, double element){#ifndef COIN_FAST_CODE    if ( index >= nElements_ )        throw CoinError("index >= size()", "setElement", "CoinIndexedVector");    if ( index < 0 )        throw CoinError("index < 0" , "setElement", "CoinIndexedVector");#endif    elements_[indices_[index]] = element;}
开发者ID:mneumann,项目名称:ogdf,代码行数:11,


示例5: assert

/** Access the i'th element of the full storage vector.  */double &CoinIndexedVector::operator[](int index) const{    assert (!packedMode_);#ifndef COIN_FAST_CODE    if ( index >= capacity_ )        throw CoinError("index >= capacity()", "[]", "CoinIndexedVector");    if ( index < 0 )        throw CoinError("index < 0" , "[]", "CoinIndexedVector");#endif    double * where = elements_ + index;    return *where;}
开发者ID:mneumann,项目名称:ogdf,代码行数:15,


示例6: switch

CoinFileOutput *CoinFileOutput::create (const std::string &fileName,					Compression compression){  switch (compression)    {    case COMPRESS_NONE:      return new CoinPlainFileOutput (fileName);    case COMPRESS_GZIP:#ifdef COIN_HAS_ZLIB      return new CoinGzipFileOutput (fileName);#endif      break;    case COMPRESS_BZIP2:#ifdef COIN_HAS_BZLIB      return new CoinBzip2FileOutput (fileName);#endif      break;    default:      break;    }  throw CoinError ("Unsupported compression selected!",		   "create",		   "CoinFileOutput");}
开发者ID:marvin2k,项目名称:ogdf,代码行数:28,


示例7: clear

voidCoinPackedVector::assignVector(int size, int*& inds, double*& elems,                              bool testForDuplicateIndex){  clear();  // Allocate storage  if ( size != 0 ) {		  //reserve(size); //This is a BUG!!!    nElements_ = size;    if (indices_ != NULL) delete[] indices_;    indices_ = inds;    inds = NULL;    if (elements_ != NULL) delete[] elements_;    elements_ = elems;  elems = NULL;    if (origIndices_ != NULL) delete[] origIndices_;    origIndices_ = new int[size];    CoinIotaN(origIndices_, size, 0);    capacity_ = size;  }  if (testForDuplicateIndex) {    try {          CoinPackedVectorBase::setTestForDuplicateIndex(testForDuplicateIndex);    }    catch (CoinError e) {    throw CoinError("duplicate index", "assignVector",		    "CoinPackedVector");    }  } else {    setTestsOff();  }}
开发者ID:rafapaz,项目名称:FlopCpp,代码行数:30,


示例8: indexSet

voidCoinPackedVector::append(const CoinPackedVectorBase & caboose){   const int cs = caboose.getNumElements();   if (cs == 0) {       return;   }   if (testForDuplicateIndex()) {       // Just to initialize the index heap       indexSet("append (1st call)", "CoinPackedVector");   }   const int s = nElements_;   // Make sure there is enough room for the caboose   if ( capacity_ < s + cs)      reserve(CoinMax(s + cs, 2 * capacity_));   const int * cind = caboose.getIndices();   const double * celem = caboose.getElements();   CoinDisjointCopyN(cind, cs, indices_ + s);   CoinDisjointCopyN(celem, cs, elements_ + s);   CoinIotaN(origIndices_ + s, cs, s);   nElements_ += cs;   if (testForDuplicateIndex()) {      std::set<int>& is = *indexSet("append (2nd call)", "CoinPackedVector");      for (int i = 0; i < cs; ++i) {	 if (!is.insert(cind[i]).second)	    throw CoinError("duplicate index", "append", "CoinPackedVector");      }   }}
开发者ID:rafapaz,项目名称:FlopCpp,代码行数:30,


示例9: getVectorLast

    /** The position of the last element (well, one entry <em>past</em> the        last) in the i'th major-dimension vector. */    CoinBigIndex getVectorLast(const int i) const {#ifndef COIN_FAST_CODE      if (i < 0 || i >= majorDim_)	throw CoinError("bad index", "vectorLast", "CoinPackedMatrix");#endif      return start_[i] + length_[i];    }
开发者ID:sednanref,项目名称:tesis,代码行数:9,


示例10: UtilAlpsDecodeWarmStart

//===========================================================================//CoinWarmStartBasis* UtilAlpsDecodeWarmStart(AlpsEncoded&       encoded,      AlpsReturnStatus* rc){   //rc not used? not checked?   int numCols;   int numRows;   encoded.readRep(numCols);   encoded.readRep(numRows);   int tempInt;   // Structural   int nint = (numCols + 15) >> 4;   char* structuralStatus = new char[4 * nint];   encoded.readRep(structuralStatus, tempInt);   assert(tempInt == nint * 4);   // Artificial   nint = (numRows + 15) >> 4;   char* artificialStatus = new char[4 * nint];   encoded.readRep(artificialStatus, tempInt);   assert(tempInt == nint * 4);   CoinWarmStartBasis* ws = new CoinWarmStartBasis();   if (!ws) {      throw CoinError("Out of memory", "UtilAlpsDecodeWarmStart", "HELP");   }   ws->assignBasisStatus(numCols, numRows,                         structuralStatus, artificialStatus);   return ws;}
开发者ID:Jan-David,项目名称:Dip,代码行数:30,


示例11: CoinError

voidOaDecompositionBase::solverManip::restore(){  if (initialNumberRows_ >= 0) {    int nRowsToDelete = si_->getNumRows() - initialNumberRows_;    int * rowsToDelete = new int[nRowsToDelete];    for (int i = 0 ; i < nRowsToDelete ; i++) {      rowsToDelete[i] = i + initialNumberRows_;    }    si_->deleteRows(nRowsToDelete, rowsToDelete);    delete [] rowsToDelete;    numrows_ = si_->getNumRows() ;  }  if (colLower_) {    si_->setColLower(colLower_);  }  if (colUpper_) {    si_->setColUpper(colUpper_);  }  if (cutoff_<COIN_DBL_MAX) {    si_->setDblParam(OsiDualObjectiveLimit, cutoff_);  }  if (warm_) {    if (si_->setWarmStart(warm_)==false) {      throw CoinError("Fail restoring the warm start at the end of procedure",          "restore","OaDecompositionBase::SaveSolverState") ;    }  }  getCached();}
开发者ID:coin-or,项目名称:Bonmin,代码行数:34,


示例12: optionExists

 /** throw if option does not exists.*/ inline void optionExists(const std::string & option){   if(!IsValid(GetOption(option))){     std::string msg = "Try to access option: "+option;     msg += "/n Option is not registered./n";     throw CoinError("Bonmin::RegisteredOption","optionExists",msg);   } }
开发者ID:tkelman,项目名称:Bonmin,代码行数:8,


示例13: chooseOptions

  void   RegisteredOptions::fillAmplOptionList(ExtraCategoriesInfo which, Ipopt::AmplOptionsList * amplOptList){      std::list<int> test;      std::list< Ipopt::RegisteredOption * > options;      chooseOptions(which, options);      for(std::list< Ipopt::RegisteredOption * >::iterator i = options.begin();           i != options.end() ; i++)       {           std::string name = "bonmin.";           name += (*i)->Name();           Ipopt::RegisteredOptionType T = (*i)->Type();           Ipopt::AmplOptionsList::AmplOptionType  type;           switch(T){             case Ipopt::OT_Number: type = Ipopt::AmplOptionsList::Number_Option;                  break;             case Ipopt::OT_Integer: type = Ipopt::AmplOptionsList::Integer_Option;                  break;             case Ipopt::OT_String: type = Ipopt::AmplOptionsList::String_Option;                  break;             case Ipopt::OT_Unknown:             default:                throw CoinError("RegisteredOptions","fillAmplOptionList","Unknown option type");           }           amplOptList->AddAmplOption(name, name, type, (*i)->ShortDescription());       }}
开发者ID:coin-or,项目名称:Bonmin,代码行数:26,


示例14: CoinError

//------------------------------------------------------------------std::vector<double*> OsiTestSolverInterface::getPrimalRays(int /*maxNumRays*/) const{  // *FIXME* : must write the method -LL  throw CoinError("method is not yet written", "getPrimalRays",		 "OsiTestSolverInterface");  return std::vector<double*>();}
开发者ID:NealCaffrey989,项目名称:CBC,代码行数:8,


示例15: getVectorSize

    /** The length of i'th vector. */    inline int getVectorSize(const int i) const {#ifndef COIN_FAST_CODE      if (i < 0 || i >= majorDim_)	throw CoinError("bad index", "vectorSize", "CoinPackedMatrix");#endif      return length_[i];    }
开发者ID:sednanref,项目名称:tesis,代码行数:8,


示例16: fopen

CoinFileInput *CoinFileInput::create (const std::string &fileName){  // first try to open file, and read first bytes  unsigned char header[4];  size_t count ; // So stdin will be plain file  if (fileName!="stdin") {    FILE *f = fopen (fileName.c_str (), "r");    if (f == 0)      throw CoinError ("Could not open file for reading!",                       "create",                       "CoinFileInput");    count = fread (header, 1, 4, f);    fclose (f);  } else {    // Reading from stdin - for moment not compressed    count=0 ; // So stdin will be plain file  }  // gzip files start with the magic numbers 0x1f 0x8b  if (count >= 2 && header[0] == 0x1f && header[1] == 0x8b)    {#ifdef COIN_HAS_ZLIB      return new CoinGzipFileInput (fileName);#else      throw CoinError ("Cannot read gzip'ed file because zlib was "		       "not compiled into COIN!",		       "create",		       "CoinFileInput");#endif    }  // bzip2 files start with the string "BZh"  if (count >= 3 && header[0] == 'B' && header[1] == 'Z' && header[2] == 'h')    {#ifdef COIN_HAS_BZLIB      return new CoinBzip2FileInput (fileName);#else      throw CoinError ("Cannot read bzip2'ed file because bzlib was "		       "not compiled into COIN!",		       "create",		       "CoinFileInput");#endif    }  // fallback: probably plain text file  return new CoinPlainFileInput (fileName);}
开发者ID:marvin2k,项目名称:ogdf,代码行数:47,


示例17: CoinGzipFileOutput

  CoinGzipFileOutput (const std::string &fileName):    CoinFileOutput (fileName), gzf_ (0)  {    gzf_ = gzopen (fileName.c_str (), "w");    if (gzf_ == 0)      throw CoinError ("Could not open file for writing!",		       "CoinGzipFileOutput",		       "CoinGzipFileOutput");  }
开发者ID:marvin2k,项目名称:ogdf,代码行数:9,


示例18: setCRITERION_

 /// Set CRITERION_ inline void setCRITERION_ (int criterion) {   if ((criterion >= 1) && (criterion <= 3)) {     CRITERION_ = criterion;   }   else {     throw CoinError("Unallowable value. criterion must be 1, 2 or 3",                     "gutsOfConstruct","CglMixedIntegerRounding");   } }
开发者ID:Alihina,项目名称:ogdf,代码行数:10,


示例19: setMAXAGGR_

 //@{ /// Set MAXAGGR_ inline void setMAXAGGR_ (int maxaggr) {   if (maxaggr > 0) {     MAXAGGR_ = maxaggr;   }   else {     throw CoinError("Unallowable value. maxaggr must be > 0",                     "gutsOfConstruct","CglMixedIntegerRounding");   } }
开发者ID:Alihina,项目名称:ogdf,代码行数:11,


示例20: setBeta

  /** Set the normalization : Either beta=+1 or beta=-1.      Default value is 1.  */  void setBeta(int oneOrMinusOne){    if (oneOrMinusOne==1 || oneOrMinusOne==-1){      beta_= static_cast<double>(oneOrMinusOne);    }    else {      throw CoinError("Unallowable value. Beta must be 1 or -1",		      "cutGeneration","CglLiftAndProject");    }  }
开发者ID:Gurupradeep,项目名称:Compiler-Project,代码行数:12,


示例21: assert

voidOsiTestSolverInterface::setInteger(int index){  assert(continuous_ != NULL);  if (index < 0 || index > getNumCols()) {    throw CoinError("Index out of bound.", "setContinuous",		   "OsiTestSolverInterface");  }  continuous_[index] = false;}
开发者ID:NealCaffrey989,项目名称:CBC,代码行数:10,


示例22: CoinGzipFileInput

  CoinGzipFileInput (const std::string &fileName):    CoinGetslessFileInput (fileName), gzf_ (0)  {    readType_="zlib";    gzf_ = gzopen (fileName.c_str (), "r");    if (gzf_ == 0)      throw CoinError ("Could not open file for reading!",		       "CoinGzipFileInput",		       "CoinGzipFileInput");  }
开发者ID:marvin2k,项目名称:ogdf,代码行数:10,


示例23: getVector

    /** Return the i'th vector in matrix. */    const CoinShallowPackedVector getVector(int i) const {#ifndef COIN_FAST_CODE      if (i < 0 || i >= majorDim_)	throw CoinError("bad index", "vector", "CoinPackedMatrix");#endif      return CoinShallowPackedVector(length_[i],  				    index_ + start_[i],  				    element_ + start_[i],  				    false);    }
开发者ID:sednanref,项目名称:tesis,代码行数:11,


示例24: setVlbs

    inline void setVlbs(const CglFlowVLB& vlb, int i) { 	if (vlbs_ != 0) 	    vlbs_[i] = vlb;	else {	    std::cout << "ERROR: Should allocate memory for vlbs_ before "		      << "using it " << std::endl;	    throw CoinError("Forgot to allocate memory for vlbs_", "setVlbs",			    "CglFlowCover");	}    }
开发者ID:Alihina,项目名称:ogdf,代码行数:10,



注:本文中的CoinError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CoinMax函数代码示例
C++ CoinCopyOfArray函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。