MixedIntVars Class Reference

A class that defines a set of parameters that includes binary, integer and double variables. More...

#include <MixedIntVars.h>

List of all members.

Public Methods

 MixedIntVars (const int numBits=0, const int numGenInts=0, const int numDoubles=0)
 Constructor, which can be used to specify the number of different groups of variables.

virtual ~MixedIntVars ()
 Destructor.

void resize (const int numBits, const int numGenInts, const int numDoubles)
 Resizes the number of binary, integer and real variables.

int nrefs () const
 Returns the number of references to the MixedIntVarsRep class.

int numIntegerVars () const
 Returns the total number of integer variables.

int numBinaryVars () const
 Returns the number of binary variables.

int numGeneralIntVars () const
 Returns the number of general integer variables.

int numDoubles () const
 Returns the number of real variables.

int numAllVars () const
 Returns the number of all variables.

void setBit (const int ndx, int val)
 Sets the value of the ndx-th binary variable to val.

void setGeneralInt (const int ndx, int val)
 Sets the value of the ndx-th general integer variable to val.

void setInt (const int ndx, int val)
 Sets the value of the ndx-th integer variable to val. More...

void setDouble (const int ndx, double val)
 Sets the value of the ndx-th real variable to val.

void set (const int ndx, double val)
 Sets the value of the ndx-th variable to val. More...

int getBit (const int ndx)
 Gets the value of the ndx-th binary variable.

int getGeneralInt (const int ndx)
 Gets the value of the ndx-th general integer variable.

int getInt (const int ndx)
 Gets the value of the ndx-th integer variable. More...

double getDouble (const int ndx)
 Gets the value of the ndx-th real variable.

double get (const int ndx)
 Gets the value of the ndx-th variable. More...

MixedIntVars & operator= (const MixedIntVars &array)
 Copies the array object by constructing a new MixedIntVarsRep.

MixedIntVars & operator &= (const MixedIntVars &array)
 Copies the pointer from the array object.

MixedIntVars & operator<< (const MixedIntVars &array)
 Copies the array without memory allocation.

MixedIntVars & operator= (const char val)
 Set all binary variables to val.

MixedIntVars & operator= (const int val)
 Set all general integer variables to val.

MixedIntVars & operator= (const double val)
 Set all real variables to val.

int operator== (const MixedIntVars &array) const
 Checks to see if the current array equals array.

int compare (const MixedIntVars &array) const
 Compares array with the current variables. More...

int write (ostream &os) const
 Write the array to an output stream.

int read (istream &is)
 Read the array from an input stream.

int write (PackBuffer &os) const
 Pack the array into a PackBuffer class.

int read (UnPackBuffer &is)
 Unpack the array from a UnPackBuffer class.


Protected Methods

void construct (const int nbits, const int nints, const int ndlbs)
 Method used by constructors to setup the MixedIntVars class.

void free ()
 Method used to delete the internal array classes.


Protected Attributes

MixedIntVarsRepa
 The pointer to the internal array representation.


Detailed Description

A class that defines a set of parameters that includes binary, integer and double variables.

This class manages these variables in arrays of bits, ints and doubles.

This class uses set() and get() methods to manage the values of the variables. This is more cumbersum than using an operator[] method, but the operator[] method does not work well for binary variables.


Member Function Documentation

int MixedIntVars::compare const MixedIntVars &    array const
 

Compares array with the current variables.

Compares the binary, integer and then real variable arrays. If all are equal, then returns 0. Otherwise, when one is non-zero, return that comparison.

double MixedIntVars::get const int    ndx
 

Gets the value of the ndx-th variable.

This assumes that binary variables precede general integer variables, which precede real variables.

int MixedIntVars::getInt const int    ndx
 

Gets the value of the ndx-th integer variable.

This assumes that binary variables precede general integer variables.

void MixedIntVars::set const int    ndx,
double    val
 

Sets the value of the ndx-th variable to val.

This assumes that binary variables precede general integer variables, which precede real variables.

void MixedIntVars::setInt const int    ndx,
int    val
 

Sets the value of the ndx-th integer variable to val.

This assumes that binary variables precede general integer variables.


The documentation for this class was generated from the following file: