Ignore:
Timestamp:
Feb 7, 2003 5:39:18 PM (17 years ago)
Author:
forrest
Message:

Adding Network matrix and PlusMinusOne?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpFactorization.cpp

    r63 r118  
    77#include "ClpSimplex.hpp"
    88#include "ClpMatrixBase.hpp"
     9#include "ClpNetworkBasis.hpp"
    910
    1011
     
    1718//-------------------------------------------------------------------
    1819ClpFactorization::ClpFactorization () :
    19    CoinFactorization() {}
     20   CoinFactorization()
     21{
     22  networkBasis_ = NULL;
     23}
    2024
    2125//-------------------------------------------------------------------
     
    2327//-------------------------------------------------------------------
    2428ClpFactorization::ClpFactorization (const ClpFactorization & rhs) :
    25    CoinFactorization(rhs) {}
     29   CoinFactorization(rhs)
     30{
     31  if (rhs.networkBasis_)
     32    networkBasis_ = new ClpNetworkBasis(*(rhs.networkBasis_));
     33  else
     34    networkBasis_=NULL;
     35}
    2636
    2737ClpFactorization::ClpFactorization (const CoinFactorization & rhs) :
    28    CoinFactorization(rhs) {}
     38   CoinFactorization(rhs)
     39{
     40  networkBasis_=NULL;
     41}
    2942
    3043//-------------------------------------------------------------------
    3144// Destructor
    3245//-------------------------------------------------------------------
    33 ClpFactorization::~ClpFactorization () {}
     46ClpFactorization::~ClpFactorization ()
     47{
     48  delete networkBasis_;
     49}
    3450
    3551//----------------------------------------------------------------
     
    4157  if (this != &rhs) {
    4258    CoinFactorization::operator=(rhs);
     59    delete networkBasis_;
     60    if (rhs.networkBasis_)
     61      networkBasis_ = new ClpNetworkBasis(*(rhs.networkBasis_));
     62    else
     63      networkBasis_=NULL;
    4364  }
    4465  return *this;
     
    157178  return status_;
    158179}
     180/* Replaces one Column to basis,
     181   returns 0=OK, 1=Probably OK, 2=singular, 3=no room
     182   If checkBeforeModifying is true will do all accuracy checks
     183   before modifying factorization.  Whether to set this depends on
     184   speed considerations.  You could just do this on first iteration
     185   after factorization and thereafter re-factorize
     186   partial update already in U */
     187int
     188ClpFactorization::replaceColumn ( CoinIndexedVector * regionSparse,
     189                      int pivotRow,
     190                      double pivotCheck ,
     191                      bool checkBeforeModifying)
     192{
     193  if (!networkBasis_) {
     194    return CoinFactorization::replaceColumn(regionSparse,
     195                                            pivotRow,
     196                                            pivotCheck,
     197                                            checkBeforeModifying);
     198  } else {
     199    return networkBasis_->replaceColumn(regionSparse,
     200                                        pivotRow);
     201  }
     202}
     203
     204/* Updates one column (FTRAN) from region2
     205   number returned is negative if no room
     206   region1 starts as zero and is zero at end */
     207int
     208ClpFactorization::updateColumn ( CoinIndexedVector * regionSparse,
     209                                 CoinIndexedVector * regionSparse2,
     210                                 bool FTUpdate)
     211{
     212  if (!networkBasis_) {
     213    return CoinFactorization::updateColumn(regionSparse,
     214                                           regionSparse2,
     215                                           FTUpdate);
     216  } else {
     217    return networkBasis_->updateColumn(regionSparse,
     218                                       regionSparse2);
     219  }
     220}
     221/* Updates one column (FTRAN) to/from array
     222   number returned is negative if no room
     223   ** For large problems you should ALWAYS know where the nonzeros
     224   are, so please try and migrate to previous method after you
     225   have got code working using this simple method - thank you!
     226   (the only exception is if you know input is dense e.g. rhs)
     227   region starts as zero and is zero at end */
     228int
     229ClpFactorization::updateColumn ( CoinIndexedVector * regionSparse,
     230                        double array[] ) const
     231{
     232  if (!networkBasis_) {
     233    return CoinFactorization::updateColumn(regionSparse,
     234                                           array);
     235  } else {
     236    return networkBasis_->updateColumn(regionSparse,
     237                                                    array);
     238  }
     239}
     240/* Updates one column transpose (BTRAN)
     241   For large problems you should ALWAYS know where the nonzeros
     242   are, so please try and migrate to previous method after you
     243   have got code working using this simple method - thank you!
     244   (the only exception is if you know input is dense e.g. dense objective)
     245   returns number of nonzeros */
     246int
     247ClpFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse,
     248                                          double array[] ) const
     249{
     250  if (!networkBasis_) {
     251    return CoinFactorization::updateColumnTranspose(regionSparse,
     252                                                    array);
     253  } else {
     254    return networkBasis_->updateColumnTranspose(regionSparse,
     255                                                    array);
     256  }
     257}
     258/* Updates one column (BTRAN) from region2
     259   region1 starts as zero and is zero at end */
     260int
     261ClpFactorization::updateColumnTranspose ( CoinIndexedVector * regionSparse,
     262                          CoinIndexedVector * regionSparse2) const
     263{
     264  if (!networkBasis_) {
     265    return CoinFactorization::updateColumnTranspose(regionSparse,
     266                                                    regionSparse2);
     267  } else {
     268    return networkBasis_->updateColumnTranspose(regionSparse,
     269                                                    regionSparse2);
     270  }
     271}
Note: See TracChangeset for help on using the changeset viewer.