當前位置: 首頁>>代碼示例>>C++>>正文


C++ CoinCopyOfArray函數代碼示例

本文整理匯總了C++中CoinCopyOfArray函數的典型用法代碼示例。如果您正苦於以下問題:C++ CoinCopyOfArray函數的具體用法?C++ CoinCopyOfArray怎麽用?C++ CoinCopyOfArray使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CoinCopyOfArray函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: freeSpace

/** Assignment operator.*/
TMat& 
TMat::operator=(const TMat &rhs){
  if(this != &rhs){
    freeSpace();
    nnz_ = rhs.nnz_;
    capacity_ = rhs.capacity_;
    iRow_ = CoinCopyOfArray(rhs.iRow_, rhs.nnz_);
    jCol_ = CoinCopyOfArray(rhs.jCol_, rhs.nnz_);
    value_ = CoinCopyOfArray(rhs.value_, rhs.nnz_);
    columnOrdering_ = rhs.columnOrdering_;
    rowOrdering_ = rhs.rowOrdering_; 
    nonEmptyCols_.clear();
    nonEmptyRows_.clear();
  }
  return (*this);
}
開發者ID:Flymir,項目名稱:coin-all,代碼行數:17,代碼來源:BonTMatrix.cpp

示例2: CbcBranchCut

/* Useful constructor - passed set of variables
*/
CbcBranchAllDifferent::CbcBranchAllDifferent (CbcModel * model, int numberInSet,
        const int * members)
    : CbcBranchCut(model)
{
    numberInSet_ = numberInSet;
    which_ = CoinCopyOfArray(members, numberInSet_);
}
開發者ID:bubuker,項目名稱:keggle_santa,代碼行數:9,代碼來源:CbcBranchAllDifferent.cpp

示例3: CglCutGenerator

//-------------------------------------------------------------------
// Copy constructor
//-------------------------------------------------------------------
CglStored::CglStored (const CglStored & source) :
  CglCutGenerator(source),
  requiredViolation_(source.requiredViolation_),
  probingInfo_(NULL),
  cuts_(source.cuts_),
  numberColumns_(source.numberColumns_),
  bestSolution_(NULL),
  bounds_(NULL)
{
  if (source.probingInfo_)
    probingInfo_ = new CglTreeProbingInfo(*source.probingInfo_);
  if (numberColumns_) {
    bestSolution_ = CoinCopyOfArray(source.bestSolution_,numberColumns_+1);
    bounds_ = CoinCopyOfArray(source.bounds_,2*numberColumns_);
  }
}
開發者ID:Alihina,項目名稱:ogdf,代碼行數:19,代碼來源:CglStored.cpp

示例4: CglCutGenerator

//-------------------------------------------------------------------
// Useful Constructor
//-------------------------------------------------------------------
CglAllDifferent::CglAllDifferent (int numberSets,
                                  const int * starts, const int * which)
:
CglCutGenerator(),
numberSets_(numberSets),
maxLook_(2),
logLevel_(0),
start_(NULL),
which_(NULL),
originalWhich_(NULL)
{
  if (numberSets_>0) {
    int n = starts[numberSets_];
    start_ = CoinCopyOfArray(starts,numberSets_+1);
    originalWhich_ = CoinCopyOfArray(which,n);
    which_ = new int[n];
    int i;
    int maxValue=-1;
    for (i=0;i<n;i++) {
      int iColumn = which[i];
      assert (iColumn>=0);
      maxValue = CoinMax(iColumn,maxValue);
    }
    maxValue++;
    int * translate = new int[maxValue];
    for (i=0;i<maxValue;i++)
      translate[i]=-1;
    for (i=0;i<n;i++) {
      int iColumn = which[i];
      translate[iColumn]=0;
    }
    numberDifferent_=0;
    for (i=0;i<maxValue;i++) {
      if (!translate[i])
        translate[i]=numberDifferent_++;
    }
    // Now translate
    for (i=0;i<n;i++) {
      int iColumn = which[i];
      iColumn = translate[iColumn];
      assert (iColumn>=0);
      which_[i]=iColumn;
    }
    delete [] translate;
  }
}
開發者ID:Alihina,項目名稱:ogdf,代碼行數:49,代碼來源:CglAllDifferent.cpp

示例5: ClpObjective

//-------------------------------------------------------------------
// Useful Constructor
//-------------------------------------------------------------------
ClpLinearObjective::ClpLinearObjective (const double * objective ,
                                        int numberColumns)
     : ClpObjective()
{
     type_ = 1;
     numberColumns_ = numberColumns;
     objective_ = CoinCopyOfArray(objective, numberColumns_, 0.0);
}
開發者ID:e2bsq,項目名稱:Symphony,代碼行數:11,代碼來源:ClpLinearObjective.cpp

示例6: CbcObject

// Copy constructor
CbcFollowOn::CbcFollowOn ( const CbcFollowOn & rhs)
        : CbcObject(rhs),
        matrix_(rhs.matrix_),
        matrixByRow_(rhs.matrixByRow_)
{
    int numberRows = matrix_.getNumRows();
    rhs_ = CoinCopyOfArray(rhs.rhs_, numberRows);
}
開發者ID:aykutbulut,項目名稱:Cbc,代碼行數:9,代碼來源:CbcFollowOn.cpp

示例7: CoinCopyOfArray

//----------------------------------------------------------------
// Assignment operator
//-------------------------------------------------------------------
ClpConstraintQuadratic &
ClpConstraintQuadratic::operator=(const ClpConstraintQuadratic& rhs)
{
     if (this != &rhs) {
          delete [] start_;
          delete [] column_;
          delete [] coefficient_;
          numberColumns_ = rhs.numberColumns_;
          numberCoefficients_ = rhs.numberCoefficients_;
          numberQuadraticColumns_ = rhs.numberQuadraticColumns_;
          start_ = CoinCopyOfArray(rhs.start_, numberQuadraticColumns_ + 1);
          int numberElements = start_[numberQuadraticColumns_];
          column_ = CoinCopyOfArray(rhs.column_, numberElements);
          coefficient_ = CoinCopyOfArray(rhs.coefficient_, numberElements);
     }
     return *this;
}
開發者ID:emersonxsu,項目名稱:Clp,代碼行數:20,代碼來源:ClpConstraintQuadratic.cpp

示例8: memcpy

//----------------------------------------------------------------
// Assignment operator
//-------------------------------------------------------------------
OsiSolverBranch &
OsiSolverBranch::operator=(const OsiSolverBranch &rhs)
{
  if (this != &rhs) {
    delete[] indices_;
    delete[] bound_;
    memcpy(start_, rhs.start_, sizeof(start_));
    int size = start_[4];
    if (size) {
      indices_ = CoinCopyOfArray(rhs.indices_, size);
      bound_ = CoinCopyOfArray(rhs.bound_, size);
    } else {
      indices_ = NULL;
      bound_ = NULL;
    }
  }
  return *this;
}
開發者ID:coin-or,項目名稱:Osi,代碼行數:21,代碼來源:OsiSolverBranch.cpp

示例9: CbcConsequence

// Copy constructor
CbcFixVariable::CbcFixVariable ( const CbcFixVariable & rhs)
        : CbcConsequence(rhs)
{
    numberStates_ = rhs.numberStates_;
    states_ = NULL;
    startLower_ = NULL;
    startUpper_ = NULL;
    newBound_ = NULL;
    variable_ = NULL;
    if (numberStates_) {
        states_ = CoinCopyOfArray(rhs.states_, numberStates_);
        startLower_ = CoinCopyOfArray(rhs.startLower_, numberStates_ + 1);
        startUpper_ = CoinCopyOfArray(rhs.startUpper_, numberStates_ + 1);
        int n = startLower_[numberStates_];
        newBound_ = CoinCopyOfArray(rhs.newBound_, n);
        variable_ = CoinCopyOfArray(rhs.variable_, n);
    }
}
開發者ID:Flymir,項目名稱:coin-all,代碼行數:19,代碼來源:CbcFixVariable.cpp

示例10: objectiveValue_

// Copy constructor
CbcSubProblem::CbcSubProblem ( const CbcSubProblem & rhs)
        : objectiveValue_(rhs.objectiveValue_),
        sumInfeasibilities_(rhs.sumInfeasibilities_),
        variables_(NULL),
        newBounds_(NULL),
        status_(NULL),
        depth_(rhs.depth_),
        numberChangedBounds_(rhs.numberChangedBounds_),
        numberInfeasibilities_(rhs.numberInfeasibilities_)
{
    if (numberChangedBounds_) {
        variables_ = CoinCopyOfArray(rhs.variables_, numberChangedBounds_);
        newBounds_ = CoinCopyOfArray(rhs.newBounds_, numberChangedBounds_);
    }
    if (rhs.status_) {
        status_ = new CoinWarmStartBasis(*rhs.status_);
    }
}
開發者ID:Flymir,項目名稱:coin-all,代碼行數:19,代碼來源:CbcSubProblem.cpp

示例11:

//-------------------------------------------------------------------
// Assignment operator 
//-------------------------------------------------------------------
CbcSolver2 &
CbcSolver2::operator=(const CbcSolver2& rhs)
{
  if (this != &rhs) { 
    OsiClpSolverInterface::operator=(rhs);
    delete [] node_;
    delete [] howMany_;
    model_ = rhs.model_;
    int numberColumns = modelPtr_->numberColumns();
    node_=CoinCopyOfArray(rhs.node_,numberColumns);
    howMany_=CoinCopyOfArray(rhs.howMany_,numberColumns);
    count_=rhs.count_;
    memory_=rhs.memory_;
    algorithm_=rhs.algorithm_;
    strategy_=rhs.strategy_;
  }
  return *this;
}
開發者ID:aykutbulut,項目名稱:Cbc,代碼行數:21,代碼來源:CbcSolver2.cpp

示例12:

//-------------------------------------------------------------------
// Assignment operator 
//-------------------------------------------------------------------
CbcSolverLongThin &
CbcSolverLongThin::operator=(const CbcSolverLongThin& rhs)
{
  if (this != &rhs) { 
    OsiClpSolverInterface::operator=(rhs);
    delete [] node_;
    delete [] howMany_;
    model_ = rhs.model_;
    int numberColumns = modelPtr_->numberColumns();
    node_=CoinCopyOfArray(rhs.node_,numberColumns);
    howMany_=CoinCopyOfArray(rhs.howMany_,numberColumns);
    count_=rhs.count_;
    memory_=rhs.memory_;
    believeInfeasible_ = rhs.believeInfeasible_;
    nestedSearch_ = rhs.nestedSearch_;
    algorithm_=rhs.algorithm_;
  }
  return *this;
}
開發者ID:rafapaz,項目名稱:FlopCpp,代碼行數:22,代碼來源:CbcSolverLongThin.cpp

示例13: suf_sos

  void
  AmplTMINLP::read_sos()
  {
    ASL_pfgh* asl = ampl_tnlp_->AmplSolverObject();
    int i = 0;//ASL_suf_sos_explict_free;
    int copri[2], **p_sospri;
    copri[0] = 0;
    copri[1] = 0;
    int * starts = NULL;
    int * indices = NULL;
    char * types = NULL;
    double * weights = NULL;
    int * priorities = NULL;
    p_sospri = &priorities;

    sos_.gutsOfDestructor();
    int m = n_con;
    sos_.num = suf_sos(i, &sos_.numNz, &types, p_sospri, copri,
        &starts, &indices, &weights);
    if(m != n_con){
      throw CoinError("number of constraints changed by suf_sos. Not supported.",
                       "read_sos","Bonmin::AmplTMINLP");
   }
    if (sos_.num) {
      //Copy sos information
      sos_.priorities = CoinCopyOfArray(priorities,sos_.num);
      sos_.starts = CoinCopyOfArray(starts, sos_.num + 1);
      sos_.indices = CoinCopyOfArray(indices, sos_.numNz);
      sos_.types = CoinCopyOfArray(types, sos_.num);
      sos_.weights = CoinCopyOfArray(weights, sos_.numNz);

      ampl_utils::sos_kludge(sos_.num, sos_.starts, sos_.weights);
      for (int ii=0;ii<sos_.num;ii++) {
        int ichar = sos_.types[ii] - '0';
        if (ichar != 1 && ichar != 2) {
          std::cerr<<"Unsuported type of sos constraint: "<<sos_.types[ii]<<std::endl;
          throw;
        }
        sos_.types[ii]= static_cast<char>(ichar);
      }
    }
  }
開發者ID:coin-or,項目名稱:Bonmin,代碼行數:42,代碼來源:BonAmplTMINLP.cpp

示例14: CoinCopyOfArray

// Assignment operator 
CbcLink & 
CbcLink::operator=( const CbcLink& rhs)
{
  if (this!=&rhs) {
    CbcObject::operator=(rhs);
    delete [] weights_;
    delete [] which_;
    numberMembers_ = rhs.numberMembers_;
    numberLinks_ = rhs.numberLinks_;
    sosType_ = rhs.sosType_;
    if (numberMembers_) {
      weights_ = CoinCopyOfArray(rhs.weights_,numberMembers_);
      which_ = CoinCopyOfArray(rhs.which_,numberMembers_*numberLinks_);
    } else {
      weights_ = NULL;
      which_ = NULL;
    }
  }
  return *this;
}
開發者ID:rafapaz,項目名稱:FlopCpp,代碼行數:21,代碼來源:CbcBranchLink.cpp

示例15: CoinCopyOfArray

// Assignment operator
CbcTree &
CbcTree::operator=(const CbcTree & rhs)
{
    if (this != &rhs) {
        nodes_ = rhs.nodes_;
        maximumNodeNumber_ = rhs.maximumNodeNumber_;
        delete [] branched_;
        delete [] newBound_;
        numberBranching_ = rhs.numberBranching_;
        maximumBranching_ = rhs.maximumBranching_;
        if (maximumBranching_ > 0) {
            branched_ = CoinCopyOfArray(rhs.branched_, maximumBranching_);
            newBound_ = CoinCopyOfArray(rhs.newBound_, maximumBranching_);
        } else {
            branched_ = NULL;
            newBound_ = NULL;
        }
    }
    return *this;
}
開發者ID:Flymir,項目名稱:coin-all,代碼行數:21,代碼來源:CbcTree.cpp


注:本文中的CoinCopyOfArray函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。