这篇教程C++ CoinCopyOfArray函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CoinCopyOfArray函数的典型用法代码示例。如果您正苦于以下问题:C++ CoinCopyOfArray函数的具体用法?C++ CoinCopyOfArray怎么用?C++ CoinCopyOfArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CoinCopyOfArray函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例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,
示例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,
示例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,
示例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,
示例6: CbcObject// Copy constructorCbcFollowOn::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,
示例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,
示例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,
示例9: CbcConsequence// Copy constructorCbcFixVariable::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,
示例10: objectiveValue_// Copy constructorCbcSubProblem::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,
示例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,
示例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,
示例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,
示例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,
示例15: CoinCopyOfArray// Assignment operatorCbcTree &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,
示例16: CoinCopyOfArray// Assignment operatorCbcBranchAllDifferent &CbcBranchAllDifferent::operator=( const CbcBranchAllDifferent & rhs){ if (this != &rhs) { CbcBranchCut::operator=(rhs); delete [] which_; numberInSet_ = rhs.numberInSet_; which_ = CoinCopyOfArray(rhs.which_, numberInSet_); } return *this;}
开发者ID:bubuker,项目名称:keggle_santa,代码行数:12,
示例17: CoinCopyOfArray//----------------------------------------------------------------// Assignment operator//-------------------------------------------------------------------ClpLinearObjective &ClpLinearObjective::operator=(const ClpLinearObjective& rhs){ if (this != &rhs) { ClpObjective::operator=(rhs); numberColumns_ = rhs.numberColumns_; delete [] objective_; objective_ = CoinCopyOfArray(rhs.objective_, numberColumns_); } return *this;}
开发者ID:e2bsq,项目名称:Symphony,代码行数:14,
示例18: CoinCopyOfArray//----------------------------------------------------------------// Assignment operator//-------------------------------------------------------------------OsiSolverResult &OsiSolverResult::operator=(const OsiSolverResult &rhs){ if (this != &rhs) { delete[] primalSolution_; delete[] dualSolution_; objectiveValue_ = rhs.objectiveValue_; basis_ = rhs.basis_; fixed_ = rhs.fixed_; int numberRows = basis_.getNumArtificial(); int numberColumns = basis_.getNumStructural(); if (numberColumns) { primalSolution_ = CoinCopyOfArray(rhs.primalSolution_, numberColumns); dualSolution_ = CoinCopyOfArray(rhs.dualSolution_, numberRows); } else { primalSolution_ = NULL; dualSolution_ = NULL; } } return *this;}
开发者ID:coin-or,项目名称:Osi,代码行数:24,
示例19: CbcBranchCut// Copy constructorCbcBranchToFixLots::CbcBranchToFixLots ( const CbcBranchToFixLots & rhs) : CbcBranchCut(rhs){ djTolerance_ = rhs.djTolerance_; fractionFixed_ = rhs.fractionFixed_; int numberColumns = model_->getNumCols(); mark_ = CoinCopyOfArray(rhs.mark_, numberColumns); matrixByRow_ = rhs.matrixByRow_; depth_ = rhs.depth_; numberClean_ = rhs.numberClean_; alwaysCreate_ = rhs.alwaysCreate_;}
开发者ID:amosr,项目名称:limp-cbc,代码行数:13,
示例20: GetRawPtr void AmplTMINLP::read_priorities() { int numcols, m, dummy1, dummy2; TNLP::IndexStyleEnum index_style; ampl_tnlp_->get_nlp_info(numcols, m, dummy1, dummy2, index_style); const AmplSuffixHandler * suffix_handler = GetRawPtr(suffix_handler_); const Index* pri = suffix_handler->GetIntegerSuffixValues("priority", AmplSuffixHandler::Variable_Source); const Index* brac = suffix_handler->GetIntegerSuffixValues("direction", AmplSuffixHandler::Variable_Source); const Number* upPs = suffix_handler->GetNumberSuffixValues("upPseudocost", AmplSuffixHandler::Variable_Source); const Number* dwPs = suffix_handler->GetNumberSuffixValues("downPseudocost", AmplSuffixHandler::Variable_Source); branch_.gutsOfDestructor(); branch_.size = numcols; if (pri) { branch_.priorities = new int[numcols]; for (int i = 0 ; i < numcols ; i++) { branch_.priorities [i] = -pri[i] + 9999; } } if (brac) { branch_.branchingDirections = CoinCopyOfArray(brac,numcols); } if (upPs && !dwPs) dwPs = upPs; else if (dwPs && !upPs) upPs = dwPs; if (upPs) { branch_.upPsCosts = CoinCopyOfArray(upPs,numcols); } if (dwPs) { branch_.downPsCosts = CoinCopyOfArray(dwPs,numcols); } const double* perturb_radius = suffix_handler->GetNumberSuffixValues("perturb_radius", AmplSuffixHandler::Variable_Source); perturb_info_.SetPerturbationArray(numcols, perturb_radius); }
开发者ID:coin-or,项目名称:Bonmin,代码行数:40,
示例21: CbcHeuristic// Copy constructorCbcHeuristicDive::CbcHeuristicDive(const CbcHeuristicDive & rhs) : CbcHeuristic(rhs), matrix_(rhs.matrix_), matrixByRow_(rhs.matrixByRow_), percentageToFix_(rhs.percentageToFix_), maxIterations_(rhs.maxIterations_), maxSimplexIterations_(rhs.maxSimplexIterations_), maxSimplexIterationsAtRoot_(rhs.maxSimplexIterationsAtRoot_), maxTime_(rhs.maxTime_){ downArray_ = NULL; upArray_ = NULL; if (rhs.downLocks_) { int numberIntegers = model_->numberIntegers(); downLocks_ = CoinCopyOfArray(rhs.downLocks_, numberIntegers); upLocks_ = CoinCopyOfArray(rhs.upLocks_, numberIntegers); } else { downLocks_ = NULL; upLocks_ = NULL; }}
开发者ID:amosr,项目名称:limp-cbc,代码行数:23,
示例22: getRowUpper/* Set pointer to array[getNumRows()] of rhs side values This gives same results as OsiSolverInterface for useful cases If getRowUpper()[i] != infinity then getRightHandSide()[i] == getRowUpper()[i] else getRightHandSide()[i] == getRowLower()[i]*/void CoinSnapshot::setRightHandSide(const double * array, bool copyIn){ if (owned_.rightHandSide) delete [] rightHandSide_; if (copyIn) { owned_.rightHandSide=1; rightHandSide_ = CoinCopyOfArray(array,numRows_); } else { owned_.rightHandSide=0; rightHandSide_ = array; }}
开发者ID:Chelsea21,项目名称:Lumiverse,代码行数:20,
示例23: CoinCopyOfArray// Set pointer to array[getNumCols()] of objective function coefficientsvoid CoinSnapshot::setObjCoefficients(const double * array, bool copyIn){ if (owned_.objCoefficients) delete [] objCoefficients_; if (copyIn) { owned_.objCoefficients=1; objCoefficients_ = CoinCopyOfArray(array,numCols_); } else { owned_.objCoefficients=0; objCoefficients_ = array; }}
开发者ID:Chelsea21,项目名称:Lumiverse,代码行数:14,
示例24: objectiveValue_//-------------------------------------------------------------------// Constructor from solver//-------------------------------------------------------------------OsiSolverResult::OsiSolverResult(const OsiSolverInterface &solver, const double *lowerBefore, const double *upperBefore) : objectiveValue_(COIN_DBL_MAX) , primalSolution_(NULL) , dualSolution_(NULL){ if (solver.isProvenOptimal() && !solver.isDualObjectiveLimitReached()) { objectiveValue_ = solver.getObjValue() * solver.getObjSense(); CoinWarmStartBasis *basis = dynamic_cast< CoinWarmStartBasis * >(solver.getWarmStart()); assert(basis); basis_ = *basis; delete basis; int numberRows = basis_.getNumArtificial(); int numberColumns = basis_.getNumStructural(); assert(numberColumns == solver.getNumCols()); assert(numberRows == solver.getNumRows()); primalSolution_ = CoinCopyOfArray(solver.getColSolution(), numberColumns); dualSolution_ = CoinCopyOfArray(solver.getRowPrice(), numberRows); fixed_.addBranch(-1, numberColumns, lowerBefore, solver.getColLower(), upperBefore, solver.getColUpper()); }}
开发者ID:coin-or,项目名称:Osi,代码行数:25,
注:本文中的CoinCopyOfArray函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CoinError函数代码示例 C++ Codef函数代码示例 |