Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinAbcBaseFactorization.hpp
Go to the documentation of this file.
1 /* $Id: CoinAbcBaseFactorization.hpp 1910 2013-01-27 02:00:13Z stefan $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 /*
7  Authors
8 
9  John Forrest
10 
11  */
18 #include "AbcCommon.hpp"
20 #if ABC_PARALLEL
21 #define FACTOR_CPU 4
22 #else
23 #define FACTOR_CPU 1
24 #endif
25 #define LARGE_SET COIN_INT_MAX-10
26 #define LARGE_UNSET (LARGE_SET+1)
27 
28 class CoinAbcTypeFactorization : public
30 {
31  friend void CoinAbcFactorizationUnitTest( const std::string & mpsDir );
32 
33 public:
34 
43 
45  virtual ~CoinAbcTypeFactorization ( );
47  virtual CoinAbcAnyFactorization * clone() const ;
49  void almostDestructor();
51  void show_self ( ) const;
53  void sort ( ) const;
57 
62 
64 
67  inline CoinSimplexInt *permute ( ) const {
69  return NULL; //permute_.array();
70  }
72  virtual inline CoinSimplexInt * indices() const
73  { return indexRowU_.array();}
75  virtual inline CoinSimplexInt *pivotColumn ( ) const {
76  return pivotColumn_.array();
77  }
79  virtual inline CoinFactorizationDouble *pivotRegion ( ) const {
80  return pivotRegionAddress_;
81  }
82 #if ABC_SMALL<2
83  inline CoinBigIndex * startRowL() const
85  { return startRowL_.array();}
86 #endif
87 
89  inline CoinBigIndex * startColumnL() const
90  { return startColumnL_.array();}
91 
92 #if ABC_SMALL<2
93  inline CoinSimplexInt * indexColumnL() const
95  { return indexColumnL_.array();}
96 #endif
97 
99  inline CoinSimplexInt * indexRowL() const
100  { return indexRowL_.array();}
101 
102 #if ABC_SMALL<2
103  inline CoinFactorizationDouble * elementByRowL() const
105  { return elementByRowL_.array();}
106 #endif
107 
111  { return firstCount_.array()+numberRows_+1;}
113  { return firstCount_.array()+2*numberRows_+3;}
114  inline CoinSimplexInt * pivotLOrder() const
115  { return firstCount_.array();}
116 #if ABC_SMALL<0
117 #define ABC_USE_FUNCTION_POINTERS 0
118 #define SMALL_PERMUTE
119 #endif
120 #ifdef ABC_USE_FUNCTION_POINTERS
122 #if ABC_USE_FUNCTION_POINTERS
123  typedef struct {
124  scatterUpdate functionPointer;
125  CoinBigIndex offset;
126  int number;
127  } scatterStruct;
128 #else
129  typedef struct {
130  CoinBigIndex offset;
131  int number;
132  } scatterStruct;
133 #endif
134  inline scatterStruct * scatterUColumn() const
136  { return scatterPointersUColumnAddress_;}
137 #endif
138 
140 
143  inline CoinSimplexInt * firstCount() const
144  { return firstCount_.array();}
145 
147  inline CoinSimplexInt * nextCount() const
148  { return firstCount_.array()+numberRows_+2;}
149 
151  inline CoinSimplexInt * lastCount() const
152  { return firstCount_.array()+3*numberRows_+2;}
153 
155  inline CoinSimplexInt numberRowsExtra ( ) const {
156  return numberRowsExtra_;
157  }
159  inline CoinBigIndex numberL() const
160  { return numberL_;}
161 
163  inline CoinBigIndex baseL() const
164  { return baseL_;}
166  inline CoinSimplexInt maximumRowsExtra ( ) const {
167  return maximumRowsExtra_;
168  }
170  virtual inline CoinBigIndex numberElements ( ) const {
171  return totalElements_;
172  }
176  }
180  inline CoinSimplexInt messageLevel ( ) const {
181  return messageLevel_ ;
182  }
183  void messageLevel ( CoinSimplexInt value );
185  virtual void maximumPivots ( CoinSimplexInt value );
186 
187 #if ABC_SMALL<4
188  inline CoinSimplexInt denseThreshold() const
190  { return denseThreshold_;}
193  { denseThreshold_ = value;}
194 #endif
197 #if 0
198  inline bool forrestTomlin() const
200  { return doForrestTomlin_;}
201  inline void setForrestTomlin(bool value)
202  { doForrestTomlin_=value;}
203 #endif
204  inline bool spaceForForrestTomlin() const
206  {
208  CoinBigIndex space = lengthAreaU_ - ( start + numberRowsExtra_ );
209  return (space>=0); //&&doForrestTomlin_;
210  }
212 
215 
216 
218  inline CoinBigIndex numberElementsU ( ) const {
219  return lengthU_;
220  }
222  inline void setNumberElementsU(CoinBigIndex value)
223  { lengthU_ = value; }
225  inline CoinBigIndex lengthAreaU ( ) const {
226  return lengthAreaU_;
227  }
229  inline CoinBigIndex numberElementsL ( ) const {
230  return lengthL_;
231  }
233  inline CoinBigIndex lengthAreaL ( ) const {
234  return lengthAreaL_;
235  }
237  inline CoinBigIndex numberElementsR ( ) const {
238  return lengthR_;
239  }
242  { return numberCompressions_;}
244  //virtual CoinSimplexInt * pivotRow() const;
246  //virtual CoinFactorizationDouble * workArea() const;
248  //virtual CoinSimplexInt * intWorkArea() const;
250  virtual inline CoinBigIndex * starts() const
251  { return startColumnU_.array();}
253  virtual inline CoinSimplexInt * numberInRow() const
254  { return numberInRow_.array();}
256  virtual inline CoinSimplexInt * numberInColumn() const
257  { return numberInColumn_.array();}
259  virtual inline CoinFactorizationDouble * elements() const
260  { return elementU_.array();}
262  inline CoinBigIndex * startColumnR() const
263  {return reinterpret_cast<CoinBigIndex *>(firstCount_.array()+3*numberRows_+4);}
266  { return elementU_.array();}
268  inline CoinSimplexInt * indexRowU() const
269  { return indexRowU_.array();}
271  inline CoinBigIndex * startColumnU() const
272  { return startColumnU_.array();}
273 #if COIN_BIG_DOUBLE==1
274  void toLongArray(CoinIndexedVector * vector,int which) const;
277  void fromLongArray(CoinIndexedVector * vector) const;
279  void fromLongArray(int which) const;
281  long double * denseVector(CoinIndexedVector * vector) const;
283  long double * denseVector(CoinIndexedVector & vector) const;
285  const long double * denseVector(const CoinIndexedVector * vector) const;
287  const long double * denseVector(const CoinIndexedVector & vector) const;
289  void scan(CoinIndexedVector * vector) const;
291  void clearHiddenArrays();
292 #else
293  inline double * denseVector(CoinIndexedVector * vector) const
295  {return vector->denseVector();}
296  inline double * denseVector(CoinIndexedVector & vector) const
297  {return vector.denseVector();}
299  inline const double * denseVector(const CoinIndexedVector * vector) const
300  {return vector->denseVector();}
301  inline const double * denseVector(const CoinIndexedVector & vector) const
302  {return vector.denseVector();}
304  inline void toLongArray(CoinIndexedVector * vector,int which) const {}
306  inline void fromLongArray(CoinIndexedVector * vector) const {}
308  inline void fromLongArray(int which) const {}
310  inline void scan(CoinIndexedVector * vector) const
311  {vector->scan(0,numberRows_,zeroTolerance_);}
312 #endif
313 #ifdef ABC_ORDERED_FACTORIZATION
314  void permuteInForFtran(CoinIndexedVector & regionSparse,bool full=false) const ;
317  void permuteInForBtranAndMultiply(CoinIndexedVector & regionSparse, bool full=false) const ;
319  void permuteOutForBtran(CoinIndexedVector & regionSparse) const ;
320 #endif
321 
326  //inline CoinSimplexInt persistenceFlag() const
327  //{ return persistenceFlag_;}
329 
332 #if 0
333 
337  virtual int checkReplace ( const AbcSimplex * model,
338  CoinIndexedVector * regionSparse,
339  int pivotRow,
340  CoinSimplexDouble & pivotCheck,
341  double acceptablePivot = 1.0e-8);
346  virtual CoinSimplexInt replaceColumn ( CoinIndexedVector * regionSparse,
348  CoinSimplexDouble pivotCheck ,
349  bool skipBtranU=false,
350  CoinSimplexDouble acceptablePivot=1.0e-8);
351 #endif
352 
356  virtual
357 #ifdef ABC_LONG_FACTORIZATION
358  long
359 #endif
360  double checkReplacePart1 ( CoinIndexedVector * regionSparse,
361  int pivotRow);
366  virtual
367 #ifdef ABC_LONG_FACTORIZATION
368  long
369 #endif
370  double checkReplacePart1 ( CoinIndexedVector * regionSparse,
371  CoinIndexedVector * partialUpdate,
372  int pivotRow);
373 #ifdef MOVE_REPLACE_PART1A
374 
378  virtual void checkReplacePart1a ( CoinIndexedVector * regionSparse,
379  int pivotRow);
380  virtual
381 #ifdef ABC_LONG_FACTORIZATION
382  long
383 #endif
384  double checkReplacePart1b ( CoinIndexedVector * regionSparse,
385  int pivotRow);
386 #endif
387 
389  virtual int checkReplacePart2 ( int pivotRow,
390  CoinSimplexDouble btranAlpha,
391  double ftranAlpha,
392 #ifdef ABC_LONG_FACTORIZATION
393  long
394 #endif
395  double ftAlpha,
396  double acceptablePivot = 1.0e-8);
399  virtual void replaceColumnPart3 ( const AbcSimplex * model,
400  CoinIndexedVector * regionSparse,
401  CoinIndexedVector * tableauColumn,
402  int pivotRow,
403 #ifdef ABC_LONG_FACTORIZATION
404  long
405 #endif
406  double alpha );
409  virtual void replaceColumnPart3 ( const AbcSimplex * model,
410  CoinIndexedVector * regionSparse,
411  CoinIndexedVector * tableauColumn,
412  CoinIndexedVector * partialUpdate,
413  int pivotRow,
414 #ifdef ABC_LONG_FACTORIZATION
415  long
416 #endif
417  double alpha );
418 #ifdef EARLY_FACTORIZE
419  virtual int replaceColumns ( const AbcSimplex * model,
421  CoinIndexedVector & stuff,
422  int firstPivot,int lastPivot,bool cleanUp);
423 #endif
424  void updatePartialUpdate(CoinIndexedVector & partialUpdate);
427  inline virtual bool wantsTableauColumn() const
428  {return false;}
432  int replaceColumnU ( CoinIndexedVector * regionSparse,
433  CoinBigIndex * deletedPosition,
434  CoinSimplexInt * deletedColumns,
437 
440 
442 
448  virtual CoinSimplexInt updateColumnFT ( CoinIndexedVector & regionSparse);
449  virtual int updateColumnFTPart1 ( CoinIndexedVector & regionSparse) ;
450  virtual void updateColumnFTPart2 ( CoinIndexedVector & regionSparse) ;
454  virtual void updateColumnFT ( CoinIndexedVector & regionSparseFT,
455  CoinIndexedVector & partialUpdate,
456  int which);
459  virtual CoinSimplexInt updateColumn ( CoinIndexedVector & regionSparse) const;
466  CoinIndexedVector & regionOther);
471  virtual CoinSimplexInt updateColumnTranspose ( CoinIndexedVector & regionSparse) const;
473  virtual void updateFullColumn ( CoinIndexedVector & regionSparse) const;
475  virtual void updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const;
477  virtual void updateWeights ( CoinIndexedVector & regionSparse) const;
479  virtual void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const;
481  virtual void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const;
482  void unpack ( CoinIndexedVector * regionFrom,
483  CoinIndexedVector * regionTo) const;
484  void pack ( CoinIndexedVector * regionFrom,
485  CoinIndexedVector * regionTo) const;
487  inline void goSparse() {}
488  void goSparse2();
489 #ifndef NDEBUG
490  virtual void checkMarkArrays() const;
491 #endif
492 #if ABC_SMALL<2
493 
495  { return sparseThreshold_;}
496 #endif
497 
498  void sparseThreshold ( CoinSimplexInt value );
500 
505  inline void clearArrays()
507  { gutsOfDestructor();}
509 
510  void checkSparse();
513  void gutsOfDestructor(CoinSimplexInt type=1);
515  void gutsOfInitialize(CoinSimplexInt type);
516  void gutsOfCopy(const CoinAbcTypeFactorization &other);
517 
519  void resetStatistics();
520  void printRegion(const CoinIndexedVector & vector, const char * where) const;
521 
523 
525  virtual void getAreas ( CoinSimplexInt numberRows,
527  CoinSimplexInt numberColumns,
528  CoinBigIndex maximumL,
529  CoinBigIndex maximumU );
530 
532  virtual void preProcess ( );
533  void preProcess (CoinSimplexInt );
535  double preProcess3 ( );
536  void preProcess4 ( );
538  virtual CoinSimplexInt factor (AbcSimplex * model);
539 #ifdef EARLY_FACTORIZE
540  virtual int factorize (AbcSimplex * model, CoinIndexedVector & stuff);
542 #endif
543  virtual void postProcess(const CoinSimplexInt * sequence, CoinSimplexInt * pivotVariable);
546  virtual void makeNonSingular(CoinSimplexInt * sequence);
547 protected:
554 
568  int wantToGoDense();
569 
574  bool getColumnSpace ( CoinSimplexInt iColumn,
575  CoinSimplexInt extraNeeded );
576 
579  bool reorderU();
584  CoinSimplexInt iRow);
591  CoinSimplexInt iRow);
595  bool getRowSpace ( CoinSimplexInt iRow, CoinSimplexInt extraNeeded );
596 
601  CoinSimplexInt extraNeeded );
603  void checkConsistency ( );
604 //#define CHECK_LINKS
605 #ifdef CHECK_LINKS
606  void checkLinks(int x=0);
607 #else
608 # define checkLinks(x)
609 #endif
610  inline void addLink ( CoinSimplexInt index, CoinSimplexInt count ) {
615  CoinSimplexInt next = firstCount[count];
616  firstCount[count] = index;
617  nextCount[index] = next;
618  lastCount[index] = count-numberRows_-2; // points to firstCount[count]
619  if (next>=0)
620  lastCount[next] = index;
621  }
623  inline void deleteLink ( CoinSimplexInt index ) {
626  CoinSimplexInt next = nextCount[index];
627  CoinSimplexInt last = lastCount[index];
628  assert (next!=index);
629  assert (last!=index);
630  if (next>=0)
631  lastCount[next] = last;
632  if (last>=0) {
633  nextCount[last] = next;
634  } else {
635  int count=last+numberRows_+2;
637  firstCount[count]=next;
638  }
639  }
641  inline void modifyLink ( CoinSimplexInt index, CoinSimplexInt count ) {
645  CoinSimplexInt next2 = firstCount[count];
646  if (next2==index)
647  return;
648  firstCount[count] = index;
649  CoinSimplexInt next = nextCount[index];
650  CoinSimplexInt last = lastCount[index];
651  assert (next!=index);
652  assert (last!=index);
653  nextCount[index] = next2;
654  lastCount[index] = count-numberRows_-2; // points to firstCount[count]
655  if (next>=0)
656  lastCount[next] = last;
657  if (next2>=0)
658  lastCount[next2] = index;
659  if (last>=0) {
660  nextCount[last] = next;
661  } else {
662  int count=last+numberRows_+2;
663  firstCount[count]=next;
664  }
665  }
667  void separateLinks();
670  void cleanup ( );
672  void doAddresses();
673 
675  void updateColumnL ( CoinIndexedVector * region
676 #if ABC_SMALL<2
677  , CoinAbcStatistics & statistics
678 #endif
679 #if ABC_PARALLEL
680  ,int whichSparse=0
681 #endif
682  ) const;
684  void updateColumnLDensish ( CoinIndexedVector * region ) const;
686  void updateColumnLDense ( CoinIndexedVector * region ) const;
688  void updateColumnLSparse ( CoinIndexedVector * region
689 #if ABC_PARALLEL
690  ,int whichSparse
691 #endif
692  ) const;
693 
695  void updateColumnR ( CoinIndexedVector * region
696 #if ABC_SMALL<2
697  , CoinAbcStatistics & statistics
698 #endif
699 #if ABC_PARALLEL
700  ,int whichSparse=0
701 #endif
702  ) const;
704  bool storeFT(
705 #if ABC_SMALL<3
706  const
707 #endif
708  CoinIndexedVector * regionFT);
710  void updateColumnU ( CoinIndexedVector * region
711 #if ABC_SMALL<2
712  , CoinAbcStatistics & statistics
713 #endif
714 #if ABC_PARALLEL
715  ,int whichSparse=0
716 #endif
717  ) const;
718 
720  void updateColumnUSparse ( CoinIndexedVector * regionSparse
721 #if ABC_PARALLEL
722  ,int whichSparse
723 #endif
724  ) const;
726  void updateColumnUDensish ( CoinIndexedVector * regionSparse) const;
728  void updateColumnUDense ( CoinIndexedVector * regionSparse) const;
731  CoinSimplexInt & numberNonZero1,
733  CoinSimplexInt * COIN_RESTRICT index1,
734  CoinSimplexInt & numberNonZero2,
736  CoinSimplexInt * COIN_RESTRICT index2) const;
738  void updateColumnPFI ( CoinIndexedVector * regionSparse) const;
740  void updateColumnTransposePFI ( CoinIndexedVector * region) const;
744  CoinSimplexInt smallestIndex
745 #if ABC_SMALL<2
746  , CoinAbcStatistics & statistics
747 #endif
748 #if ABC_PARALLEL
749  ,int whichCpu
750 #endif
751  ) const;
755  CoinSimplexInt smallestIndex) const;
759 #if ABC_PARALLEL
760  ,int whichSparse
761 #endif
762  ) const;
766  CoinSimplexInt smallestIndex) const;
767 
770 #if ABC_SMALL<2
771  , CoinAbcStatistics & statistics
772 #endif
773  ) const;
775  void updateColumnTransposeRDensish ( CoinIndexedVector * region ) const;
777  void updateColumnTransposeRSparse ( CoinIndexedVector * region ) const;
778 
781 #if ABC_SMALL<2
782  , CoinAbcStatistics & statistics
783 #endif
784 #if ABC_PARALLEL
785  ,int whichSparse
786 #endif
787  ) const;
789  void updateColumnTransposeLDensish ( CoinIndexedVector * region ) const;
791  void updateColumnTransposeLByRow ( CoinIndexedVector * region ) const;
794 #if ABC_PARALLEL
795  ,int whichSparse
796 #endif
797  ) const;
798 public:
805 protected:
812  CoinBigIndex pivotRowPosition,
813  CoinBigIndex pivotColumnPosition,
816  CoinSimplexInt increment2,
817  int * COIN_RESTRICT markRow );
818  int pivot ( CoinSimplexInt & pivotRow,
820  CoinBigIndex pivotRowPosition,
821  CoinBigIndex pivotColumnPosition,
822  int * COIN_RESTRICT markRow );
823 #if ABC_SMALL<2
824 #define CONVERTROW 2
825 #elif ABC_SMALL<4
826 #else
827 #undef ABC_DENSE_CODE
828 #define ABC_DENSE_CODE 0
829 #endif
830 
832 protected:
834 
844 #ifdef ABC_USE_FUNCTION_POINTERS
845  scatterStruct * scatterPointersUColumnAddress_;
847  CoinFactorizationDouble * elementUColumnPlusAddress_;
848 #endif
850 #if CONVERTROW
852 #if CONVERTROW>1
854 #endif
855 #endif
856 #if ABC_SMALL<2
858 #endif
872  //CoinSimplexInt * saveColumnAddress2_;
878 #if ABC_SMALL<2
880 #endif
891 #if ABC_SMALL<4
893 #endif
897 #ifdef SMALL_PERMUTE
898  CoinSimplexInt * fromSmallToBigRow_;
899  CoinSimplexInt * fromSmallToBigColumn_;
900 #endif
916 #if ABC_SMALL<2
919 #endif
944 #ifdef ABC_USE_FUNCTION_POINTERS
945  CoinBigIndex lastEntryByColumnUPlus_;
948  CoinBigIndex lengthAreaUPlus_;
949 #endif
954 #if ABC_SMALL<4
957 #endif
958 #if COIN_BIG_DOUBLE==1
962  mutable CoinIndexedVector * associatedVector_[FACTOR_CPU];
963 #endif
1001 #ifdef ABC_USE_FUNCTION_POINTERS
1002  CoinArbitraryArrayWithLength scatterUColumn_;
1004 #endif
1005 #if CONVERTROW
1008 #if CONVERTROW>1
1011 #endif
1012 #endif
1013 #if ABC_SMALL<2
1016 #endif
1023 #if ABC_SMALL<4
1026 #endif
1031 #if ABC_SMALL<2
1040 #endif
1045  // last slack pivot row
1047 #if ABC_SMALL<2
1048  mutable double ftranCountInput_;
1050  mutable double ftranCountAfterL_;
1051  mutable double ftranCountAfterR_;
1052  mutable double ftranCountAfterU_;
1056 #if FACTORIZATION_STATISTICS
1057  double ftranTwiddleFactor1_;
1058  double ftranTwiddleFactor2_;
1059 #endif
1061 #endif
1064 #if ABC_SMALL<2
1065  mutable double ftranFTCountInput_;
1066  mutable double ftranFTCountAfterL_;
1067  mutable double ftranFTCountAfterR_;
1068  mutable double ftranFTCountAfterU_;
1072 #if FACTORIZATION_STATISTICS
1073  double ftranFTTwiddleFactor1_;
1074  double ftranFTTwiddleFactor2_;
1075 #endif
1077 #endif
1078 #if ABC_SMALL<4
1081 #endif
1082 #if ABC_SMALL<2
1083  mutable double btranCountInput_;
1084  mutable double btranCountAfterU_;
1085  mutable double btranCountAfterR_;
1086  mutable double btranCountAfterL_;
1090 #if FACTORIZATION_STATISTICS
1091  double btranTwiddleFactor1_;
1092  double btranTwiddleFactor2_;
1093 #endif
1095 #endif
1098 #if ABC_SMALL<2
1099  mutable double ftranFullCountInput_;
1101  mutable double ftranFullCountAfterL_;
1102  mutable double ftranFullCountAfterR_;
1103  mutable double ftranFullCountAfterU_;
1107 #if FACTORIZATION_STATISTICS
1108  double ftranFullTwiddleFactor1_;
1109  double ftranFullTwiddleFactor2_;
1110 #endif
1112 #endif
1115 #if ABC_SMALL<2
1116  mutable double btranFullCountInput_;
1118  mutable double btranFullCountAfterL_;
1119  mutable double btranFullCountAfterR_;
1120  mutable double btranFullCountAfterU_;
1124 #if FACTORIZATION_STATISTICS
1125  double btranFullTwiddleFactor1_;
1126  double btranFullTwiddleFactor2_;
1127 #endif
1129 #endif
1130 
1139 public:
1140 #if ABC_SMALL<2
1141 #if ABC_SMALL>=0
1142  inline bool gotLCopy() const {return ((state_&ABC_FAC_GOT_LCOPY)!=0);}
1145  inline bool gotRCopy() const {return ((state_&ABC_FAC_GOT_RCOPY)!=0);}
1148  inline bool gotUCopy() const {return ((state_&ABC_FAC_GOT_UCOPY)!=0);}
1151  inline bool gotSparse() const {return ((state_&ABC_FAC_GOT_SPARSE)!=0);}
1154 #else
1155  // force use of copies
1156  inline bool gotLCopy() const {return true;}
1157  inline void setNoGotLCopy() {}
1158  inline void setYesGotLCopy() {}
1159  inline bool gotRCopy() const {return true;}
1160  inline void setNoGotRCopy() {}
1161  inline void setYesGotRCopy() {}
1162  inline bool gotUCopy() const {return true;}
1163  inline void setNoGotUCopy() {}
1164  inline void setYesGotUCopy() {}
1165  inline bool gotSparse() const {return true;}
1166  inline void setNoGotSparse() {}
1167  inline void setYesGotSparse() {}
1168 #endif
1169 #else
1170  // force no use of copies
1171  inline bool gotLCopy() const {return false;}
1172  inline void setNoGotLCopy() {}
1173  inline void setYesGotLCopy() {}
1174  inline bool gotRCopy() const {return false;}
1175  inline void setNoGotRCopy() {}
1176  inline void setYesGotRCopy() {}
1177  inline bool gotUCopy() const {return false;}
1178  inline void setNoGotUCopy() {}
1179  inline void setYesGotUCopy() {}
1180  inline bool gotSparse() const {return false;}
1181  inline void setNoGotSparse() {}
1182  inline void setYesGotSparse() {}
1183 #endif
1184 
1189  //CoinSimplexInt persistenceFlag_;
1191 };
1192 
1193 
CoinBigIndex numberL_
Number in L.
CoinBigIndex * array() const
Get Array.
void updateColumnTransposeRDensish(CoinIndexedVector *region) const
Updates part of column transpose (BTRANR) when dense.
CoinIntArrayWithLength lastRow_
Previous Row in memory order.
CoinBigIndexArrayWithLength startRowL_
Start of each row in L.
void gutsOfInitialize(CoinSimplexInt type)
1 bit - tolerances etc, 2 more, 4 dummy arrays
void updateColumnTransposeUSparse(CoinIndexedVector *region) const
Updates part of column transpose (BTRANU) when sparse, assumes index is sorted i.e.
int numberRows_
Number of Rows in factorization.
CoinBigIndex * startColumnR() const
Start of columns for R.
CoinIntArrayWithLength indexRowL_
Row indices of L.
CoinSimplexInt maximumMaximumPivots_
Maximum maximum pivots.
double * denseVector(CoinIndexedVector &vector) const
void updatePartialUpdate(CoinIndexedVector &partialUpdate)
Update partial Ftran by R update.
CoinSimplexInt numberGoodL_
Number factorized in L.
virtual void getAreas(CoinSimplexInt numberRows, CoinSimplexInt numberColumns, CoinBigIndex maximumL, CoinBigIndex maximumU)
Gets space for a factorization, called by constructors.
CoinSimplexInt * indexColumnL() const
Index of column in row for L.
void setDenseThreshold(CoinSimplexInt value)
Sets dense threshold.
CoinFactorizationDoubleArrayWithLength pivotRegion_
Inverses of pivot values.
virtual int checkReplacePart2(int pivotRow, CoinSimplexDouble btranAlpha, double ftranAlpha, double ftAlpha, double acceptablePivot=1.0e-8)
Checks if can replace one Column to basis, returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots.
CoinSimplexInt maximumRowsExtra_
Maximum number of Rows after iterating.
CoinBigIndex numberElementsL() const
Returns number in L area.
CoinSimplexInt numberRowsExtra_
Number of Rows after iterating.
CoinSimplexInt denseThreshold_
Dense threshold (here to use double alignment)
CoinAbcTypeFactorization()
Default constructor.
void updateColumnTransposeL(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column transpose (BTRANL)
virtual void checkMarkArrays() const
#define ABC_PARALLEL
CoinIntArrayWithLength firstCount_
First Row/Column with count of k, can tell which by offset - Rows then Columns.
CoinBigIndex sizeSparseArray_
Size in bytes of a sparseArray.
virtual CoinAbcAnyFactorization * clone() const
Clone.
CoinIntArrayWithLength markRow_
Marks rows to be updated.
void fromLongArray(CoinIndexedVector *vector) const
From a work array and dis-associate vector.
CoinIntArrayWithLength lastColumn_
Previous Column in memory order.
void deleteLink(CoinSimplexInt index)
Deletes a link in chain of equal counts.
CoinSimplexInt numberTrials_
Number of trials before rejection.
CoinSimplexInt replaceColumnPFI(CoinIndexedVector *regionSparse, CoinSimplexInt pivotRow, CoinSimplexDouble alpha)
Replaces one Column to basis for PFI returns 0=OK, 1=Probably OK, 2=singular, 3=no room...
typedef void(COINLINKAGE_CB *clp_callback)(Clp_Simplex *model
typedef for user call back.
void setNumberElementsU(CoinBigIndex value)
Setss number in U area.
CoinBigIndex lengthL_
Length of L.
CoinFactorizationDoubleArrayWithLength elementRowU_
Elements of U by row.
CoinIntArrayWithLength indexColumnU_
Base address for U (may change)
CoinSimplexInt * lastCount() const
Previous Row/Column with count.
CoinFactorizationDouble * elementUAddress_
void updateTwoColumnsUDensish(CoinSimplexInt &numberNonZero1, CoinFactorizationDouble *COIN_RESTRICT region1, CoinSimplexInt *COIN_RESTRICT index1, CoinSimplexInt &numberNonZero2, CoinFactorizationDouble *COIN_RESTRICT region2, CoinSimplexInt *COIN_RESTRICT index2) const
Updates part of 2 columns (FTRANU) real work.
CoinFactorizationDouble * elementU() const
Elements of U.
CoinBigIndex firstZeroed_
First place in funny copy zeroed out.
Abstract base class which also has some scalars so can be used from Dense or Simp.
#define ABC_FAC_GOT_SPARSE
bool getRowSpaceIterate(CoinSimplexInt iRow, CoinSimplexInt extraNeeded)
Gets space for one Row with given length while iterating, may have to do compression (returns True i...
void addLink(CoinSimplexInt index, CoinSimplexInt count)
Adds a link in chain of equal counts.
friend void CoinAbcFactorizationUnitTest(const std::string &mpsDir)
void updateColumnUDensish(CoinIndexedVector *regionSparse) const
Updates part of column (FTRANU)
double preProcess3()
Return largest element.
CoinSimplexInt * lastCountAddress_
Previous Row/Column with count.
CoinBigIndex lengthAreaR_
length of area reserved for R
virtual CoinSimplexInt factor(AbcSimplex *model)
Does most of factorization.
CoinIntArrayWithLength numberInRow_
Number in each Row.
void checkConsistency()
Checks that row and column copies look OK.
CoinBigIndex baseL() const
Base of L.
CoinSimplexInt * pivotLinkedForwards() const
virtual CoinSimplexInt * numberInRow() const
Number of entries in each row.
const double * denseVector(const CoinIndexedVector &vector) const
void separateLinks()
Separate out links with same row/column count.
void updateColumnTransposeR(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column transpose (BTRANR)
CoinBigIndexArrayWithLength startColumnU_
Start of each column in U.
#define checkLinks(x)
double * denseVector() const
Get the vector as a dense vector.
CoinBigIndex * startColumnL() const
Start of each column in L.
int numberRows() const
Number of Rows after factorization.
bool pivotRowSingleton(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn)
Does one pivot on Row Singleton in factorization.
void updateColumnTransposeLDensish(CoinIndexedVector *region) const
Updates part of column transpose (BTRANL) when densish by column.
virtual void updateColumnTransposeCpu(CoinIndexedVector &regionSparse, int whichCpu) const
Updates one column (BTRAN)
CoinSimplexInt factorDense()
Does dense phase of factorization return code is &lt;0 error, 0= finished.
virtual void updateColumnFTPart2(CoinIndexedVector &regionSparse)
CoinBigIndex lengthR_
Length of R stuff.
virtual void updateWeights(CoinIndexedVector &regionSparse) const
Updates one column for dual steepest edge weights (FTRAN)
void checkSparse()
See if worth going sparse.
void doAddresses()
Set up addresses from arrays.
bool spaceForForrestTomlin() const
True if FT update and space.
void pivotColumnSingleton(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn)
Does one pivot on Column Singleton in factorization (can&#39;t return false)
CoinIntArrayWithLength numberInColumnPlus_
Number in each Column including pivoted.
CoinBigIndex * startColumnU() const
Start of each column in U.
CoinSimplexInt messageLevel() const
Level of detail of messages.
CoinBigIndex * startRowL() const
Start of each row in L.
void afterPivot(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn)
After pivoting.
CoinSimplexInt numberForrestTomlin() const
Length of FT vector.
CoinSimplexInt numberU_
Number in U.
CoinSimplexInt leadingDimension_
Leading dimension for dense.
virtual void preProcess()
PreProcesses column ordered copy of basis.
CoinSimplexInt numberRowsSmall_
Size of small inverse.
bool reorderU()
Reorders U so contiguous and in order (if there is space) Returns true if it could.
CoinSimplexInt * pivotLinkedBackwards() const
Forward and backward linked lists (numberRows_+2)
virtual int * pivotRow() const
Returns pivot row.
#define COIN_RESTRICT
CoinFactorizationDoubleArrayWithLength elementL_
Elements of L.
CoinFactorizationDouble * pivotRegionAddress_
CoinBigIndex lengthAreaL() const
Returns length of L area.
void clearArrays()
Get rid of all memory.
void(* scatterUpdate)(int, CoinFactorizationDouble, const CoinFactorizationDouble *, double *) SCATTER_ATTRIBUTE
virtual CoinSimplexInt updateColumn(CoinIndexedVector &regionSparse) const
This version has same effect as above with FTUpdate==false so number returned is always &gt;=0...
virtual CoinSimplexInt * numberInColumn() const
Number of entries in each column.
double CoinSimplexDouble
void unpack(CoinIndexedVector *regionFrom, CoinIndexedVector *regionTo) const
CoinBigIndex lastEntryByColumnU_
Last entry by column for U.
void updateColumnTransposeLByRow(CoinIndexedVector *region) const
Updates part of column transpose (BTRANL) when densish by row.
CoinBigIndex lastEntryByRowU_
Last entry by row for U.
void updateColumnUDense(CoinIndexedVector *regionSparse) const
Updates part of column (FTRANU) when dense (i.e. do as inner products)
virtual CoinSimplexInt updateColumnTranspose(CoinIndexedVector &regionSparse) const
Updates one column (BTRAN) from regionSparse2 regionSparse starts as zero and is zero at end Note - i...
int replaceColumnU(CoinIndexedVector *regionSparse, CoinBigIndex *deletedPosition, CoinSimplexInt *deletedColumns, CoinSimplexInt pivotRow)
Combines BtranU and store which elements are to be deleted returns number to be deleted.
CoinSimplexInt maximumRows_
Maximum rows (ever) (here to use double alignment)
#define ABC_FAC_GOT_UCOPY
CoinFactorizationDouble * array() const
Get Array.
CoinIntArrayWithLength nextColumn_
Next Column in memory order.
CoinSimplexInt * nextCount() const
Next Row/Column with count.
#define ABC_SMALL
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
void updateColumnTransposeUDensish(CoinIndexedVector *region, CoinSimplexInt smallestIndex) const
Updates part of column transpose (BTRANU) when densish, assumes index is sorted i.e.
CoinBigIndex numberL() const
Number in L.
void fromLongArray(int which) const
From a work array and dis-associate vector.
CoinSimplexInt * indexRowL() const
Row indices of L.
CoinSimplexUnsignedInt * workArea2Address_
double ftranCountInput_
To decide how to solve.
virtual int updateColumnFTPart1(CoinIndexedVector &regionSparse)
CoinIntArrayWithLength pivotColumn_
Pivot order for each Column.
virtual CoinSimplexInt * pivotColumn() const
Returns address of pivotColumn region (also used for permuting)
CoinFactorizationDouble * elementByRowLAddress_
virtual CoinSimplexInt updateColumnFT(CoinIndexedVector &regionSparse)
Later take out return codes (apart from +- 1 on FT)
CoinBigIndexArrayWithLength convertColumnToRowU_
Converts columns to rows in U.
CoinBigIndex * version.
CoinIntArrayWithLength numberInColumn_
Number in each Column.
Indexed Vector.
void gutsOfCopy(const CoinAbcTypeFactorization &other)
virtual CoinFactorizationDouble * elements() const
Returns array to put basis elements in.
int scan()
Scan dense region and set up indices (returns number found)
void updateColumnTransposeLSparse(CoinIndexedVector *region) const
Updates part of column transpose (BTRANL) when sparse (by Row)
CoinFactorizationDoubleArrayWithLength workArea_
First work area.
CoinBigIndex maximumU_
Maximum space used in U.
CoinIntArrayWithLength indexRowU_
Row indices of U.
CoinSimplexInt * nextCountAddress_
Next Row/Column with count.
CoinBigIndex lengthU_
Length of U.
CoinSimplexInt * indexRowRAddress_
Row indices for R.
void updateColumnL(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column (FTRANL)
void updateColumnTransposeRSparse(CoinIndexedVector *region) const
Updates part of column transpose (BTRANR) when sparse.
CoinBigIndexArrayWithLength startRowU_
Start of each Row as pointer.
CoinSimplexInt initialNumberRows_
Rows first time nonzero.
virtual void updateFullColumnTranspose(CoinIndexedVector &regionSparse) const
Updates one full column (BTRAN)
void updateColumnLDense(CoinIndexedVector *region) const
Updates part of column (FTRANL) when dense (i.e. do as inner products)
CoinFactorizationDouble * elementRAddress_
Elements of R.
void updateColumnR(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column (FTRANR) without FT update.
CoinFactorizationDouble * elementRowUAddress_
CoinSimplexDouble adjustedAreaFactor() const
Returns areaFactor but adjusted for dense.
CoinSimplexInt * permute() const
Returns address of permute region.
CoinBigIndex totalElements_
Number of elements in U (to go) or while iterating total overall.
CoinIntArrayWithLength nextRow_
Next Row in memory order.
CoinSimplexInt checkPivot(CoinSimplexDouble saveFromU, CoinSimplexDouble oldPivot) const
Returns accuracy status of replaceColumn returns 0=OK, 1=Probably OK, 2=singular. ...
unsigned char CoinCheckZero
CoinFactorizationDouble * workAreaAddress_
CoinUnsignedIntArrayWithLength workArea2_
Second work area.
CoinBigIndexArrayWithLength startColumnL_
Start of each column in L.
int pivot(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn, CoinBigIndex pivotRowPosition, CoinBigIndex pivotColumnPosition, CoinFactorizationDouble *COIN_RESTRICT work, CoinSimplexUnsignedInt *COIN_RESTRICT workArea2, CoinSimplexInt increment2, int *COIN_RESTRICT markRow)
0 fine, -99 singular, 2 dense
void toLongArray(CoinIndexedVector *vector, int which) const
To a work array and associate vector.
void resetStatistics()
Reset all sparsity etc statistics.
void updateColumnLSparse(CoinIndexedVector *region) const
Updates part of column (FTRANL) when sparse.
virtual CoinFactorizationDouble * pivotRegion() const
Returns address of pivot region.
CoinSimplexInt numberRowsLeft_
Number Rows left (numberRows-numberGood)
CoinAbcTypeFactorization & operator=(const CoinAbcTypeFactorization &other)
= copy
CoinSimplexDouble conditionNumber() const
Condition number - product of pivots after factorization.
CoinIntArrayWithLength sparse_
Sparse regions.
virtual ~CoinAbcTypeFactorization()
Destructor.
CoinSimplexInt state_
State of saved version and what can be done 0 - nothing saved 1 - saved and can go back to previous s...
virtual void checkReplacePart1a(CoinIndexedVector *, int)
void updateColumnU(CoinIndexedVector *region, CoinAbcStatistics &statistics) const
Updates part of column (FTRANU)
virtual void postProcess(const CoinSimplexInt *sequence, CoinSimplexInt *pivotVariable)
Does post processing on valid factorization - putting variables on correct rows.
CoinFactorizationDouble * elementLAddress_
CoinBigIndex numberElementsU() const
Returns number in U area.
void sort() const
Debug - sort so can compare.
CoinFactorizationDouble * denseAreaAddress_
CoinSimplexInt * pivotLOrder() const
void pack(CoinIndexedVector *regionFrom, CoinIndexedVector *regionTo) const
void printRegion(const CoinIndexedVector &vector, const char *where) const
virtual void updateColumnCpu(CoinIndexedVector &regionSparse, int whichCpu) const
Updates one column (FTRAN)
CoinFactorizationDouble * version.
bool storeFT(const CoinIndexedVector *regionFT)
Store update after doing L and R - retuns false if no room.
CoinFactorizationDouble * elementByRowL() const
Elements in L (row copy)
int CoinBigIndex
CoinSimplexInt numberRowsExtra() const
Number of Rows after iterating.
void scan(CoinIndexedVector *vector) const
Scans region to find nonzeros.
void updateColumnTransposeUByColumn(CoinIndexedVector *region, CoinSimplexInt smallestIndex) const
Updates part of column transpose (BTRANU) by column assumes index is sorted i.e.
virtual double checkReplacePart1(CoinIndexedVector *regionSparse, int pivotRow)
Checks if can replace one Column to basis, returns update alpha Fills in region for use later partial...
CoinFactorizationDoubleArrayWithLength elementU_
Elements of U.
virtual CoinBigIndex numberElements() const
Total number of elements in factorization.
CoinFactorizationDoubleArrayWithLength denseArea_
Dense area.
#define ABC_FAC_GOT_RCOPY
bool pivotOneOtherRow(CoinSimplexInt pivotRow, CoinSimplexInt pivotColumn)
Pivots when just one other row so faster?
void cleanup()
Cleans up at end of factorization.
CoinFactorizationLongDouble * version.
void updateColumnTransposePFI(CoinIndexedVector *region) const
Updates part of column transpose PFI (BTRAN) (before rest)
#define FACTOR_CPU
This deals with Factorization and Updates.
virtual void replaceColumnPart3(const AbcSimplex *model, CoinIndexedVector *regionSparse, CoinIndexedVector *tableauColumn, int pivotRow, double alpha)
Replaces one Column to basis, partial update already in U.
This deals with Factorization and Updates.
CoinSimplexInt messageLevel_
Detail in messages.
CoinBigIndex lengthAreaU() const
Returns length of U area.
virtual void updateFullColumn(CoinIndexedVector &regionSparse) const
Updates one full column (FTRAN)
CoinBigIndex lengthAreaL_
Length of area reserved for L.
virtual double checkReplacePart1b(CoinIndexedVector *, int)
int * array() const
Get Array.
void modifyLink(CoinSimplexInt index, CoinSimplexInt count)
Modifies links in chain of equal counts.
virtual bool wantsTableauColumn() const
Returns true if wants tableauColumn in replaceColumn.
CoinIntArrayWithLength saveColumn_
Columns left to do in a single pivot.
void updateColumnTransposeU(CoinIndexedVector *region, CoinSimplexInt smallestIndex, CoinAbcStatistics &statistics) const
Updates part of column transpose (BTRANU), assumes index is sorted i.e.
void updateColumnLDensish(CoinIndexedVector *region) const
Updates part of column (FTRANL) when densish.
double btranFullCountInput_
To decide how to solve.
virtual CoinSimplexInt updateTwoColumnsFT(CoinIndexedVector &regionFT, CoinIndexedVector &regionOther)
Updates one column (FTRAN) from region2 Tries to do FT update number returned is negative if no room...
CoinSimplexInt sparseThreshold_
Below this use sparse technology - if 0 then no L row copy.
CoinSimplexInt numberR_
Number in R.
void gutsOfDestructor(CoinSimplexInt type=1)
The real work of constructors etc 0 just scalars, 1 bit normal.
CoinFactorizationDoubleArrayWithLength elementByRowL_
Elements in L (row copy)
void updateColumnUSparse(CoinIndexedVector *regionSparse) const
Updates part of column (FTRANU) when sparse.
int CoinSimplexInt
CoinBigIndex getColumnSpaceIterate(CoinSimplexInt iColumn, CoinFactorizationDouble value, CoinSimplexInt iRow)
getColumnSpaceIterate.
bool getColumnSpaceIterateR(CoinSimplexInt iColumn, CoinFactorizationDouble value, CoinSimplexInt iRow)
getColumnSpaceIterateR.
int wantToGoDense()
After pivoting - returns true if need to go dense.
CoinBigIndex lengthAreaU_
Length of area reserved for U.
CoinSimplexInt * firstCount() const
For equal counts in factorization.
CoinIntArrayWithLength permute_
Permutation vector for pivot row order.
#define ABC_FAC_GOT_LCOPY
virtual void makeNonSingular(CoinSimplexInt *sequence)
Makes a non-singular basis by replacing variables.
CoinSimplexInt factorSparse()
Does sparse phase of factorization return code is &lt;0 error, 0= finished.
void show_self() const
Debug show object (shows one representation)
bool getColumnSpace(CoinSimplexInt iColumn, CoinSimplexInt extraNeeded)
Gets space for one Column with given length, may have to do compression (returns True if successful)...
void goSparse()
makes a row copy of L for speed and to allow very sparse problems
double * denseVector(CoinIndexedVector *vector) const
Returns double * associated with vector.
CoinSimplexInt maximumRowsExtra() const
Maximum of Rows after iterating.
CoinSimplexInt denseThreshold() const
Gets dense threshold.
CoinBigIndex numberElementsR() const
Returns number in R area.
CoinBigIndex numberCompressions() const
Number of compressions done.
CoinSimplexDouble maximumCoefficient() const
Returns maximum absolute value in factorization.
CoinSimplexInt sparseThreshold() const
get sparse threshold
CoinSimplexInt * indexRowU() const
Row indices of U.
double ftranFullCountInput_
To decide how to solve.
virtual CoinSimplexInt * indices() const
Returns array to put basis indices in.
int maximumPivots() const
Maximum number of pivots between factorizations.
double zeroTolerance_
Zero tolerance.
CoinIntArrayWithLength indexColumnL_
Index of column in row for L.
virtual CoinBigIndex * starts() const
Returns pivot row.
void almostDestructor()
Delete all stuff (leaves as after CoinAbcFactorization())
CoinBigIndexArrayWithLength convertRowToColumnU_
Converts rows to columns in U.
void updateColumnPFI(CoinIndexedVector *regionSparse) const
Updates part of column PFI (FTRAN) (after rest)
CoinBigIndex numberCompressions_
Number of compressions done.
bool getRowSpace(CoinSimplexInt iRow, CoinSimplexInt extraNeeded)
Gets space for one Row with given length, may have to do compression (returns True if successful)...
unsigned int CoinSimplexUnsignedInt
const double * denseVector(const CoinIndexedVector *vector) const
Returns double * associated with vector.