Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ util/

operations_research Namespace Reference

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. More...


Classes

class  CachedLog
 This class is used when manipulating search space estimations. More...
class  ConstIntArray
 This class is used to store constant copies of int64 arrays. More...
class  ConstIntPtrArray
 This class is used to store pairs of <T*, int64>. More...
class  ConstPtrArray
 This class is used to store an const array of T*. More...
class  GraphExporter
 Export to graph file. More...
class  MonoidOperationTree
 A monoid is an algebraic structure consisting of a set S with an associative binary operation * :S x S -> S that has an identity element. More...
class  PermutationCycleHandler
 Abstract base class template defining the interface needed by PermutationApplier to handle a single cycle of a permutation. More...
class  ArrayIndexCycleHandler
 A generic cycle handler class for the common case in which the object to be permuted is indexable with T& operator[](int), and the permutation is represented by a mutable array of nonnegative int-typed index values. More...
class  PermutationApplier
 Note that this template is not implemented in an especially performance-sensitive way. More...
class  IntTupleSet
 Main IntTupleSet class. More...
class  VectorMap
 This class stores a vector of distinct elements, as well as a map from elements to index to find the index in the vector. More...
class  XmlHelper
 Lightweight XML writer that is optimized for CPViz output. More...
class  ZVector

Typedefs

typedef ZVector< int8 > Int8ZVector
 Shorthands for all the types of ZVector's.
typedef ZVector< int16 > Int16ZVector
typedef ZVector< int32 > Int32ZVector
typedef ZVector< int64 > Int64ZVector
typedef ZVector< uint8 > UInt8ZVector
typedef ZVector< uint16 > UInt16ZVector
typedef ZVector< uint32 > UInt32ZVector
typedef ZVector< uint64 > UInt64ZVector

Functions

uint64 OneBit64 (int pos)
 Returns a word with only bit pos set.
uint32 OneBit32 (int pos)
uint64 BitCount64 (uint64 n)
 Returns the number of bits set in n.
uint32 BitCount32 (uint32 n)
uint64 LeastSignificantBitWord64 (uint64 n)
 Returns a word with only the least significant bit of n set.
uint32 LeastSignificantBitWord32 (uint32 n)
int LeastSignificantBitPosition64 (uint64 n)
int LeastSignificantBitPosition32 (uint32 n)
int MostSignificantBitPosition64 (uint64 n)
 Returns the most significant bit position in n.
int MostSignificantBitPosition32 (uint32 n)
uint64 OneRange64 (uint64 s, uint64 e)
 Returns a word with bits from s to e set.
uint32 OneRange32 (uint32 s, uint32 e)
uint64 IntervalUp64 (uint64 s)
 Returns a word with s least significant bits unset.
uint32 IntervalUp32 (uint32 s)
uint64 IntervalDown64 (uint64 s)
 Returns a word with the s most significant bits unset.
uint32 IntervalDown32 (uint32 s)
uint64 BitPos64 (uint64 pos)
 Bitset operators Bitset: array of uint32/uint64 words.
uint32 BitPos32 (uint32 pos)
uint64 BitOffset64 (uint64 pos)
 Returns the word number corresponding to bit number pos.
uint32 BitOffset32 (uint32 pos)
uint64 BitLength64 (uint64 size)
 Returns the number of words needed to store size bits.
uint32 BitLength32 (uint32 size)
uint64 BitShift64 (uint64 v)
 Returns the bit number in the bitset of the first bit of word number v.
uint32 BitShift32 (uint32 v)
bool IsBitSet64 (const uint64 *const bitset, uint64 pos)
 Returns true if the bit pos is set in bitset.
bool IsBitSet32 (const uint32 *const bitset, uint32 pos)
void SetBit64 (uint64 *const bitset, uint64 pos)
 Sets the bit pos to true in bitset.
void SetBit32 (uint32 *const bitset, uint32 pos)
void ClearBit64 (uint64 *const bitset, uint64 pos)
 Sets the bit pos to false in bitset.
void ClearBit32 (uint32 *const bitset, uint32 pos)
uint64 BitCountRange64 (const uint64 *const bitset, uint64 start, uint64 end)
 Returns the number of bits set in bitset between positions start and end.
uint32 BitCountRange32 (const uint32 *const bitset, uint32 start, uint32 end)
bool IsEmptyRange64 (const uint64 *const bitset, uint64 start, uint64 end)
 Returns true if no bits are set in bitset between start and end.
bool IsEmptyRange32 (const uint32 *const bitset, uint32 start, uint32 end)
int64 LeastSignificantBitPosition64 (const uint64 *const bitset, uint64 start, uint64 end)
 Returns the first bit set in bitset between start and max_bit.
int LeastSignificantBitPosition32 (const uint32 *const bitset, uint32 start, uint32 end)
int64 MostSignificantBitPosition64 (const uint64 *const bitset, uint64 start, uint64 end)
 Returns the last bit set in bitset between min_bit and start.
int MostSignificantBitPosition32 (const uint32 *const bitset, uint32 start, uint32 end)
int64 UnsafeLeastSignificantBitPosition64 (const uint64 *const bitset, uint64 start, uint64 end)
 Unsafe versions of the functions above where respectively end and start are supposed to be set.
int32 UnsafeLeastSignificantBitPosition32 (const uint32 *const bitset, uint32 start, uint32 end)
int64 UnsafeMostSignificantBitPosition64 (const uint64 *const bitset, uint64 start, uint64 end)
int32 UnsafeMostSignificantBitPosition32 (const uint32 *const bitset, uint32 start, uint32 end)
double FastLog2 (int64 input)
template<class T>
string DebugStringArray (T *const *array, int size, const string &separator)
 Pretty Print Helpers.
template<class T>
string DebugStringVector (const std::vector< T * > &array, const string &separator)
 Creates a string from an vector of objects supporting the DebugString() method, and a separator.
template<class T>
string NameArray (T *const *array, int size, const string &separator)
 Creates a string from an array of objects supporting the name() method, and a separator.
string Int64ArrayToString (const int64 *const array, int size, const string &separator)
 Creates a string from an array of int64, and a separator.
string IntArrayToString (const int *const array, int size, const string &separator)
 Creates a string from an array of int, and a separator.
string Int64VectorToString (const std::vector< int64 > &array, const string &separator)
 Creates a string from an vector of int64, and a separator.
string IntVectorToString (const std::vector< int > &array, const string &separator)
 Creates a string from an vector of int, and a separator.

Variables

static const uint64 kAllBits64 = GG_ULONGLONG(0xFFFFFFFFFFFFFFFF)
 Basic bit operations.
static const uint32 kAllBits32 = 0xFFFFFFFFU


Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Various utility functions on bitsets.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Classes for permuting indexable, ordered containers of data without depending on that data to be accessible in any particular way. The client needs to give us two things: 1. a permutation to apply to some container(s) of data, and 2. a description of how to move data around in the container(s).

The permutation (1) comes to us in the form of an array argument to PermutationApplier::Apply(), along with index values that tell us where in that array the permutation of interest lies. Typically those index values will span the entire array that describes the permutation.

Applying a permutation involves decomposing the permutation into disjoint cycles and walking each element of the underlying data one step around the unique cycle in which it participates. The decomposition into disjoint cycles is done implicitly on the fly as the code in PermutationApplier::Apply() advances through the array describing the permutation. As an important piece of bookkeeping to support the decomposition into cycles, the elements of the permutation array typically get modified somehow to indicate which ones have already been used.

At first glance, it would seem that if the containers are indexable, we don't need anything more complicated than just the permutation and the container of data we want to permute; it would seem we can just use the container's operator[] to retrieve and assign elements within the container. Unfortunately it's not so simple because the containers of interest can be indexable without providing any consistent way of accessing their contents that applies to all the containers of interest. For instance, if we could insist that every indexable container must define an lvalue operator[]() we could simply use that for the assignments we need to do while walking around cycles of the permutation. But we cannot insist on any such thing. To see why, consider the PackedArray class template in util/packed_array.h where operator[] is supplied for rvalues, but because each logical array element is packed across potentially multiple instances of the underlying data type that the C++ language knows about, there is no way to have a C++ reference to an element of a PackedArray. There are other such examples besides PackedArray, too. This is the main reason we need a codified description (2) of how to move data around in the indexable container. That description comes to us via the PermutationApplier constructor's argument which is a PermutationCycleHandler instance. Such an object has three important methods defined: SetTempFromIndex(), SetIndexFromIndex(), and SetIndexFromTemp(). Those methods embody all we need to know about how to move data in the indexable container(s) underlying the PermutationCycleHandler.

Another reason we need the description (2) of how to move elements around in the container(s) is that it is often important to permute side-by-side containers of elements according to the same permutation. This situation, too, is covered by defining a PermutationCycleHandler that knows about multiple underlying indexable containers.

The above-mentioned PermutationCycleHandler methods embody knowledge of how to assign elements. It happens that PermutationCycleHandler is also a convenient place to embody the knowledge of how to keep track of which permutation elements have been consumed by the process of walking data around cycles. We depend on the PermutationCycleHandler instance we're given to define SetSeen() and Unseen() methods for that purpose.

For the common case in which elements can be accessed using operator[](), we provide the class template ArrayIndexCycleHandler.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Set of integer tuples (fixed-size arrays, all of the same size) with a basic API. It supports several types of integer arrays transparently, with an inherent storage based on int64 arrays.

The key feature is the "lazy" copy:

This class is thread hostile as the copy and reference counter are not protected by a mutex.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Vector with map from element to index in the vector.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. An array class for storing arrays of integers. The range of indices is specified at the construction of the object. The minimum and maximum indices are inclusive. Think of the Pascal syntax array[min_index..max_index] of ... For example ZVector<int32>(-100000,100000) will store 200001 signed integers of 32 bits each, and the possible range of indices will be -100000..100000.


Typedef Documentation

Definition at line 164 of file zvector.h.

Definition at line 165 of file zvector.h.

Definition at line 166 of file zvector.h.

Shorthands for all the types of ZVector's.

Definition at line 163 of file zvector.h.

Definition at line 168 of file zvector.h.

Definition at line 169 of file zvector.h.

Definition at line 170 of file zvector.h.

Definition at line 167 of file zvector.h.


Function Documentation

uint32 operations_research::BitCount32 ( uint32  n  )  [inline]

Definition at line 50 of file bitset.h.

uint64 operations_research::BitCount64 ( uint64  n  )  [inline]

Returns the number of bits set in n.

Definition at line 39 of file bitset.h.

uint32 operations_research::BitCountRange32 ( const uint32 *const   bitset,
uint32  start,
uint32  end 
)

uint64 operations_research::BitCountRange64 ( const uint64 *const   bitset,
uint64  start,
uint64  end 
)

Returns the number of bits set in bitset between positions start and end.

uint32 operations_research::BitLength32 ( uint32  size  )  [inline]

Definition at line 322 of file bitset.h.

uint64 operations_research::BitLength64 ( uint64  size  )  [inline]

Returns the number of words needed to store size bits.

Definition at line 321 of file bitset.h.

uint32 operations_research::BitOffset32 ( uint32  pos  )  [inline]

Definition at line 318 of file bitset.h.

uint64 operations_research::BitOffset64 ( uint64  pos  )  [inline]

Returns the word number corresponding to bit number pos.

Definition at line 317 of file bitset.h.

uint32 operations_research::BitPos32 ( uint32  pos  )  [inline]

Definition at line 314 of file bitset.h.

uint64 operations_research::BitPos64 ( uint64  pos  )  [inline]

Bitset operators Bitset: array of uint32/uint64 words.

Bit operators used to manipulates bitsets. Returns the bit number in the word computed by BitOffsetXX, corresponding to the bit at position pos in the bitset. Note: '& 63' is faster than '% 64'

Todo:
TODO(user): rename BitPos and BitOffset to something more understandable.

Definition at line 313 of file bitset.h.

uint32 operations_research::BitShift32 ( uint32  v  )  [inline]

Definition at line 326 of file bitset.h.

uint64 operations_research::BitShift64 ( uint64  v  )  [inline]

Returns the bit number in the bitset of the first bit of word number v.

Definition at line 325 of file bitset.h.

void operations_research::ClearBit32 ( uint32 *const   bitset,
uint32  pos 
) [inline]

Definition at line 348 of file bitset.h.

void operations_research::ClearBit64 ( uint64 *const   bitset,
uint64  pos 
) [inline]

Sets the bit pos to false in bitset.

Definition at line 345 of file bitset.h.

template<class T>
string operations_research::DebugStringArray ( T *const *  array,
int  size,
const string &  separator 
) [inline]

Pretty Print Helpers.

Creates a string from an array of objects supporting the DebugString() method, and a separator.

Definition at line 29 of file string_array.h.

template<class T>
string operations_research::DebugStringVector ( const std::vector< T * > &  array,
const string &  separator 
) [inline]

Creates a string from an vector of objects supporting the DebugString() method, and a separator.

Definition at line 44 of file string_array.h.

double operations_research::@2::FastLog2 ( int64  input  )  [static]

Definition at line 25 of file cached_log.cc.

string operations_research::Int64ArrayToString ( const int64 *const   array,
int  size,
const string &  separator 
) [inline]

Creates a string from an array of int64, and a separator.

Definition at line 65 of file string_array.h.

string operations_research::Int64VectorToString ( const std::vector< int64 > &  array,
const string &  separator 
) [inline]

Creates a string from an vector of int64, and a separator.

Definition at line 93 of file string_array.h.

string operations_research::IntArrayToString ( const int *const   array,
int  size,
const string &  separator 
) [inline]

Creates a string from an array of int, and a separator.

Definition at line 79 of file string_array.h.

uint32 operations_research::IntervalDown32 ( uint32  s  )  [inline]

Definition at line 299 of file bitset.h.

uint64 operations_research::IntervalDown64 ( uint64  s  )  [inline]

Returns a word with the s most significant bits unset.

Definition at line 294 of file bitset.h.

uint32 operations_research::IntervalUp32 ( uint32  s  )  [inline]

Definition at line 288 of file bitset.h.

uint64 operations_research::IntervalUp64 ( uint64  s  )  [inline]

Returns a word with s least significant bits unset.

Definition at line 283 of file bitset.h.

string operations_research::IntVectorToString ( const std::vector< int > &  array,
const string &  separator 
) [inline]

Creates a string from an vector of int, and a separator.

Definition at line 99 of file string_array.h.

bool operations_research::IsBitSet32 ( const uint32 *const   bitset,
uint32  pos 
) [inline]

Definition at line 332 of file bitset.h.

bool operations_research::IsBitSet64 ( const uint64 *const   bitset,
uint64  pos 
) [inline]

Returns true if the bit pos is set in bitset.

Definition at line 329 of file bitset.h.

bool operations_research::IsEmptyRange32 ( const uint32 *const   bitset,
uint32  start,
uint32  end 
)

bool operations_research::IsEmptyRange64 ( const uint64 *const   bitset,
uint64  start,
uint64  end 
)

Returns true if no bits are set in bitset between start and end.

int operations_research::LeastSignificantBitPosition32 ( const uint32 *const   bitset,
uint32  start,
uint32  end 
)

int operations_research::LeastSignificantBitPosition32 ( uint32  n  )  [inline]

Definition at line 142 of file bitset.h.

int64 operations_research::LeastSignificantBitPosition64 ( const uint64 *const   bitset,
uint64  start,
uint64  end 
)

Returns the first bit set in bitset between start and max_bit.

int operations_research::LeastSignificantBitPosition64 ( uint64  n  )  [inline]

Definition at line 78 of file bitset.h.

uint32 operations_research::LeastSignificantBitWord32 ( uint32  n  )  [inline]

Definition at line 63 of file bitset.h.

uint64 operations_research::LeastSignificantBitWord64 ( uint64  n  )  [inline]

Returns a word with only the least significant bit of n set.

Definition at line 60 of file bitset.h.

int operations_research::MostSignificantBitPosition32 ( const uint32 *const   bitset,
uint32  start,
uint32  end 
)

int operations_research::MostSignificantBitPosition32 ( uint32  n  )  [inline]

Definition at line 234 of file bitset.h.

int64 operations_research::MostSignificantBitPosition64 ( const uint64 *const   bitset,
uint64  start,
uint64  end 
)

Returns the last bit set in bitset between min_bit and start.

int operations_research::MostSignificantBitPosition64 ( uint64  n  )  [inline]

Returns the most significant bit position in n.

Definition at line 189 of file bitset.h.

template<class T>
string operations_research::NameArray ( T *const *  array,
int  size,
const string &  separator 
) [inline]

Creates a string from an array of objects supporting the name() method, and a separator.

Definition at line 51 of file string_array.h.

uint32 operations_research::OneBit32 ( int  pos  )  [inline]

Definition at line 36 of file bitset.h.

uint64 operations_research::OneBit64 ( int  pos  )  [inline]

Returns a word with only bit pos set.

Definition at line 35 of file bitset.h.

uint32 operations_research::OneRange32 ( uint32  s,
uint32  e 
) [inline]

Definition at line 275 of file bitset.h.

uint64 operations_research::OneRange64 ( uint64  s,
uint64  e 
) [inline]

Returns a word with bits from s to e set.

Definition at line 268 of file bitset.h.

void operations_research::SetBit32 ( uint32 *const   bitset,
uint32  pos 
) [inline]

Definition at line 340 of file bitset.h.

void operations_research::SetBit64 ( uint64 *const   bitset,
uint64  pos 
) [inline]

Sets the bit pos to true in bitset.

Definition at line 337 of file bitset.h.

int32 operations_research::UnsafeLeastSignificantBitPosition32 ( const uint32 *const   bitset,
uint32  start,
uint32  end 
)

int64 operations_research::UnsafeLeastSignificantBitPosition64 ( const uint64 *const   bitset,
uint64  start,
uint64  end 
)

Unsafe versions of the functions above where respectively end and start are supposed to be set.

int32 operations_research::UnsafeMostSignificantBitPosition32 ( const uint32 *const   bitset,
uint32  start,
uint32  end 
)

int64 operations_research::UnsafeMostSignificantBitPosition64 ( const uint64 *const   bitset,
uint64  start,
uint64  end 
)


Variable Documentation

const uint32 operations_research::kAllBits32 = 0xFFFFFFFFU [static]

Definition at line 32 of file bitset.h.

const uint64 operations_research::kAllBits64 = GG_ULONGLONG(0xFFFFFFFFFFFFFFFF) [static]

Basic bit operations.

Useful constants: word and double word will all bits set.

Definition at line 31 of file bitset.h.