Cgl 0.60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClpPackedMatrix.hpp
Go to the documentation of this file.
1 /* $Id: ClpPackedMatrix.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5
6 #ifndef ClpPackedMatrix_H
7 #define ClpPackedMatrix_H
8
9 #include "CoinPragma.hpp"
10
11 #include "ClpMatrixBase.hpp"
12 #include "ClpPrimalColumnSteepest.hpp"
13
20 class ClpPackedMatrix2;
21 class ClpPackedMatrix3;
22 class CoinDoubleArrayWithLength;
23 class ClpPackedMatrix : public ClpMatrixBase {
24
25 public:
28 virtual CoinPackedMatrix *getPackedMatrix() const
30 {
31 return matrix_;
32 }
34 virtual bool isColOrdered() const
35 {
36 return matrix_->isColOrdered();
37 }
39 virtual CoinBigIndex getNumElements() const
40 {
41 return matrix_->getNumElements();
42 }
44 virtual int getNumCols() const
45 {
46 return matrix_->getNumCols();
47 }
49 virtual int getNumRows() const
50 {
51 return matrix_->getNumRows();
52 }
53
58 virtual const double *getElements() const
59 {
60 return matrix_->getElements();
61 }
63 inline double *getMutableElements() const
64 {
65 return matrix_->getMutableElements();
66 }
72 virtual const int *getIndices() const
73 {
74 return matrix_->getIndices();
75 }
76
77 virtual const CoinBigIndex *getVectorStarts() const
78 {
79 return matrix_->getVectorStarts();
80 }
82 virtual const int *getVectorLengths() const
83 {
84 return matrix_->getVectorLengths();
85 }
87 virtual int getVectorLength(int index) const
88 {
89 return matrix_->getVectorSize(index);
90 }
91
93 virtual void deleteCols(const int numDel, const int *indDel);
95 virtual void deleteRows(const int numDel, const int *indDel);
96 #ifndef CLP_NO_VECTOR
97 virtual void appendCols(int number, const CoinPackedVectorBase *const *columns);
100 virtual void appendRows(int number, const CoinPackedVectorBase *const *rows);
101 #endif
102
106 virtual int appendMatrix(int number, int type,
107 const CoinBigIndex *starts, const int *index,
108 const double *element, int numberOther = -1);
113 virtual void replaceVector(const int index,
114 const int numReplace, const double *newElements)
115 {
116 matrix_->replaceVector(index, numReplace, newElements);
117 }
121 virtual void modifyCoefficient(int row, int column, double newElement,
122 bool keepZero = false)
123 {
124 matrix_->modifyCoefficient(row, column, newElement, keepZero);
125 }
127 virtual ClpMatrixBase *reverseOrderedCopy() const;
129 virtual int countBasis(const int *whichColumn,
130 int &numberColumnBasic);
132 virtual void fillBasis(ClpSimplex *model,
133 const int *whichColumn,
134 int &numberColumnBasic,
135 int *row, int *start,
136 int *rowCount, int *columnCount,
137 CoinFactorizationDouble *element);
140 virtual int scale(ClpModel *model, ClpSimplex *simplex = NULL) const;
143 virtual void scaleRowCopy(ClpModel *model) const;
145 void createScaledMatrix(ClpSimplex *model) const;
149 virtual ClpMatrixBase *scaledColumnCopy(ClpModel *model) const;
160 virtual bool allElementsInRange(ClpModel *model,
161 double smallest, double largest,
162 int check = 15);
166 virtual void rangeOfElements(double &smallestNegative, double &largestNegative,
167 double &smallestPositive, double &largestPositive);
168
171 virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray,
172 int column) const;
177 virtual void unpackPacked(ClpSimplex *model,
178 CoinIndexedVector *rowArray,
179 int column) const;
182 virtual void add(const ClpSimplex *model, CoinIndexedVector *rowArray,
183 int column, double multiplier) const;
185 virtual void add(const ClpSimplex *model, double *array,
186 int column, double multiplier) const;
188 virtual void releasePackedMatrix() const {}
193 virtual CoinBigIndex *dubiousWeights(const ClpSimplex *model, int *inputWeights) const;
195 virtual bool canDoPartialPricing() const;
197 virtual void partialPricing(ClpSimplex *model, double start, double end,
198 int &bestSequence, int &numberWanted);
200 virtual int refresh(ClpSimplex *model);
201 // Really scale matrix
202 virtual void reallyScale(const double *rowScale, const double *columnScale);
208 virtual void setDimensions(int numrows, int numcols);
210
216 virtual void times(double scalar,
217 const double *x, double *y) const;
219 virtual void times(double scalar,
220 const double *x, double *y,
221 const double *rowScale,
222 const double *columnScale) const;
226 virtual void transposeTimes(double scalar,
227 const double *x, double *y) const;
229 virtual void transposeTimes(double scalar,
230 const double *x, double *y,
231 const double *rowScale,
232 const double *columnScale,
233 double *spare = NULL) const;
238 void transposeTimesSubset(int number,
239 const int *which,
240 const double *pi, double *y,
241 const double *rowScale,
242 const double *columnScale,
243 double *spare = NULL) const;
248 virtual void transposeTimes(const ClpSimplex *model, double scalar,
249 const CoinIndexedVector *x,
250 CoinIndexedVector *y,
251 CoinIndexedVector *z) const;
256 void transposeTimesByColumn(const ClpSimplex *model, double scalar,
257 const CoinIndexedVector *x,
258 CoinIndexedVector *y,
259 CoinIndexedVector *z) const;
265 virtual void transposeTimesByRow(const ClpSimplex *model, double scalar,
266 const CoinIndexedVector *x,
267 CoinIndexedVector *y,
268 CoinIndexedVector *z) const;
272 virtual void subsetTransposeTimes(const ClpSimplex *model,
273 const CoinIndexedVector *x,
274 const CoinIndexedVector *y,
275 CoinIndexedVector *z) const;
278 virtual bool canCombine(const ClpSimplex *model,
279 const CoinIndexedVector *pi) const;
283 virtual int transposeTimes2(const ClpSimplex *model,
284 const CoinIndexedVector *pi1, CoinIndexedVector *dj1,
285 const CoinIndexedVector *pi2,
286 CoinIndexedVector *spare,
287 double *infeas, double *reducedCost,
288 double referenceIn, double devex,
289 // Array for exact devex to say what is in reference framework
290 unsigned int *reference,
291 double *weights, double scaleFactor);
293 virtual void subsetTimes2(const ClpSimplex *model,
294 CoinIndexedVector *dj1,
295 const CoinIndexedVector *pi2, CoinIndexedVector *dj2,
296 double referenceIn, double devex,
297 // Array for exact devex to say what is in reference framework
298 unsigned int *reference,
299 double *weights, double scaleFactor);
301 void useEffectiveRhs(ClpSimplex *model);
302 #if COIN_LONG_WORK
303 // For long double versions
304 virtual void times(CoinWorkDouble scalar,
305 const CoinWorkDouble *x, CoinWorkDouble *y) const;
306 virtual void transposeTimes(CoinWorkDouble scalar,
307 const CoinWorkDouble *x, CoinWorkDouble *y) const;
308 #endif
309
310
313 inline CoinPackedMatrix *matrix() const
315 {
316 return matrix_;
317 }
321 inline void setMatrixNull()
322 {
323 matrix_ = NULL;
324 }
326 inline void makeSpecialColumnCopy()
327 {
328 flags_ |= 16;
329 }
331 void releaseSpecialColumnCopy();
333 inline bool zeros() const
334 {
335 return ((flags_ & 1) != 0);
336 }
338 inline bool wantsSpecialColumnCopy() const
339 {
340 return ((flags_ & 16) != 0);
341 }
343 inline int flags() const
344 {
345 return flags_;
346 }
348 inline void checkGaps()
349 {
350 flags_ = (matrix_->hasGaps()) ? (flags_ | 2) : (flags_ & (~2));
351 }
353 inline int numberActiveColumns() const
354 {
355 return numberActiveColumns_;
356 }
358 inline void setNumberActiveColumns(int value)
359 {
360 numberActiveColumns_ = value;
361 }
363
367 ClpPackedMatrix();
369 virtual ~ClpPackedMatrix();
371
375 ClpPackedMatrix(const ClpPackedMatrix &);
377 ClpPackedMatrix(const CoinPackedMatrix &);
380 ClpPackedMatrix(const ClpPackedMatrix &wholeModel,
381 int numberRows, const int *whichRows,
382 int numberColumns, const int *whichColumns);
383 ClpPackedMatrix(const CoinPackedMatrix &wholeModel,
384 int numberRows, const int *whichRows,
385 int numberColumns, const int *whichColumns);
386
388 ClpPackedMatrix(CoinPackedMatrix *matrix);
389
390 ClpPackedMatrix &operator=(const ClpPackedMatrix &);
392 virtual ClpMatrixBase *clone() const;
394 virtual void copy(const ClpPackedMatrix *from);
397 virtual ClpMatrixBase *subsetClone(
398 int numberRows, const int *whichRows,
399 int numberColumns, const int *whichColumns) const;
401 void specialRowCopy(ClpSimplex *model, const ClpMatrixBase *rowCopy);
403 void specialColumnCopy(ClpSimplex *model);
405 virtual void correctSequence(const ClpSimplex *model, int &sequenceIn, int &sequenceOut);
407 private:
409 int gutsOfTransposeTimesUnscaled(const double *COIN_RESTRICT pi,
410 int *COIN_RESTRICT index,
411 double *COIN_RESTRICT array,
412 const double tolerance) const;
414 int gutsOfTransposeTimesScaled(const double *COIN_RESTRICT pi,
415 const double *COIN_RESTRICT columnScale,
416 int *COIN_RESTRICT index,
417 double *COIN_RESTRICT array,
418 const double tolerance) const;
420 int gutsOfTransposeTimesUnscaled(const double *COIN_RESTRICT pi,
421 int *COIN_RESTRICT index,
422 double *COIN_RESTRICT array,
423 const unsigned char *status,
424 const double tolerance) const;
427 int gutsOfTransposeTimesUnscaled(const double *COIN_RESTRICT pi,
428 int *COIN_RESTRICT index,
429 double *COIN_RESTRICT array,
430 const unsigned char *status,
431 int *COIN_RESTRICT spareIndex,
432 double *COIN_RESTRICT spareArray,
433 const double *COIN_RESTRICT reducedCost,
434 double &upperTheta,
435 double acceptablePivot,
436 double dualTolerance,
437 int &numberRemaining,
438 const double zeroTolerance) const;
440 int gutsOfTransposeTimesScaled(const double *COIN_RESTRICT pi,
441 const double *COIN_RESTRICT columnScale,
442 int *COIN_RESTRICT index,
443 double *COIN_RESTRICT array,
444 const unsigned char *status,
445 const double tolerance) const;
447 int gutsOfTransposeTimesByRowGEK(const CoinIndexedVector *COIN_RESTRICT piVector,
448 int *COIN_RESTRICT index,
449 double *COIN_RESTRICT output,
450 int numberColumns,
451 const double tolerance,
452 const double scalar) const;
454 int gutsOfTransposeTimesByRowGE3(const CoinIndexedVector *COIN_RESTRICT piVector,
455 int *COIN_RESTRICT index,
456 double *COIN_RESTRICT output,
457 double *COIN_RESTRICT array2,
458 const double tolerance,
459 const double scalar) const;
461 int gutsOfTransposeTimesByRowGE3a(const CoinIndexedVector *COIN_RESTRICT piVector,
462 int *COIN_RESTRICT index,
463 double *COIN_RESTRICT output,
464 int *COIN_RESTRICT lookup,
465 char *COIN_RESTRICT marked,
466 const double tolerance,
467 const double scalar) const;
469 void gutsOfTransposeTimesByRowEQ2(const CoinIndexedVector *piVector, CoinIndexedVector *output,
470 CoinIndexedVector *spareVector, const double tolerance, const double scalar) const;
472 void gutsOfTransposeTimesByRowEQ1(const CoinIndexedVector *piVector, CoinIndexedVector *output,
473 const double tolerance, const double scalar) const;
475 void clearCopies();
476
477 protected:
479 void checkFlags(int type) const;
483 CoinPackedMatrix *matrix_;
486 int numberActiveColumns_;
494 mutable int flags_;
496 ClpPackedMatrix2 *rowCopy_;
498 ClpPackedMatrix3 *columnCopy_;
500 };
501 #ifdef THREAD
502 #include <pthread.h>
503 typedef struct {
504 double acceptablePivot;
505 const ClpSimplex *model;
506 double *spare;
507 int *spareIndex;
508 double *arrayTemp;
509 int *indexTemp;
510 int *numberInPtr;
511 //double * bestPossiblePtr;
512 double *upperThetaPtr;
513 int *posFreePtr;
514 double *freePivotPtr;
515 int *numberOutPtr;
516 const unsigned short *count;
517 const double *pi;
518 const CoinBigIndex *rowStart;
519 const double *element;
520 const unsigned short *column;
521 int offset;
522 int numberInRowArray;
523 int numberLook;
524 } dualColumn0Struct;
525 #endif
526 class ClpPackedMatrix2 {
527
528 public:
534 void transposeTimes(const ClpSimplex *model,
535 const CoinPackedMatrix *rowCopy,
536 const CoinIndexedVector *x,
537 CoinIndexedVector *spareArray,
538 CoinIndexedVector *z) const;
540 inline bool usefulInfo() const
541 {
542 return rowStart_ != NULL;
543 }
545
549 ClpPackedMatrix2();
551 ClpPackedMatrix2(ClpSimplex *model, const CoinPackedMatrix *rowCopy);
553 virtual ~ClpPackedMatrix2();
555
559 ClpPackedMatrix2(const ClpPackedMatrix2 &);
560 ClpPackedMatrix2 &operator=(const ClpPackedMatrix2 &);
562
563 protected:
567 int numberBlocks_;
570 int numberRows_;
572 int *offset_;
574 mutable unsigned short *count_;
576 mutable CoinBigIndex *rowStart_;
578 unsigned short *column_;
580 double *work_;
581 #ifdef THREAD
582 pthread_t *threadId_;
583 dualColumn0Struct *info_;
584 #endif
585
586 };
587 typedef struct {
588 CoinBigIndex startElements_; // point to data
589 CoinBigIndex startRows_; // point to data later
590 int startIndices_; // point to column_
591 int numberInBlock_;
592 int numberScan_; // i.e. miss out basic and fixed
593 /* order is -
594 free or superbasic
595 at lower
596 at upper
597 fixed or basic */
598 int firstAtLower_;
599 int firstAtUpper_;
600 int firstBasic_; // or fixed
601 int numberElements_; // number elements per column
602 int numberOnes_; // later
603 } blockStruct;
604 class ClpPackedMatrix3 {
605
606 public:
612 void transposeTimes(const ClpSimplex *model,
613 const double *pi,
614 CoinIndexedVector *output) const;
617 void transposeTimes(const ClpSimplex *model,
618 const double *pi,
619 CoinIndexedVector *output,
620 CoinIndexedVector *candidate,
621 const CoinIndexedVector *rowArray) const;
622 void transposeTimes2(const ClpSimplex *model,
623 const double *pi, CoinIndexedVector *dj1,
624 const double *piWeight,
625 double *COIN_RESTRICT infeas,
626 double *COIN_RESTRICT reducedCost,
627 double referenceIn, double devex,
628 // Array for exact devex to say what is in reference framework
629 unsigned int *reference,
630 double *weights, double scaleFactor);
632
636 ClpPackedMatrix3();
638 ClpPackedMatrix3(ClpSimplex *model, const CoinPackedMatrix *columnCopy);
640 virtual ~ClpPackedMatrix3();
642
646 ClpPackedMatrix3(const ClpPackedMatrix3 &);
647 ClpPackedMatrix3 &operator=(const ClpPackedMatrix3 &);
649
652 void sortBlocks(const ClpSimplex *model);
654 void swapOne(const ClpSimplex *model, const ClpPackedMatrix *matrix,
655 int iColumn);
657 void swapOne(int iBlock, int kA, int kB);
659 void checkBlocks(const ClpSimplex *model);
664 int redoInfeasibilities(const ClpSimplex *model,
665 ClpPrimalColumnSteepest *pivotChoose,
666 int type);
668
669
670 protected:
674 int numberBlocks_;
677 int numberColumns_;
679 int numberColumnsWithGaps_;
680 #if ABOCA_LITE
681 int numberChunks_;
683 #endif
684 CoinBigIndex numberElements_;
687 int maxBlockSize_;
689 int *column_;
691 CoinBigIndex *start_;
693 int *row_;
695 double *element_;
697 CoinDoubleArrayWithLength *temporary_;
698 #if ABOCA_LITE
699 int endChunk_[2 * ABOCA_LITE + 1];
701 #endif
702 blockStruct *block_;
705 int ifActive_;
707 };
708 #elif INCLUDE_MATRIX3_PRICING
709 int iColumn = *column;
710 column++;
711 if (fabs(value) > zeroTolerance) {
712 double thisWeight = weights[iColumn];
713 double pivot = value * scaleFactor;
714 double pivotSquared = pivot * pivot;
715 thisWeight += pivotSquared * devex + pivot * modification;
716 if (thisWeight < DEVEX_TRY_NORM) {
717 if (referenceIn < 0.0) {
718 // steepest
719 thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared);
720 } else {
721 // exact
722 thisWeight = referenceIn * pivotSquared;
723 if (reference(iColumn))
724 thisWeight += 1.0;
725 thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM);
726 }
727 }
728 // out basic or fixed
729 weights[iColumn] = thisWeight;
730 value = reducedCost[iColumn] - value;
731 reducedCost[iColumn] = value;
732 unsigned char thisStatus = status[iColumn] & 7;
733 assert(thisStatus != 0 && thisStatus != 4);
734 if (thisStatus == 3) {
735 //} else if ((thisStatus&1)!=0) {
736 // basic or fixed
737 //value=0.0;
738 } else {
739 assert(thisStatus == 2);
740 value = -value;
741 }
742 if (value < dualTolerance) {
743 value *= value;
744 if (value > bestRatio * weights[iColumn]) {
745 bestSequence = iColumn;
746 bestRatio = value / weights[iColumn];
747 #if NO_CHANGE_MULTIPLIER != 1
748 bestRatio2 = bestRatio * NO_CHANGE_MULTIPLIER;
749 #endif
750 }
751 }
752 } else {
753 // interesting - was faster without this?!
754 value = reducedCost[iColumn];
755 unsigned char thisStatus = status[iColumn] & 7;
756 assert(thisStatus != 0 && thisStatus != 4);
757 if (thisStatus == 3) {
758 } else if ((thisStatus & 1) != 0) {
759 // basic or fixed
760 value = 0.0;
761 } else {
762 value = -value;
763 }
764 if (value < dualTolerance) {
765 value *= value;
766 if (value > bestRatio2 * weights[iColumn]) {
767 bestSequence = iColumn;
768 bestRatio2 = value / weights[iColumn];
769 #if NO_CHANGE_MULTIPLIER != 1
770 bestRatio = bestRatio2 * INVERSE_MULTIPLIER;
771 #endif
772 }
773 }
774 }
775 #endif
776
777 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
778 */
ClpPackedMatrix3::redoInfeasibilities
int redoInfeasibilities(const ClpSimplex *model, ClpPrimalColumnSteepest *pivotChoose, int type)
type - 1 redo infeasible, 2 choose sequenceIn, 3 both returns sequenceIn (or -1) for type 2 ...
ClpPackedMatrix2::usefulInfo
bool usefulInfo() const
Returns true if copy has useful information.
Definition: ClpPackedMatrix.hpp:540
CoinPackedMatrix::getVectorSize
int getVectorSize(const int i) const
The length of i&#39;th vector.
Definition: CoinPackedMatrix.hpp:187
ClpPackedMatrix::gutsOfTransposeTimesByRowGE3
int gutsOfTransposeTimesByRowGE3(const CoinIndexedVector *COIN_RESTRICT piVector, int *COIN_RESTRICT index, double *COIN_RESTRICT output, double *COIN_RESTRICT array2, const double tolerance, const double scalar) const
Meat of transposeTimes by row n &gt; 2 if packed - returns number nonzero.
ClpPackedMatrix::columnCopy_
ClpPackedMatrix3 * columnCopy_
Special column copy.
Definition: ClpPackedMatrix.hpp:498
ClpPackedMatrix::scale
virtual int scale(ClpModel *model, ClpSimplex *simplex=NULL) const
Creates scales for column copy (rowCopy in model may be modified) returns non-zero if no scaling done...
CoinPackedMatrix::getNumElements
CoinBigIndex getNumElements() const
Number of entries in the packed matrix.
Definition: CoinPackedMatrix.hpp:105
blockStruct::startIndices_
int startIndices_
Definition: ClpPackedMatrix.hpp:590
ClpPackedMatrix::replaceVector
virtual void replaceVector(const int index, const int numReplace, const double *newElements)
Replace the elements of a vector.
Definition: ClpPackedMatrix.hpp:113
ClpMatrixBase::type
int type() const
Returns type.
Definition: ClpMatrixBase.hpp:383
ClpPackedMatrix::subsetTransposeTimes
virtual void subsetTransposeTimes(const ClpSimplex *model, const CoinIndexedVector *x, const CoinIndexedVector *y, CoinIndexedVector *z) const
Return x *A in z but just for indices in y.
ClpPackedMatrix3::numberColumnsWithGaps_
int numberColumnsWithGaps_
Number of columns including gaps.
Definition: ClpPackedMatrix.hpp:679
ClpPackedMatrix2::operator=
ClpPackedMatrix2 & operator=(const ClpPackedMatrix2 &)
ClpPackedMatrix::add
virtual void add(const ClpSimplex *model, CoinIndexedVector *rowArray, int column, double multiplier) const
Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector...
ClpMatrixBase
Abstract base class for Clp Matrices.
Definition: ClpMatrixBase.hpp:38
ClpModel
Definition: ClpModel.hpp:38
ClpPackedMatrix::flags_
int flags_
Flags - 1 - has zero elements 2 - has gaps 4 - has special row copy 8 - has special column copy 16 - ...
Definition: ClpPackedMatrix.hpp:494
CoinDoubleArrayWithLength
double * version
Definition: CoinIndexedVector.hpp:678
ClpPackedMatrix::scaleRowCopy
virtual void scaleRowCopy(ClpModel *model) const
Scales rowCopy if column copy scaled Only called if scales already exist.
blockStruct::startRows_
CoinBigIndex startRows_
Definition: ClpPackedMatrix.hpp:589
ClpPackedMatrix2
Definition: ClpPackedMatrix.hpp:526
ClpPackedMatrix3::ifActive_
int ifActive_
If active.
Definition: ClpPackedMatrix.hpp:705
ClpPackedMatrix::specialRowCopy
void specialRowCopy(ClpSimplex *model, const ClpMatrixBase *rowCopy)
make special row copy
ClpPrimalColumnSteepest
Primal Column Pivot Steepest Edge Algorithm Class.
Definition: ClpPrimalColumnSteepest.hpp:21
ClpPackedMatrix::appendMatrix
virtual int appendMatrix(int number, int type, const CoinBigIndex *starts, const int *index, const double *element, int numberOther=-1)
Append a set of rows/columns to the end of the matrix.
ClpPackedMatrix2::transposeTimes
void transposeTimes(const ClpSimplex *model, const CoinPackedMatrix *rowCopy, const CoinIndexedVector *x, CoinIndexedVector *spareArray, CoinIndexedVector *z) const
Return x * -1 * A in z.
ClpPackedMatrix::transposeTimesSubset
void transposeTimesSubset(int number, const int *which, const double *pi, double *y, const double *rowScale, const double *columnScale, double *spare=NULL) const
Return y - pi * A in y.
ClpPackedMatrix3::swapOne
void swapOne(const ClpSimplex *model, const ClpPackedMatrix *matrix, int iColumn)
Swap one variable.
ClpPackedMatrix2::offset_
int * offset_
Column offset for each block (plus one at end)
Definition: ClpPackedMatrix.hpp:572
ClpPackedMatrix::deleteCols
virtual void deleteCols(const int numDel, const int *indDel)
Delete the columns whose indices are listed in indDel.
ClpPackedMatrix::allElementsInRange
virtual bool allElementsInRange(ClpModel *model, double smallest, double largest, int check=15)
Checks if all elements are in valid range.
ClpPackedMatrix::getNumRows
virtual int getNumRows() const
Number of rows.
Definition: ClpPackedMatrix.hpp:49
ClpPackedMatrix3
Definition: ClpPackedMatrix.hpp:604
CoinPackedMatrix::modifyCoefficient
void modifyCoefficient(int row, int column, double newElement, bool keepZero=false)
Modify one element of packed matrix.
ClpPackedMatrix::setMatrixNull
void setMatrixNull()
Just sets matrix_ to NULL so it can be used elsewhere.
Definition: ClpPackedMatrix.hpp:321
ClpPackedMatrix::gutsOfTransposeTimesByRowEQ2
void gutsOfTransposeTimesByRowEQ2(const CoinIndexedVector *piVector, CoinIndexedVector *output, CoinIndexedVector *spareVector, const double tolerance, const double scalar) const
Meat of transposeTimes by row n == 2 if packed.
ClpPackedMatrix
Definition: ClpPackedMatrix.hpp:23
ClpMatrixBase::reducedCost
double reducedCost(ClpSimplex *model, int sequence) const
Returns reduced cost of a variable.
ClpPackedMatrix::deleteRows
virtual void deleteRows(const int numDel, const int *indDel)
Delete the rows whose indices are listed in indDel.
ClpPackedMatrix::checkFlags
void checkFlags(int type) const
Check validity.
blockStruct::numberElements_
int numberElements_
Definition: ClpPackedMatrix.hpp:601
ClpPackedMatrix3::numberElements_
CoinBigIndex numberElements_
Number of elements (including gaps)
Definition: ClpPackedMatrix.hpp:685
ClpPackedMatrix::clearCopies
void clearCopies()
Gets rid of special copies.
ClpPackedMatrix::clone
virtual ClpMatrixBase * clone() const
Clone.
ClpPackedMatrix::createScaledMatrix
void createScaledMatrix(ClpSimplex *model) const
Creates scaled column copy if scales exist.
ClpPackedMatrix3::transposeTimes2
void transposeTimes2(const ClpSimplex *model, const double *pi, CoinIndexedVector *dj1, const double *piWeight, double *COIN_RESTRICT infeas, double *COIN_RESTRICT reducedCost, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
CoinPackedMatrix::hasGaps
bool hasGaps() const
Whether the packed matrix has gaps or not.
Definition: CoinPackedMatrix.hpp:102
blockStruct
Definition: ClpPackedMatrix.hpp:587
ClpPackedMatrix::setNumberActiveColumns
void setNumberActiveColumns(int value)
Set number of active columns (normally same as number of columns)
Definition: ClpPackedMatrix.hpp:358
ClpMatrixBase.hpp
ClpPackedMatrix3::column_
int * column_
Column indices and reverse lookup (within block)
Definition: ClpPackedMatrix.hpp:689
ClpPackedMatrix::numberActiveColumns
int numberActiveColumns() const
number of active columns (normally same as number of columns)
Definition: ClpPackedMatrix.hpp:353
ClpPackedMatrix3::element_
double * element_
Elements.
Definition: ClpPackedMatrix.hpp:695
ClpPackedMatrix::times
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
ClpPackedMatrix::getNumElements
virtual CoinBigIndex getNumElements() const
Number of entries in the packed matrix.
Definition: ClpPackedMatrix.hpp:39
CoinPackedMatrix::isColOrdered
bool isColOrdered() const
Whether the packed matrix is column major ordered or not.
Definition: CoinPackedMatrix.hpp:99
ClpPackedMatrix3::checkBlocks
void checkBlocks(const ClpSimplex *model)
Debug - check blocks.
COIN_RESTRICT
#define COIN_RESTRICT
Definition: ClpMatrixBase.hpp:21
ClpPackedMatrix::getVectorStarts
virtual const CoinBigIndex * getVectorStarts() const
Definition: ClpPackedMatrix.hpp:77
CoinPackedVectorBase
Abstract base class for various sparse vectors.
Definition: CoinPackedVectorBase.hpp:23
ClpPackedMatrix::correctSequence
virtual void correctSequence(const ClpSimplex *model, int &sequenceIn, int &sequenceOut)
Correct sequence in and out to give true value.
ClpPackedMatrix::matrix_
CoinPackedMatrix * matrix_
Data.
Definition: ClpPackedMatrix.hpp:484
ClpPackedMatrix::getPackedMatrix
virtual CoinPackedMatrix * getPackedMatrix() const
Return a complete CoinPackedMatrix.
Definition: ClpPackedMatrix.hpp:29
ClpPackedMatrix::countBasis
virtual int countBasis(const int *whichColumn, int &numberColumnBasic)
Returns number of elements in column part of basis.
CoinPackedMatrix::getNumCols
int getNumCols() const
Number of columns.
Definition: CoinPackedMatrix.hpp:108
CoinFactorizationDouble
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
ClpPackedMatrix2::column_
unsigned short * column_
columns within block
Definition: ClpPackedMatrix.hpp:578
ClpPackedMatrix::copy
virtual void copy(const ClpPackedMatrix *from)
Copy contents - resizing if necessary - otherwise re-use memory.
DEVEX_TRY_NORM
#define DEVEX_TRY_NORM
Definition: AbcDualRowSteepest.hpp:162
ClpPackedMatrix::specialColumnCopy
void specialColumnCopy(ClpSimplex *model)
make special column copy
ClpPackedMatrix::fillBasis
virtual void fillBasis(ClpSimplex *model, const int *whichColumn, int &numberColumnBasic, int *row, int *start, int *rowCount, int *columnCount, CoinFactorizationDouble *element)
Fills in column part of basis.
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpPackedMatrix3::start_
CoinBigIndex * start_
Starts for odd/long vectors??
Definition: ClpPackedMatrix.hpp:691
ClpPackedMatrix3::~ClpPackedMatrix3
virtual ~ClpPackedMatrix3()
Destructor.
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
ClpPackedMatrix::ClpPackedMatrix
ClpPackedMatrix()
Default constructor.
CoinPragma.hpp
ClpPackedMatrix::appendRows
virtual void appendRows(int number, const CoinPackedVectorBase *const *rows)
Append Rows.
CoinPackedMatrix::getVectorStarts
const CoinBigIndex * getVectorStarts() const
The positions where the major-dimension vectors start in elements and indices.
Definition: CoinPackedMatrix.hpp:158
ClpPackedMatrix::scaledColumnCopy
virtual ClpMatrixBase * scaledColumnCopy(ClpModel *model) const
Realy really scales column copy Only called if scales already exist.
DEVEX_ADD_ONE
#define DEVEX_ADD_ONE
Definition: AbcDualRowSteepest.hpp:163
ClpPackedMatrix::transposeTimesByColumn
void transposeTimesByColumn(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A in z.
ClpPackedMatrix::releasePackedMatrix
virtual void releasePackedMatrix() const
Allow any parts of a created CoinPackedMatrix to be deleted.
Definition: ClpPackedMatrix.hpp:188
CoinMax
T CoinMax(const T x1, const T x2)
Return the larger (according to operator&lt;() of the arguments.
Definition: CoinHelperFunctions.hpp:632
blockStruct::numberOnes_
int numberOnes_
Definition: ClpPackedMatrix.hpp:602
ClpPackedMatrix::reverseOrderedCopy
virtual ClpMatrixBase * reverseOrderedCopy() const
Returns a new matrix in reverse order without gaps.
ClpPackedMatrix2::~ClpPackedMatrix2
virtual ~ClpPackedMatrix2()
Destructor.
CoinPackedMatrix::getMutableElements
double * getMutableElements() const
A vector containing the elements in the packed matrix.
Definition: CoinPackedMatrix.hpp:713
ClpPackedMatrix::canDoPartialPricing
virtual bool canDoPartialPricing() const
Says whether it can do partial pricing.
ClpPackedMatrix3::row_
int * row_
Rows.
Definition: ClpPackedMatrix.hpp:693
CoinPackedMatrix::getElements
const double * getElements() const
A vector containing the elements in the packed matrix.
Definition: CoinPackedMatrix.hpp:126
blockStruct::numberInBlock_
int numberInBlock_
Definition: ClpPackedMatrix.hpp:591
ClpPackedMatrix::rangeOfElements
virtual void rangeOfElements(double &smallestNegative, double &largestNegative, double &smallestPositive, double &largestPositive)
Returns largest and smallest elements of both signs.
ClpPackedMatrix::canCombine
virtual bool canCombine(const ClpSimplex *model, const CoinIndexedVector *pi) const
Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster...
ClpPackedMatrix::zeros
bool zeros() const
Are there zeros?
Definition: ClpPackedMatrix.hpp:333
CoinPackedMatrix::getNumRows
int getNumRows() const
Number of rows.
Definition: CoinPackedMatrix.hpp:114
ClpPackedMatrix::checkGaps
void checkGaps()
Sets flags_ correctly.
Definition: ClpPackedMatrix.hpp:348
ClpPackedMatrix::getVectorLength
virtual int getVectorLength(int index) const
The length of a single major-dimension vector.
Definition: ClpPackedMatrix.hpp:87
ClpPackedMatrix::unpack
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector.
ClpPackedMatrix::transposeTimesByRow
virtual void transposeTimesByRow(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A in z.
ClpPackedMatrix::numberActiveColumns_
int numberActiveColumns_
number of active columns (normally same as number of columns)
Definition: ClpPackedMatrix.hpp:486
ClpPackedMatrix::dubiousWeights
virtual CoinBigIndex * dubiousWeights(const ClpSimplex *model, int *inputWeights) const
Given positive integer weights for each row fills in sum of weights for each column (and slack)...
ClpPackedMatrix::gutsOfTransposeTimesScaled
int gutsOfTransposeTimesScaled(const double *COIN_RESTRICT pi, const double *COIN_RESTRICT columnScale, int *COIN_RESTRICT index, double *COIN_RESTRICT array, const double tolerance) const
Meat of transposeTimes by column when scaled.
CoinPackedMatrix
Sparse Matrix Base Class.
Definition: CoinPackedMatrix.hpp:79
blockStruct::firstBasic_
int firstBasic_
Definition: ClpPackedMatrix.hpp:600
ClpPackedMatrix::reallyScale
virtual void reallyScale(const double *rowScale, const double *columnScale)
ClpPackedMatrix::flags
int flags() const
Flags.
Definition: ClpPackedMatrix.hpp:343
ClpPackedMatrix::appendCols
virtual void appendCols(int number, const CoinPackedVectorBase *const *columns)
Append Columns.
CoinPackedMatrix::replaceVector
void replaceVector(const int index, const int numReplace, const double *newElements)
Replace the elements of a vector.
ClpPackedMatrix::operator=
ClpPackedMatrix & operator=(const ClpPackedMatrix &)
ClpPackedMatrix::getElements
virtual const double * getElements() const
A vector containing the elements in the packed matrix.
Definition: ClpPackedMatrix.hpp:58
ClpPackedMatrix::isColOrdered
virtual bool isColOrdered() const
Whether the packed matrix is column major ordered or not.
Definition: ClpPackedMatrix.hpp:34
ClpPackedMatrix3::numberColumns_
int numberColumns_
Number of columns.
Definition: ClpPackedMatrix.hpp:677
ClpPackedMatrix::transposeTimes
virtual void transposeTimes(double scalar, const double *x, double *y) const
Return y + x * scalar * A in y.
ClpPackedMatrix::wantsSpecialColumnCopy
bool wantsSpecialColumnCopy() const
Do we want special column copy.
Definition: ClpPackedMatrix.hpp:338
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:136
CoinPackedMatrix::getVectorLengths
const int * getVectorLengths() const
The lengths of the major-dimension vectors.
Definition: CoinPackedMatrix.hpp:164
ClpPackedMatrix::partialPricing
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
ClpPackedMatrix::getVectorLengths
virtual const int * getVectorLengths() const
The lengths of the major-dimension vectors.
Definition: ClpPackedMatrix.hpp:82
ClpPackedMatrix2::count_
unsigned short * count_
Counts of elements in each part of row.
Definition: ClpPackedMatrix.hpp:574
blockStruct::startElements_
CoinBigIndex startElements_
Definition: ClpPackedMatrix.hpp:588
ClpPackedMatrix::matrix
CoinPackedMatrix * matrix() const
Returns CoinPackedMatrix (non const)
Definition: ClpPackedMatrix.hpp:314
ClpPackedMatrix::setDimensions
virtual void setDimensions(int numrows, int numcols)
Set the dimensions of the matrix.
ClpPackedMatrix::gutsOfTransposeTimesByRowGEK
int gutsOfTransposeTimesByRowGEK(const CoinIndexedVector *COIN_RESTRICT piVector, int *COIN_RESTRICT index, double *COIN_RESTRICT output, int numberColumns, const double tolerance, const double scalar) const
Meat of transposeTimes by row n &gt; K if packed - returns number nonzero.
ClpPackedMatrix3::temporary_
CoinDoubleArrayWithLength * temporary_
Temporary work area (aligned)
Definition: ClpPackedMatrix.hpp:697
blockStruct::firstAtUpper_
int firstAtUpper_
Definition: ClpPackedMatrix.hpp:599
CoinPackedMatrix::getIndices
const int * getIndices() const
A vector containing the minor indices of the elements in the packed matrix.
Definition: CoinPackedMatrix.hpp:136
ClpPrimalColumnSteepest.hpp
ClpPackedMatrix::gutsOfTransposeTimesUnscaled
int gutsOfTransposeTimesUnscaled(const double *COIN_RESTRICT pi, int *COIN_RESTRICT index, double *COIN_RESTRICT array, const double tolerance) const
Meat of transposeTimes by column when not scaled.
CoinWorkDouble
double CoinWorkDouble
Definition: CoinTypes.hpp:53
ClpPackedMatrix3::numberBlocks_
int numberBlocks_
Number of blocks.
Definition: ClpPackedMatrix.hpp:675
ClpPackedMatrix::releaseSpecialColumnCopy
void releaseSpecialColumnCopy()
Say we don&#39;t want special column copy.
ClpPackedMatrix::useEffectiveRhs
void useEffectiveRhs(ClpSimplex *model)
Sets up an effective RHS.
ClpPackedMatrix3::transposeTimes
void transposeTimes(const ClpSimplex *model, const double *pi, CoinIndexedVector *output) const
Return x * -1 * A in z.
ClpPackedMatrix::~ClpPackedMatrix
virtual ~ClpPackedMatrix()
Destructor.
ClpPackedMatrix::gutsOfTransposeTimesByRowEQ1
void gutsOfTransposeTimesByRowEQ1(const CoinIndexedVector *piVector, CoinIndexedVector *output, const double tolerance, const double scalar) const
Meat of transposeTimes by row n == 1 if packed.
blockStruct::numberScan_
int numberScan_
Definition: ClpPackedMatrix.hpp:592
ClpPackedMatrix2::numberRows_
int numberRows_
Number of rows.
Definition: ClpPackedMatrix.hpp:570
ClpPackedMatrix::subsetTimes2
virtual void subsetTimes2(const ClpSimplex *model, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *dj2, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
Updates second array for steepest and does devex weights.
ClpPackedMatrix::modifyCoefficient
virtual void modifyCoefficient(int row, int column, double newElement, bool keepZero=false)
Modify one element of packed matrix.
Definition: ClpPackedMatrix.hpp:121
ClpPackedMatrix::subsetClone
virtual ClpMatrixBase * subsetClone(int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
Subset clone (without gaps).
ClpPackedMatrix3::sortBlocks
void sortBlocks(const ClpSimplex *model)
Sort blocks.
ClpPackedMatrix::refresh
virtual int refresh(ClpSimplex *model)
makes sure active columns correct
ClpPackedMatrix::rowCopy_
ClpPackedMatrix2 * rowCopy_
Special row copy.
Definition: ClpPackedMatrix.hpp:496
ClpPackedMatrix::gutsOfTransposeTimesByRowGE3a
int gutsOfTransposeTimesByRowGE3a(const CoinIndexedVector *COIN_RESTRICT piVector, int *COIN_RESTRICT index, double *COIN_RESTRICT output, int *COIN_RESTRICT lookup, char *COIN_RESTRICT marked, const double tolerance, const double scalar) const
Meat of transposeTimes by row n &gt; 2 if packed - returns number nonzero.
ClpPackedMatrix2::work_
double * work_
work arrays
Definition: ClpPackedMatrix.hpp:580
ClpPackedMatrix2::rowStart_
CoinBigIndex * rowStart_
Row starts.
Definition: ClpPackedMatrix.hpp:576
ClpPackedMatrix::unpackPacked
virtual void unpackPacked(ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector in packed foramt Note that model is NOT const...
ClpPackedMatrix::getIndices
virtual const int * getIndices() const
A vector containing the minor indices of the elements in the packed matrix.
Definition: ClpPackedMatrix.hpp:72
ClpPackedMatrix3::block_
blockStruct * block_
Blocks (ordinary start at 0 and go to first block)
Definition: ClpPackedMatrix.hpp:703
blockStruct::firstAtLower_
int firstAtLower_
Definition: ClpPackedMatrix.hpp:598
ClpPackedMatrix3::operator=
ClpPackedMatrix3 & operator=(const ClpPackedMatrix3 &)
ClpPackedMatrix2::ClpPackedMatrix2
ClpPackedMatrix2()
Default constructor.
ClpPackedMatrix::getNumCols
virtual int getNumCols() const
Number of columns.
Definition: ClpPackedMatrix.hpp:44
ClpPackedMatrix::getMutableElements
double * getMutableElements() const
Mutable elements.
Definition: ClpPackedMatrix.hpp:63
ClpPackedMatrix2::numberBlocks_
int numberBlocks_
Number of blocks.
Definition: ClpPackedMatrix.hpp:568
ClpPackedMatrix::transposeTimes2
virtual int transposeTimes2(const ClpSimplex *model, const CoinIndexedVector *pi1, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *spare, double *infeas, double *reducedCost, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
Updates two arrays for steepest and does devex weights Returns nonzero if updates reduced cost and in...
ClpPackedMatrix3::ClpPackedMatrix3
ClpPackedMatrix3()
Default constructor.
ClpPackedMatrix3::maxBlockSize_
int maxBlockSize_
Maximum size of any block.
Definition: ClpPackedMatrix.hpp:687
ClpPackedMatrix::makeSpecialColumnCopy
void makeSpecialColumnCopy()
Say we want special column copy.
Definition: ClpPackedMatrix.hpp:326