Public Member Functions | Private Attributes

StochModelComp Class Reference

The class describes an entity in a stochastic model. More...

#include <StochModelComp.h>

Inheritance diagram for StochModelComp:
ModelComp

List of all members.

Public Member Functions

 StochModelComp (const std::string &id)
 Constructor that sets everything to default values.
 StochModelComp (const std::string &id_, compType type, SyntaxNode *indexing, SyntaxNode *attrib, StochModel *stoch=NULL)
 Constructor.
ModelComptranscribeToModelComp (AmplModel *current_model, const std::string &nodedummy, const std::string &stagedummy, const int level)
 Transcribe a StochModelComp in a StochModel into a ModelComp.
StochModelCompclone () const
 Shallow copy, only copies pointers.
void setStochModel (StochModel *stoch)
 Set the stochastic model.
void setStageSet (SyntaxNode *stageSet)
 Set the stage set.
const SyntaxNodegetStageSet () const
 Retrieve the stage set.
void setDeterministic (bool det)
 Set whether this component varies only over the stages.
void addStageName (const std::string &name)
 Append a stage name.
const std::vector< std::string > & getStageNames () const
 Get a reference to the vector of stage names.

Private Attributes

bool is_deterministic
 Whether the stochastic component is deterministic.
SyntaxNodestageset
 Set of stages in which component is present.
std::vector< std::string > stagenames
 List of stages in which this component is present.
StochModelstochmodel
 StochModel this component belongs to.

Detailed Description

The class describes an entity in a stochastic model.

The class stores information that is read in from a stochastic block It is equivalent to the ModelComp class, the only difference is that is also stores an expression corresponding to the applicable stageset and a possible deterministic attribute.

This component is repeated over all nodes belonging to stages that are listed in the stageset.


Constructor & Destructor Documentation

StochModelComp::StochModelComp ( const std::string &  id  ) 

Constructor that sets everything to default values.

Referenced by clone().

StochModelComp::StochModelComp ( const std::string &  id_,
compType  type,
SyntaxNode indexing,
SyntaxNode attrib,
StochModel stoch = NULL 
)

Constructor.


Member Function Documentation

void StochModelComp::addStageName ( const std::string &  name  )  [virtual]

Append a stage name.

Reimplemented from ModelComp.

References stagenames.

const std::vector<std::string>& StochModelComp::getStageNames (  )  const [inline, virtual]

Get a reference to the vector of stage names.

Reimplemented from ModelComp.

References stagenames.

const SyntaxNode* StochModelComp::getStageSet (  )  const [inline, virtual]

Retrieve the stage set.

Reimplemented from ModelComp.

References stageset.

void StochModelComp::setDeterministic ( bool  det  )  [inline, virtual]

Set whether this component varies only over the stages.

Reimplemented from ModelComp.

References is_deterministic.

void StochModelComp::setStageSet ( SyntaxNode stageSet  )  [inline, virtual]

Set the stage set.

Reimplemented from ModelComp.

References stageset.

void StochModelComp::setStochModel ( StochModel stoch  )  [inline, virtual]

Set the stochastic model.

Reimplemented from ModelComp.

References stochmodel.

ModelComp * StochModelComp::transcribeToModelComp ( AmplModel current_model,
const std::string &  nodedummy,
const std::string &  stagedummy,
const int  level 
) [virtual]

Transcribe a StochModelComp in a StochModel into a ModelComp.

This function takes a StochModelComp as read in by the parser and transcribes it into a corresponding ModelComp of the current FlatModel. It does this by:

  • Scanning for all IDREF references to entities defined in the StochModel and replacing this by references to entities in the FlatModel (i.e the pointer to a StochModelComp is replaced by a pointer to the corresponding ModelComp). This also deals with references to StochModel entities in a different stage (i.e. through xh(-1;...))
  • Objective components have a term for the node probability added
  • replacing special StochModel constructs (i.e. Exp(...)) by their corresponding constructs in the FlatModel
    Parameters:
    [in] current_model The current AmplModel that all references should be resolved to.
    [in] nodedummy The name of the dummy index for the node set.
    [in] stagedummy The name of the dummy index for the stage set.
    [in] level The level of this AmplModel within the StochModel (root is 0).
    Precondition:
    SyntaxNode::stage and SyntaxNode::node need to be set.
    Note:
    The gloabl variables SyntaxNode::stage and SyntaxNode::node are used to replace all NODE and STAGE nodes in the attribute list.

Reimplemented from ModelComp.

References ModelComp::attributes, buildPathProbTerm(), COMMA, AmplModel::comps, SyntaxNode::deep_copy(), ModelComp::deep_copy(), EXPECTATION, SyntaxNode::findOpCode(), SyntaxNode::front(), SyntaxNode::getOpCode(), SyntaxNodeIDREF::getStochParent(), IDNode::id(), ID, ModelComp::id, ModelComp::indexing, LBRACE, LBRACKET, ModelComp::model, ModelComp::moveUp(), AmplModel::node, StageNodeNode::node, AmplModel::parent, prtSM, SyntaxNode::push_back(), SyntaxNode::push_front(), SyntaxNodeIDREF::ref, IDNode::setName(), StageNodeNode::stage, stochmodel, SUM, TMAX, TMIN, to_string(), and ModelComp::type.

Referenced by StochModel::_transcribeComponents().


Member Data Documentation

Whether the stochastic component is deterministic.

By default all stochastic block components are repeated over all nodes in the scenario tree: a deterministic component only varies over stages.

Referenced by clone(), and setDeterministic().

std::vector<std::string> StochModelComp::stagenames [private]

List of stages in which this component is present.

Referenced by addStageName(), clone(), and getStageNames().

Set of stages in which component is present.

Referenced by clone(), getStageSet(), and setStageSet().

StochModel this component belongs to.

Referenced by clone(), setStochModel(), and transcribeToModelComp().


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