Generated on Mon Jun 23 17:18:22 2008 for ell-2.3.0 by doxygen 1.5.1

ell::S_SG_NPP Class Reference

#include <S_SG_NPP.hh>

Inheritance diagram for ell::S_SG_NPP:

Inheritance graph
[legend]

Detailed Description

An instance of the number partitioning problem

Definition at line 12 of file S_SG_NPP.hh.

Public Types

typedef biu::VirtualList<
State
NeighborList
typedef std::auto_ptr< NeighborListNeighborListPtr
typedef biu::Alphabet::Sequence SpinArray
typedef biu::Alphabet::AlphElem SpinType
typedef std::vector< double > WeightType

Public Member Functions

virtual StateapplyNeighborChange (const size_t index, State *const neigh) const
virtual Stateclone () const
virtual CSequencecompress (CSequence &toFill) const
virtual CSequence compress (void) const
virtual StatefromString (const std::string &stringRep) const
virtual double getEnergy () const
virtual int getFitness () const
virtual unsigned int getMinimalDistance (const State &state2) const
virtual StategetNeighbor (const size_t index, State *neigh) const
virtual NeighborListPtr getNeighborList () const
virtual size_t getNeighborNumber (void) const
virtual StategetRandomNeighbor (State *inPlaceNeigh=NULL) const
virtual NeighborListPtr getRandomNeighborList () const
virtual bool operator!= (const State &state2) const
virtual void operator= (const S_SG_NPP &sg2)
virtual bool operator== (const State &state2) const
 S_SG_NPP (const S_SG_NPP &s2)
 S_SG_NPP (const WeightType *weights, const std::string &spinStr)
 S_SG_NPP (const WeightType *weights, bool random=true)
virtual std::string toString () const
virtual Stateuncompress (const CSequence &cseq)
virtual Stateuncompress (const CSequence &cseq, State *toFill) const
virtual StateundoNeighborChange (const size_t index, State *const neigh) const
virtual ~S_SG_NPP ()

Static Public Attributes

static const SpinType SPIN_DOWN
static const SpinType SPIN_UP

Protected Member Functions

SpinType flipSpin (SpinType s) const

Protected Attributes

SpinArray spin
const WeightTypeweights

Static Protected Attributes

static const biu::Alphabet spinAlph


Member Typedef Documentation

typedef biu::VirtualList<State> ell::State::NeighborList [inherited]

Virtual list of neighbor states which can be accessed by a STL-like iterator.

Definition at line 43 of file State.hh.

typedef std::auto_ptr<NeighborList> ell::State::NeighborListPtr [inherited]

An autopointer to a NeighborList.

Definition at line 46 of file State.hh.

typedef biu::Alphabet::Sequence ell::S_SG_Ising::SpinArray [inherited]

type of the spin array representation

Definition at line 24 of file S_SG_Ising.hh.

typedef biu::Alphabet::AlphElem ell::S_SG_Ising::SpinType [inherited]

spin representation

Definition at line 22 of file S_SG_Ising.hh.

typedef std::vector<double> ell::S_SG_NPP::WeightType

Definition at line 15 of file S_SG_NPP.hh.


Constructor & Destructor Documentation

ell::S_SG_NPP::S_SG_NPP ( const WeightType weights,
bool  random = true 
)

Creates a spin-ring of weights.size(). It is initializes with + spins or randomly. The weight of each spin is given by weights.

Parameters:
weights the weight of each spin --> its size determines the number of spins in the ring
random initialize all spins randomly or with +

Definition at line 6 of file S_SG_NPP.cc.

ell::S_SG_NPP::S_SG_NPP ( const WeightType weights,
const std::string &  spinStr 
)

Creates a spin-ring from the string representatio spinStr. The weight of each spin is given by weights.

Parameters:
weights the weight of each spin
spinStr the +- string spin representation

Definition at line 12 of file S_SG_NPP.cc.

ell::S_SG_NPP::S_SG_NPP ( const S_SG_NPP s2  ) 

Definition at line 17 of file S_SG_NPP.cc.

ell::S_SG_NPP::~S_SG_NPP (  )  [virtual]

Destruction.

Definition at line 23 of file S_SG_NPP.cc.


Member Function Documentation

State * ell::S_SG_NPP::applyNeighborChange ( const size_t  index,
State *const   neigh 
) const [virtual]

Applies the necessary changes to a given state to get the neighbor. Note: neigh is expected to be a copy (i.e. *this == *neigh) and therefore direct changes are possible or to be NULL. If (neigh==NULL) a copy of this has to be generated, modified, and returned.

Parameters:
index the neighbor to generate
neigh a copy of this the changes should be applied to
Returns:
the neighbor state of the given index or NULL if the index is out of range

Reimplemented from ell::S_SG_Ising.

Definition at line 125 of file S_SG_NPP.cc.

State * ell::S_SG_NPP::clone (  )  const [virtual]

Returns a pointer to a clone of the current state.

Reimplemented from ell::S_SG_Ising.

Definition at line 66 of file S_SG_NPP.cc.

CSequence & ell::S_SG_Ising::compress ( CSequence toFill  )  const [virtual, inherited]

Access to a compressed sequence representation of the state.

Parameters:
toFill a data structure to write the compressed representation too
Returns:
the compressed sequence representation

Implements ell::State.

Definition at line 246 of file S_SG_Ising.cc.

CSequence ell::S_SG_Ising::compress ( void   )  const [virtual, inherited]

Access to a compressed sequence representation of the state.

Returns:
the compressed sequence representation

Implements ell::State.

Definition at line 236 of file S_SG_Ising.cc.

SpinType ell::S_SG_Ising::flipSpin ( SpinType  s  )  const [inline, protected, inherited]

flips the given spin (used for neighbor generation)

Definition at line 178 of file S_SG_Ising.hh.

State * ell::S_SG_NPP::fromString ( const std::string &  stringRep  )  const [virtual]

Returns a new State based on the current state. The new state differs only by the information given by stringRep.

Reimplemented from ell::S_SG_Ising.

Definition at line 73 of file S_SG_NPP.cc.

double ell::S_SG_NPP::getEnergy (  )  const [virtual]

Returns the state specific energy, i.e. E = abs( sum ( weights(i)*spin(i) ) ) for all 0<=i<j<=spinnumber and spin(i)=+-1 .

Reimplemented from ell::S_SG_Ising.

Definition at line 56 of file S_SG_NPP.cc.

int ell::S_SG_Ising::getFitness (  )  const [virtual, inherited]

Returns the negated energy of the spinglass.

Implements ell::State.

Definition at line 66 of file S_SG_Ising.cc.

unsigned int ell::S_SG_Ising::getMinimalDistance ( const State state2  )  const [virtual, inherited]

Returns the minimal number of steps via valid neighbored states from this to another valid State.

Parameters:
state2 the State to reach
Returns:
if state2 is a S_SG_Ising state the minimal distance or UINT_MAX otherwise

Implements ell::State.

Definition at line 91 of file S_SG_Ising.cc.

State * ell::S_SG_NPP::getNeighbor ( const size_t  index,
State neigh 
) const [virtual]

Access to a specific neighbor.

Parameters:
index the index of the neighbor in [0, getNeighborNumber())
neigh if != NULL this state should be converted into the neighbor otherwise a new one is created and returned
Returns:
the new neighbor state or NULL if the index is >= getNeighborNumber()

Reimplemented from ell::S_SG_Ising.

Definition at line 100 of file S_SG_NPP.cc.

State::NeighborListPtr ell::S_SG_Ising::getNeighborList (  )  const [virtual, inherited]

Returns a virtual list of all VALID neighbored states in the energy landscape in a specific successive order.

Implements ell::State.

Definition at line 130 of file S_SG_Ising.cc.

size_t ell::S_SG_Ising::getNeighborNumber ( void   )  const [virtual, inherited]

How many neighbor indices are accessible.

Returns:
the number of neighbors

Implements ell::IterableNeighbors.

Definition at line 170 of file S_SG_Ising.cc.

State * ell::S_SG_NPP::getRandomNeighbor ( State inPlaceNeigh = NULL  )  const [virtual]

Returns a VALID random neighbored state. If a state is given it is overwritten and changed to a neighbor.

Reimplemented from ell::S_SG_Ising.

Definition at line 78 of file S_SG_NPP.cc.

State::NeighborListPtr ell::S_SG_Ising::getRandomNeighborList (  )  const [virtual, inherited]

Returns a virtual list of all VALID neighbored states in the energy landscape in a random order.

Implements ell::State.

Definition at line 139 of file S_SG_Ising.cc.

bool ell::S_SG_NPP::operator!= ( const State state2  )  const [virtual]

Reimplemented from ell::S_SG_Ising.

Definition at line 38 of file S_SG_NPP.cc.

void ell::S_SG_NPP::operator= ( const S_SG_NPP sg2  )  [virtual]

Definition at line 48 of file S_SG_NPP.cc.

bool ell::S_SG_NPP::operator== ( const State state2  )  const [virtual]

Reimplemented from ell::S_SG_Ising.

Definition at line 28 of file S_SG_NPP.cc.

std::string ell::S_SG_Ising::toString (  )  const [virtual, inherited]

Returns a +- std::string representation of this spin glass array.

Implements ell::State.

Definition at line 121 of file S_SG_Ising.cc.

State * ell::S_SG_Ising::uncompress ( const CSequence cseq  )  [virtual, inherited]

Uncompresses a compressed sequencce representation into a this State object.

Parameters:
cseq the compressed sequence representation of a state
Returns:
this or NULL in error case

Implements ell::State.

Definition at line 278 of file S_SG_Ising.cc.

State * ell::S_SG_NPP::uncompress ( const CSequence cseq,
State toFill 
) const [virtual]

Uncompresses a compressed sequencce representation into a new State object.

Parameters:
cseq the compressed sequence representation of a state
toFill a state object to uncompress too or NULL if a new object has to be created
Returns:
new State object that is encoded in cseq or NULL in error case.

Reimplemented from ell::S_SG_Ising.

Definition at line 141 of file S_SG_NPP.cc.

State * ell::S_SG_Ising::undoNeighborChange ( const size_t  index,
State *const   neigh 
) const [virtual, inherited]

Undo the changes done to this state to generate the given neighbor. The goal is to do less operations than doing a full copy like (*neigh = *this).

Parameters:
index the neighbor index that was applied last [ 0, getNeighborNumber() )
neigh the state resulting from the last changes ( != NULL)
Returns:
the copy of this object via undoing the last changes in neigh

Implements ell::IterableNeighbors.

Definition at line 202 of file S_SG_Ising.cc.


Field Documentation

SpinArray ell::S_SG_Ising::spin [protected, inherited]

the spin array representing the +-1 spin

Definition at line 35 of file S_SG_Ising.hh.

Definition at line 27 of file S_SG_Ising.hh.

Definition at line 26 of file S_SG_Ising.hh.

const biu::Alphabet ell::S_SG_Ising::spinAlph [static, protected, inherited]

the spin alphabet class for compression usage

Definition at line 32 of file S_SG_Ising.hh.

const WeightType* ell::S_SG_NPP::weights [protected]

the weight for each spin

Definition at line 22 of file S_SG_NPP.hh.


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