本文整理汇总了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);
}
示例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_);
}
示例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_);
}
}
示例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;
}
}
示例5: ClpObjective
//-------------------------------------------------------------------
// Useful Constructor
//-------------------------------------------------------------------
ClpLinearObjective::ClpLinearObjective (const double * objective ,
int numberColumns)
: ClpObjective()
{
type_ = 1;
numberColumns_ = numberColumns;
objective_ = CoinCopyOfArray(objective, numberColumns_, 0.0);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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_);
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}