38 for (
int i =
dim() - 1; i >= 0; --i)
42 MSG_DEBUG( std::cout <<
"DSHIFT08 theUBbound[" << i <<
"] violated by " << (*
theFvec)[i] -
theUBbound[i] - allow << std::endl );
54 MSG_DEBUG( std::cout <<
"DSHIFT08 theLBbound[" << i <<
"] violated by " <<
theLBbound[i] - (*
theFvec)[i] - allow << std::endl );
68 MSG_DEBUG( std::cout <<
"DSHIFT01 shiftFvec: OK" << std::endl; )
94 for (i =
dim() - 1; i >= 0; --i)
104 (*theCoLbound)[i] = (*theCoUbound)[i];
114 (*theCoUbound)[i] = (*theCoLbound)[i];
119 for (i =
coDim() - 1; i >= 0; --i)
129 (*theLbound)[i] = (*theUbound)[i];
139 (*theUbound)[i] = (*theLbound)[i];
146 MSG_DEBUG( std::cout <<
"DSHIFT02 shiftPvec: OK" << std::endl; )
159 assert(uvec.
dim() == p_low.
dim());
160 assert(uvec.
dim() == p_up.
dim());
163 Real minrandom = 10.0 * p_delta;
164 Real maxrandom = 100.0 * p_delta;
172 for( i = uvec.
dim() - start - 1; i >= 0; i -= incr )
180 p_up[i] = x +
random.
next(minrandom,maxrandom);
185 p_low[i] = x -
random.
next(minrandom,maxrandom);
195 for(
int j = uvec.
delta().
size() - start - 1; j >= 0; j -= incr )
212 p_up[i] = vec[i] +
random.
next(minrandom,maxrandom);
220 p_low[i] = vec[i] -
random.
next(minrandom,maxrandom);
237 assert(uvec.
dim() == p_low.
dim());
238 assert(uvec.
dim() == p_up.
dim());
241 Real minrandom = 10.0 * p_delta;
242 Real maxrandom = 100.0 * p_delta;
249 for (i = uvec.
dim() - start - 1; i >= 0; i -= incr)
257 p_up[i] = x +
random.
next(minrandom,maxrandom);
262 p_low[i] = x -
random.
next(minrandom,maxrandom);
272 for(
int j = uvec.
delta().
size() - start - 1; j >= 0; j -= incr )
289 p_up[i] = vec[i] +
random.
next(minrandom,maxrandom);
297 p_low[i] = vec[i] -
random.
next(minrandom,maxrandom);
333 assert(uvec.
dim() == p_low.
dim());
334 assert(uvec.
dim() == p_up.
dim());
337 Real minrandom = 10.0 * p_delta;
338 Real maxrandom = 100.0 * p_delta;
346 for( i = uvec.
dim() - start - 1; i >= 0; i -= incr )
352 if(
LT(u,
infinity) &&
NE(l, u) && u <= x + eps &&
rep() * stat[i] < 0 )
354 p_up[i] = vec[i] +
random.
next(minrandom,maxrandom);
355 l_theShift += p_up[i] - u;
357 if(
GT(l, -
infinity) &&
NE(l, u) && l >= x - eps &&
rep() * stat[i] < 0 )
359 p_low[i] = vec[i] -
random.
next(minrandom,maxrandom);
360 l_theShift -= p_low[i] - l;
369 for(
int j = uvec.
delta().
size() - start - 1; j >= 0; j -= incr )
377 if(
LT(u,
infinity) &&
NE(l, u) && vec[i] >= u - eps &&
rep() * stat[i] < 0 )
379 p_up[i] = vec[i] +
random.
next(minrandom,maxrandom);
380 l_theShift += p_up[i] - u;
385 if(
GT(l, -
infinity) &&
NE(l, u) && vec[i] <= l + eps &&
rep() * stat[i] < 0 )
387 p_low[i] = vec[i] -
random.
next(minrandom,maxrandom);
388 l_theShift -= p_low[i] - l;
406 assert(uvec.
dim() == p_low.
dim());
407 assert(uvec.
dim() == p_up.
dim());
410 Real minrandom = 10.0 * p_delta;
411 Real maxrandom = 100.0 * p_delta;
419 for( i = uvec.
dim() - start - 1; i >= 0; i -= incr )
425 if(
LT(u,
infinity) &&
NE(l, u) && u <= x + eps &&
rep() * stat[i] < 0 )
427 p_up[i] = vec[i] +
random.
next(minrandom,maxrandom);
428 l_theShift += p_up[i] - u;
430 if(
GT(l, -
infinity) &&
NE(l, u) && l >= x - eps &&
rep() * stat[i] < 0 )
432 p_low[i] = vec[i] -
random.
next(minrandom,maxrandom);
433 l_theShift -= p_low[i] - l;
442 for(
int j = uvec.
delta().
size() - start - 1; j >= 0; j -= incr )
450 if(
LT(u,
infinity) &&
NE(l, u) && vec[i] >= u - eps &&
rep() * stat[i] < 0 )
452 p_up[i] = vec[i] +
random.
next(minrandom,maxrandom);
453 l_theShift += p_up[i] - u;
458 if(
GT(l, -
infinity) &&
NE(l, u) && vec[i] <= l + eps &&
rep() * stat[i] < 0 )
460 p_low[i] = vec[i] -
random.
next(minrandom,maxrandom);
461 l_theShift -= p_low[i] - l;
478 desc().coStatus(), 0, 1);
491 desc().coStatus(), 0, 1);
513 for (i =
dim(); i-- > 0;)
526 t_low =
lower(l_num);
530 if ((*
theFvec)[i] < t_up + eps)
534 if ((*
theFvec)[i] > t_low - eps)
536 else if ((*
theFvec)[i] < t_low)
547 for (i =
nRows(); i-- > 0;)
559 for (i =
nCols(); i-- > 0;)
575 for (i =
dim(); i-- > 0;)
599 if ((*
theFvec)[i] < t_up - eps)
604 if ((*
theFvec)[i] > t_low + eps)
606 else if ((*
theFvec)[i] < t_low)
610 for (i =
nRows(); i-- > 0;)
622 for (i =
nCols(); i-- > 0;)
644 for (i =
nRows(); i-- > 0;)
672 for (i =
nCols(); i-- > 0;)
674 t_up = t_low = -
maxObj(i);
678 if ((*
thePvec)[i] < -t_up + eps)
686 if ((*
thePvec)[i] > -t_low - eps)
704 for (i =
nRows(); i-- > 0;)
718 if ((*
thePvec)[i] < t_up + eps)
722 if ((*
thePvec)[i] > t_low - eps)
732 for (i =
nCols(); i-- > 0;)
virtual void unShift(void)
remove shift as much as possible.
const VectorBase< R > & rhs() const
Returns right hand side vector.
SPxId coId(int i) const
id of i 'th covector.
const Vector & ucBound() const
int iteration() const
returns number of basis changes since last load().
virtual Real shift() const
total current shift amount.
const VectorBase< R > & upper() const
Returns upper bound vector.
SPxOut * spxout
message handler
THREADLOCAL const Real infinity
DVector * theUbound
Upper bound for vars.
Real leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
DVector * theCoUbound
Upper bound for covars.
Status & rowStatus(int i)
bool LT(Real a, Real b, Real eps=Param::epsilon())
returns true iff a < b + eps
void clearDualBounds(SPxBasis::Desc::Status, Real &, Real &) const
virtual void perturbMaxLeave(void)
perturb nonbasic bounds.
bool NE(Real a, Real b, Real eps=Param::epsilon())
returns true iff |a-b| > eps
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
const Vector & lcBound() const
virtual void perturbMinEnter(void)
int dim() const
dimension of basis matrix.
void shiftLBbound(int i, Real to)
shift i 'th lbBound to to.
virtual void perturbMaxEnter(void)
perturb basis bounds.
Desc::Status dualStatus(const SPxColId &id) const
dual Status for the column variable with ID id of the loaded LP.
const R * get_const_ptr() const
Conversion to C-style pointer.
Wrapper for different output streams and verbosity levels.
int nRows() const
Returns number of rows in LP.
const Vector & ubBound() const
upper bound for fVec.
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
UpdateVector & coPvec() const
copricing vector.
const R * values() const
Returns array values.
Status status() const
Status of solution process.
void shiftLPbound(int i, Real to)
shift i 'th lpBound to to.
bool GT(Real a, Real b, Real eps=Param::epsilon())
returns true iff a > b + eps
DVector * theLbound
Lower bound for vars.
Real entertol() const
feasibility tolerance maintained by ratio test during ENTER algorithm.
const Vector & lbBound() const
lower bound for fVec.
const IdxSet & indices() const
Returns indices.
UpdateVector & fVec() const
feasibility vector.
DVector theLBbound
Lower Basic Feasibility bound.
bool isBasic(SPxBasis::Desc::Status stat) const
does stat describe a basic index ?
Real next(Real minimum=0.0, Real maximum=1.0)
returns next random number.
const VectorBase< R > & lhs() const
Returns left hand side vector.
void shiftPvec()
Perform initial shifting to optain an feasible or pricable basis.
Dense vector with semi-sparse vector for updatesIn many algorithms vectors are updated in every itera...
void shiftUCbound(int i, Real to)
shift i 'th ucBound to to.
DVector theURbound
Upper Row Feasibility bound.
const VectorBase< R > & maxRowObj() const
void shiftUBbound(int i, Real to)
shift i 'th ubBound to to.
Status & colStatus(int i)
DVector theUBbound
Upper Basic Feasibility bound.
#define MSG_INFO3(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO3.
DVector * theCoLbound
Lower bound for covars.
Real epsilon() const
values are considered to be 0.
Debugging, floating point type and parameter definitions.
UpdateVector & pVec() const
pricing vector.
bool fullPerturbation
whether to perturb the entire problem or just the bounds relevant for the current pivot ...
const Vector & lpBound() const
DVector theLRbound
Lower Row Feasibility bound.
void perturbMin(const UpdateVector &vec, Vector &low, Vector &up, Real eps, Real delta, int start=0, int incr=1)
DVector theUCbound
Upper Column Feasibility bound.
bool isInitialized() const
has the internal data been initialized?
int dim() const
Dimension of vector.
int size() const
Returns the number of nonzeros.
Everything should be within this namespace.
void shiftUPbound(int i, Real to)
shift i 'th upBound to to.
void shiftLCbound(int i, Real to)
shift i 'th lcBound to to.
const VectorBase< R > & maxObj() const
Returns objective vector for maximization problem.
void setup()
Initializes nonzero indices for elements with absolute values above epsilon and sets all other elemen...
DVector theLCbound
Lower Column Feasibility bound.
const Vector & upBound() const
virtual void perturbMinLeave(void)
void shiftFvec()
Perform initial shifting to optain an feasible or pricable basis.
Type type() const
returns the type of the id.
Type type() const
return current Type.
Real theShift
sum of all shifts applied to any bound.
int coDim() const
codimension.
Random random
The random number generator used throughout the whole computation. Its seed can be modified...
int nCols() const
Returns number of columns in LP.
dual variable has two bounds
void perturbMax(const UpdateVector &vec, Vector &low, Vector &up, Real eps, Real delta, int start=0, int incr=1)
SSVector & delta()
update vector , writeable
int index(int n) const
access n 'th index.
Status
Status of a variable.
const VectorBase< R > & lower() const
Returns (internal and possibly scaled) lower bound vector.
const Desc & desc() const
Representation rep() const
return the current basis representation.
Set of indices.Class IdxSet provides a set of indices. At construction it must be given an array of i...
columnwise representation.