Version: 9.16.0
YACS::ENGINE::SalomeOptimizerLoop Class Reference

class to build optimization loops More...

#include <SalomeOptimizerLoop.hxx>

Inheritance diagram for YACS::ENGINE::SalomeOptimizerLoop:
Collaboration diagram for YACS::ENGINE::SalomeOptimizerLoop:

Public Member Functions

 SalomeOptimizerLoop (const std::string &name, const std::string &algLibWthOutExt, const std::string &symbolNameToOptimizerAlgBaseInstanceFactory, bool algInitOnFile, bool initAlgo=true, Proc *procForTypes=NULL)
 
 SalomeOptimizerLoop (const SalomeOptimizerLoop &other, ComposedNode *father, bool editionOnly)
 
 ~SalomeOptimizerLoop ()
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::OptimizerLoop
 OptimizerLoop (const std::string &name, const std::string &algLibWthOutExt, const std::string &symbolNameToOptimizerAlgBaseInstanceFactory, bool algInitOnFile, bool initAlgo=true, Proc *procForTypes=NULL)
 
 OptimizerLoop (const OptimizerLoop &other, ComposedNode *father, bool editionOnly)
 
 ~OptimizerLoop ()
 
void init (bool start=true)
 
void exUpdateState ()
 Update the node state. More...
 
int getNumberOfInputPorts () const
 
InputPortedGetPortForOutPool ()
 
InputPortedGetAlgoInitPort ()
 
OutputPortedGetAlgoResultPort ()
 
InputPortgetInputPort (const std::string &name) const
 Get an input port given its name. More...
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
void selectRunnableTasks (std::vector< Task * > &tasks)
 
void getReadyTasks (std::vector< Task * > &tasks)
 
YACS::Event updateStateOnFinishedEventFrom (Node *node)
 
void checkNoCyclePassingThrough (Node *node)
 
virtual void accept (Visitor *visitor)
 
virtual std::string getSymbol () const
 
virtual std::string getAlgLib () const
 Return the name of the algorithm library. More...
 
virtual void setAlgorithm (const std::string &alglib, const std::string &symbol, bool checkLinks=true, Proc *procForTypes=NULL)
 Set the algorithm library name and factory name (symbol in library) to create the algorithm and change it if the node is not connected. More...
 
virtual void checkBasicConsistency () const
 Check validity for the node. More...
 
virtual std::string typeName ()
 
int getNumberOfOutputPorts () const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< OutputPort * > getLocalOutputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
OutPortgetOutPort (const std::string &name) const
 
OutputPortgetOutputPort (const std::string &name) const
 Get an output port given its name. More...
 
YACS::Event finalize ()
 
- Public Member Functions inherited from YACS::ENGINE::DynParaLoop
NodeedRemoveNode ()
 
NodeedRemoveInitNode ()
 
NodeedRemoveFinalizeNode ()
 
NodeedSetNode (Node *DISOWNnode)
 
NodeedSetInitNode (Node *DISOWNnode)
 
NodeedSetFinalizeNode (Node *DISOWNnode)
 
virtual bool edAddDFLink (OutPort *start, InPort *end)
 Connect an OutPort to an InPort and add control link if necessary. More...
 
void init (bool start=true)
 
InputPortedGetNbOfBranchesPort ()
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
unsigned getNumberOfEltsConsumed () const
 
int getBranchIDOfNode (Node *node) const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< OutputPort * > getLocalOutputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
OutputPortedGetSamplePort ()
 
OutPortgetOutPort (const std::string &name) const
 
InputPortgetInputPort (const std::string &name) const
 Get an input port given its name. More...
 
OutputPortgetOutputPort (const std::string &name) const
 Get an output port given its name. More...
 
bool isPlacementPredictableB4Run () const
 For the moment false is returned : impovement about it coming soon. More...
 
void edRemoveChild (Node *node)
 Remove a child node. More...
 
bool isLoop () const override
 
virtual bool edAddChild (Node *DISOWNnode)
 
std::list< Node * > edGetDirectDescendants () const
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
unsigned getNumberOfBranchesCreatedDyn () const
 
NodegetChildByShortName (const std::string &name) const
 
NodegetChildByNameExec (const std::string &name, unsigned id) const
 
std::vector< Node * > getNodes () const
 
ComplexWeightgetWeight ()
 
void setWeight (double loopWeight)
 
void getWeightRegardingDPL (ComplexWeight *weight)
 
bool isMultiplicitySpecified (unsigned &value) const
 
void forceMultiplicity (unsigned value)
 
virtual void checkBasicConsistency () const
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
void accept (Visitor *visitor)
 
NodegetInitNode ()
 
NodegetExecNode ()
 
NodegetFinalizeNode ()
 
int getMaxLevelOfParallelism () const
 
void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
 
virtual void cleanDynGraph ()
 
- Public Member Functions inherited from YACS::ENGINE::ComposedNode
virtual ~ComposedNode ()
 
bool isFinished ()
 
void init (bool start=true)
 
virtual void shutdown (int level)
 Stop all pending activities of the composed node. More...
 
virtual void resetState (int level)
 Reset the state of the node and its children depending on the parameter level. More...
 
std::string getName () const
 
std::string getTaskName (Task *task) const
 
DeploymentTree getDeploymentTree () const
 Essentially for test. Use checkDeploymentTree instead to be sure that returned DeploymentTree is consistent. More...
 
DeploymentTree checkDeploymentTree (bool deep) const
 Perform check of deployment consistency of the current graph. More...
 
std::vector< Task * > getNextTasks (bool &isMore)
 
virtual bool isPlacementPredictableB4Run () const =0
 
void notifyFrom (const Task *sender, YACS::Event event, const Executor *execInst)
 Notify the node a task has emitted an event. More...
 
bool edAddLink (OutPort *start, InPort *end)
 Add a dataflow link between two data ports. More...
 
virtual bool edAddDFLink (OutPort *start, InPort *end)
 Connect an OutPort to an InPort and add the necessary control link. More...
 
virtual bool edAddChild (Node *DISOWNnode)
 
virtual void edRemoveChild (Node *node)
 Remove a child node. More...
 
bool edAddLink (OutGate *start, InGate *end)
 Add a controlflow link between two control ports. More...
 
bool edAddCFLink (Node *nodeS, Node *nodeE)
 Add a controlflow link between two nodes. More...
 
void edRemoveCFLink (Node *nodeS, Node *nodeE)
 Remove a controlflow link. More...
 
void edRemoveLink (OutPort *start, InPort *end)
 Remove a dataflow link. More...
 
void edRemoveLink (OutGate *start, InGate *end)
 Remove a controlflow link. More...
 
virtual bool isRepeatedUnpredictablySeveralTimes () const
 
virtual bool isLoop () const
 
virtual std::list< Node * > edGetDirectDescendants () const =0
 
virtual void removeRecursivelyRedundantCL ()
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< Node * > getAllRecursiveNodes ()
 Get all children nodes elementary and composed including this node. More...
 
virtual std::list< Node * > getAllRecursiveConstituents ()
 Idem getAllRecursiveNodes, but this node is NOT included. More...
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
std::string getInPortName (const InPort *) const
 Get the input port name. More...
 
std::string getOutPortName (const OutPort *) const
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
std::list< OutputPort * > getLocalOutputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const
 List all output ports of children nodes that are linked to out of scope input ports. More...
 
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const
 List all input ports that are linked to out of scope ports. More...
 
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const
 
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const
 
OutPortgetOutPort (const std::string &name) const
 
InputPortgetInputPort (const std::string &name) const
 Get an input port given its name. More...
 
OutputPortgetOutputPort (const std::string &name) const
 Get an output port given its name. More...
 
InputDataStreamPortgetInputDataStreamPort (const std::string &name) const
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const
 
std::vector< std::pair< OutPort *, InPort * > > getSetOfInternalLinks () const
 
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope () const
 
void checkConsistency (LinkInfo &info) const
 
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope () const
 
virtual std::string typeName ()
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual void checkBasicConsistency () const
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
ComposedNodegetRootNode () const
 
bool isNodeAlreadyAggregated (const Node *node) const
 Check that Node 'node' is already a direct son of this. More...
 
virtual bool isNameAlreadyUsed (const std::string &name) const
 
NodeisInMyDescendance (Node *nodeToTest) const
 Returns the parent of a node that is the direct child of this node. More...
 
std::string getChildName (const Node *node) const
 
virtual std::string getMyQualifiedName (const Node *directSon) const
 
NodegetChildByName (const std::string &name) const
 
void loaded ()
 
void connected ()
 
void accept (Visitor *visitor)
 
virtual void cleanNodes ()
 Clean the composed node in case of not clean exit. More...
 
virtual std::string getProgress () const
 
void setProperty (const std::string &name, const std::string &value) override
 
std::string getProperty (const std::string &name) override
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
virtual void init (bool start=true)
 
virtual void shutdown (int level)
 Stop all pending activities of the node. More...
 
virtual void resetState (int level)
 Reset the node state depending on the parameter level. More...
 
Nodeclone (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
NodecloneWithoutCompAndContDeepCpy (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
void setState (YACS::StatesForNode theState)
 Sets the given state for node. More...
 
virtual YACS::StatesForNode getState () const
 
virtual YACS::StatesForNode getEffectiveState () const
 Return the node state in the context of its father. More...
 
virtual YACS::StatesForNode getEffectiveState (const Node *) const
 Return the effective state of a node in the context of this one (its father) More...
 
std::string getColorState (YACS::StatesForNode state) const
 Return the color associated to a state. More...
 
InGategetInGate ()
 
OutGategetOutGate ()
 
const std::string & getName () const
 
void setName (const std::string &name)
 Change the name of the node. More...
 
ComposedNodegetFather () const
 
const std::string getId () const
 
bool exIsControlReady () const
 
std::list< Node * > getOutNodes () const
 
virtual void writeDot (std::ostream &os) const
 Dump to the input stream a dot representation of the node. More...
 
void writeDotInFile (const std::string &fileName) const
 
virtual void exUpdateState ()
 Update the node state. More...
 
virtual void exFailedState ()
 Notify this node that its execution has failed. More...
 
virtual void exDisabledState ()
 Notify this node that it has been disabled. More...
 
virtual void getReadyTasks (std::vector< Task * > &tasks)=0
 
virtual std::list< ElementaryNode * > getRecursiveConstituents () const =0
 
virtual std::list< ProgressWeightgetProgressWeight () const =0
 
virtual int getNumberOfInputPorts () const =0
 
virtual int getNumberOfOutputPorts () const =0
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::list< InputPort * > getSetOfInputPort () const =0
 
virtual std::list< OutputPort * > getSetOfOutputPort () const =0
 
virtual std::list< InputPort * > getLocalInputPorts () const =0
 
virtual std::list< OutputPort * > getLocalOutputPorts () const =0
 
virtual std::set< InputPort * > edGetSetOfUnitializedInputPort () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
virtual bool edAreAllInputPortInitialized () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
virtual std::string getInPortName (const InPort *) const =0
 
virtual std::string getOutPortName (const OutPort *) const =0
 
virtual std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const =0
 
virtual std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const =0
 
InPortgetInPort (const std::string &name) const
 
InPropertyPortgetInPropertyPort () const
 
virtual OutPortgetOutPort (const std::string &name) const
 
virtual std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const =0
 
virtual std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const =0
 
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope () const =0
 
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope () const =0
 
virtual InputPortgetInputPort (const std::string &name) const
 
virtual OutputPortgetOutputPort (const std::string &name) const =0
 
virtual InputDataStreamPortgetInputDataStreamPort (const std::string &name) const =0
 
virtual OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const =0
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
DynParaLoopgetClosestDPLAmongAncestors () const
 
virtual ComposedNodegetRootNode () const
 
virtual void setProperty (const std::string &name, const std::string &value)
 
virtual std::string getProperty (const std::string &name)
 
std::map< std::string, std::string > getProperties ()
 
std::map< std::string, std::string > getPropertyMap ()
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
virtual NodegetChildByName (const std::string &name) const =0
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
virtual void accept (Visitor *visitor)=0
 
virtual int getMaxLevelOfParallelism () const =0
 
virtual void getWeightRegardingDPL (ComplexWeight *weight)=0
 
virtual void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)=0
 
std::string getQualifiedName () const
 same as Node::getName() in most cases, but differs for children of switch More...
 
int getNumId ()
 return node instance identifiant, unique for each node instance More...
 
std::vector< std::pair< std::string, int > > getDPLScopeInfo (ComposedNode *gfn)
 
virtual void applyDPLScope (ComposedNode *gfn)
 
virtual void sendEvent (const std::string &event)
 emit notification to all observers registered with the dispatcher More...
 
virtual void sendEvent2 (const std::string &event, void *something)
 emit notification to all observers registered with the dispatcher More...
 
virtual std::string typeName ()
 
virtual std::string getErrorDetails () const
 
virtual void setErrorDetails (const std::string &error)
 
virtual void modified ()
 Sets Node in modified state and its father if it exists. More...
 
virtual int isModified ()
 
virtual int isValid ()
 indicates if the node is valid (returns 1) or not (returns 0) More...
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
virtual std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledNodes)
 
virtual void cleanNodes ()
 Clean the node in case of not clean exit. More...
 
- Public Member Functions inherited from YACS::ENGINE::Scheduler
virtual void init (bool start=true)=0
 
virtual bool isFinished ()=0
 
virtual void exUpdateState ()=0
 
virtual std::string getName () const =0
 
virtual std::string getTaskName (Task *task) const =0
 
virtual std::vector< Task * > getNextTasks (bool &isMore)=0
 
virtual void selectRunnableTasks (std::vector< Task * > &tasks)=0
 
virtual void notifyFrom (const Task *sender, YACS::Event event, const Executor *execInst)=0
 
virtual DeploymentTree getDeploymentTree () const =0
 
virtual bool isPlacementPredictableB4Run () const =0
 
virtual bool isMultiplicitySpecified (unsigned &value) const =0
 
virtual void forceMultiplicity (unsigned value)=0
 
virtual void setProperty (const std::string &name, const std::string &value)=0
 
virtual std::string getProperty (const std::string &name)=0
 
virtual ~Scheduler ()
 

Protected Member Functions

NodesimpleClone (ComposedNode *father, bool editionOnly) const
 
virtual void loadAlgorithm ()
 Load the algorithm object from a Python module or a dynamic library. More...
 
- Protected Member Functions inherited from YACS::ENGINE::OptimizerLoop
virtual YACS::Event updateStateOnFailedEventFrom (Node *node, const Executor *execInst)
 Method used to notify the node that a child node has failed. More...
 
void buildDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
void buildDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void checkControlDependancy (OutPort *start, InPort *end, bool cross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &fw, std::vector< OutPort * > &fwCross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &bw, LinkInfo &info) const
 
void checkCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 check control flow links More...
 
void checkLinkPossibility (OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
 
void cleanInterceptors ()
 
void launchMaxOfSamples (bool first)
 
bool isFullyLazy () const
 
bool isFullyBusy (unsigned &branchId) const
 
void initInterceptors (unsigned nbOfBr)
 
void pushValueOutOfScopeForCase (unsigned branchId)
 
NodesimpleClone (ComposedNode *father, bool editionOnly=true) const
 
virtual void loadAlgorithm ()
 Load the algorithm from the dynamic library. More...
 
- Protected Member Functions inherited from YACS::ENGINE::DynParaLoop
 DynParaLoop (const std::string &name, TypeCode *typeOfDataSplitted, std::unique_ptr< NbBranchesAbstract > &&branchManager)
 
virtual ~DynParaLoop ()
 
 DynParaLoop (const DynParaLoop &other, ComposedNode *father, bool editionOnly)
 
void buildDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
void buildDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void checkCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 check control flow links More...
 
void checkControlDependancy (OutPort *start, InPort *end, bool cross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &fw, std::vector< OutPort * > &fwCross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &bw, LinkInfo &info) const
 
virtual void checkLinkPossibility (OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
 
void prepareInputsFromOutOfScope (int branchNb)
 
void putValueOnBranch (Any *val, unsigned branchId, bool first)
 
TypeOfNode getIdentityOfNotifyerNode (const Node *node, unsigned &id)
 
InputPortgetDynInputPortByAbsName (int branchNb, const std::string &name, bool initNodeAdmitted)
 
virtual void forwardExecStateToOriginalBody (Node *execNode)
 
virtual YACS::Event updateStateOnFailedEventFrom (Node *node, const Executor *execInst)
 Method used to notify the node that a child node has failed. More...
 
std::vector< Node * > cloneAndPlaceNodesCoherently (const std::vector< Node * > &origNodes)
 Clone nodes and make their placement consistent with the placement of the original ones. More...
 
NodecheckConsistencyAndSetNode (Node *&nodeToReplace, Node *DISOWNnode)
 This method is used to factorize methods edSetNode, edSetInitNode and edSetFinalizeNode. More...
 
NoderemoveNode (Node *&nodeToRemove)
 This method is used to factorize methods edRemoveNode, edRemoveInitNode and edRemoveFinalizeNode. More...
 
virtual void shutdown (int level)
 Stop all pending activities of the composed node. More...
 
- Protected Member Functions inherited from YACS::ENGINE::ComposedNode
 ComposedNode (const std::string &name)
 
 ComposedNode (const ComposedNode &other, ComposedNode *father)
 
void performDuplicationOfPlacement (const Node &other)
 performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. More...
 
void performShallowDuplicationOfPlacement (const Node &other)
 performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. More...
 
void edDisconnectAllLinksWithMe ()
 
virtual NodegetChildByShortName (const std::string &name) const =0
 
YACS::Event updateStateFrom (Node *node, YACS::Event event, const Executor *execInst)
 Update node state on receiving event from a node. More...
 
virtual YACS::Event updateStateOnStartEventFrom (Node *node)
 Method used to notify the node that a child node has started. More...
 
virtual YACS::Event updateStateOnFinishedEventFrom (Node *node)=0
 
virtual YACS::Event updateStateOnFailedEventFrom (Node *node, const Executor *execInst)
 Method used to notify the node that a child node has failed. More...
 
virtual void checkLinkPossibility (OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
 
virtual void buildDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void buildDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
virtual void getDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void getDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
virtual void releaseDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void releaseDelegateOf (OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
virtual void checkNoCyclePassingThrough (Node *node)=0
 
void checkInMyDescendance (Node *nodeToTest) const
 Check if a node is in the descendance of this node. More...
 
template<class PORT >
std::string getPortName (const PORT *port) const
 
void checkNoCrossHierachyWith (Node *node) const
 
virtual void performCFComputations (LinkInfo &info) const
 perform recursively all CF computations. More...
 
virtual void destructCFComputations (LinkInfo &info) const
 destroy recursively all results of initial computations. More...
 
NodegetLowestNodeDealingAll (const std::list< OutPort * > &ports) const
 
void checkLinksCoherenceRegardingControl (const std::vector< OutPort * > &starts, InputPort *end, LinkInfo &info) const
 
virtual void checkControlDependancy (OutPort *start, InPort *end, bool cross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &fw, std::vector< OutPort * > &fwCross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &bw, LinkInfo &info) const =0
 
void solveObviousOrDelegateCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 
virtual void checkCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 check control flow links More...
 
- Protected Member Functions inherited from YACS::ENGINE::Node
 Node (const std::string &name)
 
 Node (const Node &other, ComposedNode *father)
 
virtual void performDuplicationOfPlacement (const Node &other)=0
 performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. More...
 
virtual void performShallowDuplicationOfPlacement (const Node &other)=0
 performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. More...
 
virtual NodesimpleClone (ComposedNode *father, bool editionOnly=true) const =0
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 
virtual void edDisconnectAllLinksWithMe ()
 

Private Attributes

PyObject * _pyAlgo = nullptr
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::ComposedNode
static ComposedNodegetLowestCommonAncestor (Node *node1, Node *node2)
 Retrieves the lowest common ancestor of 2 nodes. More...
 
static std::string getLowestCommonAncestorStr (const std::string &node1, const std::string &node2)
 
- Static Public Member Functions inherited from YACS::ENGINE::Node
static std::string getStateName (YACS::StatesForNode state)
 Return the name of a state. More...
 
static void checkValidityOfNodeName (const std::string &name)
 
- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 
- Static Public Attributes inherited from YACS::ENGINE::ComposedNode
static const char SEP_CHAR_BTW_LEVEL [] ="."
 
- Static Public Attributes inherited from YACS::ENGINE::Node
static std::map< int, Node * > idMap
 
- Protected Types inherited from YACS::ENGINE::DynParaLoop
enum  TypeOfNode { INIT_NODE = 5 , WORK_NODE = 6 , FINALIZE_NODE = 7 }
 
- Static Protected Member Functions inherited from YACS::ENGINE::ComposedNode
static bool splitNamesBySep (const std::string &globalName, const char separator[], std::string &firstPart, std::string &lastPart, bool priority)
 Splits name globalName in 2 parts using separator. More...
 
- Static Protected Member Functions inherited from YACS::ENGINE::Node
static void checkValidityOfPortName (const std::string &name)
 
static ComposedNodecheckHavingCommonFather (Node *node1, Node *node2)
 
- Protected Attributes inherited from YACS::ENGINE::OptimizerLoop
Pool _myPool
 
bool _algInitOnFile
 
std::string _symbol
 
std::string _alglib
 
AnyInputPort _algoInitPort
 
::YACS::BASES::DynLibLoader * _loader
 
OptimizerAlgBase_alg
 
AnyInputPort _retPortForOutPool
 
std::vector< bool > _initNodeUpdated
 
bool _convergenceReachedWithOtherCalc
 
FakeNodeForOptimizerLoop_nodeForSpecialCases
 
std::vector< AnyInputPort * > _interceptorsForOutPool
 
std::map< InputPort *, std::vector< InputPort * > > _interceptors
 outputports interceptors leaving current scope. More...
 
AnyOutputPort _algoResultPort
 
- Protected Attributes inherited from YACS::ENGINE::DynParaLoop
Node_node
 
Node_initNode
 
Node_finalizeNode
 
unsigned _nbOfEltConsumed
 
std::vector< int > _execIds
 
std::unique_ptr< NbBranchesAbstract_nbOfBranches
 
AnyOutputPort _splittedPort
 
std::vector< Node * > _execNodes
 
std::vector< Node * > _execInitNodes
 
std::vector< Node * > _execFinalizeNodes
 
int _initializingCounter
 
int _unfinishedCounter
 
int _failedCounter
 
ComplexWeight _weight
 
double _loopWeight
 
- Protected Attributes inherited from YACS::ENGINE::Node
InGate _inGate
 
OutGate _outGate
 
InPropertyPort_inPropertyPort
 
std::string _name
 
ComposedNode_father
 
YACS::StatesForNode _state
 
int _modified
 
std::string _errorDetails
 
int _numId
 
std::string _implementation
 
std::map< std::string, std::string > _propertyMap
 
Node_eventReceiver =nullptr
 
- Static Protected Attributes inherited from YACS::ENGINE::OptimizerLoop
static const int NOT_RUNNING_BRANCH_ID =-1973012217
 
static const int NOT_INITIALIZED_BRANCH_ID =-1973
 
static const char NAME_OF_ALGO_INIT_PORT [] = "algoInit"
 
static const char NAME_OF_OUT_POOL_INPUT [] = "evalResults"
 
static const char NAME_OF_ALGO_RESULT_PORT [] = "algoResults"
 
- Static Protected Attributes inherited from YACS::ENGINE::DynParaLoop
static const char NAME_OF_SPLITTED_SEQ_OUT [] = "evalSamples"
 
static const char OLD_NAME_OF_SPLITTED_SEQ_OUT [] = "SmplPrt"
 
- Static Protected Attributes inherited from YACS::ENGINE::ComposedNode
static const unsigned char FED_ST = 2
 
static const unsigned char FREE_ST = 0
 
static const unsigned char FED_DS_ST = 1
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

class to build optimization loops

Definition at line 31 of file SalomeOptimizerLoop.hxx.

Constructor & Destructor Documentation

◆ SalomeOptimizerLoop() [1/2]

SalomeOptimizerLoop::SalomeOptimizerLoop ( const std::string &  name,
const std::string &  algLibWthOutExt,
const std::string &  symbolNameToOptimizerAlgBaseInstanceFactory,
bool  algInitOnFile,
bool  initAlgo = true,
Proc procForTypes = NULL 
)

Definition at line 47 of file SalomeOptimizerLoop.cxx.

49 :
50 OptimizerLoop(name,algLibWthOutExt,symbolNameToOptimizerAlgBaseInstanceFactory,algInitOnFile,false)
51{
52 if(initAlgo)
53 {
54 //try
55 // {
56 setAlgorithm(algLibWthOutExt, symbolNameToOptimizerAlgBaseInstanceFactory, true, procForTypes);
57 // }
58 //catch(YACS::Exception& e)
59 // {
60 //ignore it
61 // }
62 }
63}
virtual void setAlgorithm(const std::string &alglib, const std::string &symbol, bool checkLinks=true, Proc *procForTypes=NULL)
Set the algorithm library name and factory name (symbol in library) to create the algorithm and chang...
OptimizerLoop(const std::string &name, const std::string &algLibWthOutExt, const std::string &symbolNameToOptimizerAlgBaseInstanceFactory, bool algInitOnFile, bool initAlgo=true, Proc *procForTypes=NULL)

References YACS::ENGINE::OptimizerLoop::setAlgorithm().

Referenced by simpleClone().

◆ SalomeOptimizerLoop() [2/2]

SalomeOptimizerLoop::SalomeOptimizerLoop ( const SalomeOptimizerLoop other,
ComposedNode father,
bool  editionOnly 
)

Definition at line 65 of file SalomeOptimizerLoop.cxx.

65 :
66 OptimizerLoop(other,father,editionOnly)
67{
68}

◆ ~SalomeOptimizerLoop()

SalomeOptimizerLoop::~SalomeOptimizerLoop ( )

Definition at line 70 of file SalomeOptimizerLoop.cxx.

71{
72 Py_XDECREF(_pyAlgo);
73}

References _pyAlgo.

Member Function Documentation

◆ loadAlgorithm()

void SalomeOptimizerLoop::loadAlgorithm ( )
protectedvirtual

Load the algorithm object from a Python module or a dynamic library.

Member _alglib is the library name (shared library WITHOUT extension .so or python module WITH extension .py). Member _symbol is a symbol name in the library to use as an algorithm factory.

Reimplemented from YACS::ENGINE::OptimizerLoop.

Definition at line 94 of file SalomeOptimizerLoop.cxx.

95{
96 YASSERT(_alg == NULL)
97
98 if(_alglib.size() > 3 && _alglib.substr(_alglib.size()-3,3)==".py")
99 {
100 //if alglib extension is .py try to import the corresponding python module
101 PyGILState_STATE gstate=PyGILState_Ensure();
102
103 PyObject* mainmod = PyImport_AddModule("__main__");
104 PyObject* globals = PyModule_GetDict(mainmod);
105
106 std::string pyscript;
107 pyscript="import sys\n"
108 "import SALOMERuntime\n"
109 "filename='";
110 pyscript=pyscript+_alglib+"'\nentry='"+_symbol+"'\n";
111 pyscript=pyscript+"import os\n"
112 "import pilot\n"
113 "rep,mod=os.path.split(os.path.splitext(filename)[0])\n"
114 "if rep != '':\n"
115 " sys.path.insert(0,rep)\n"
116 "algomodule=__import__(mod)\n"
117 "if rep != '':\n"
118 " del sys.path[0]\n"
119 "algoclass= getattr(algomodule,entry)\n"
120 "algo= algoclass()\n"
121 "swigalgo= algo.this\n"
122 "\n";
123
124 PyObject* res=PyRun_String(pyscript.c_str(), Py_file_input, globals, globals );
125
126 if(res == NULL)
127 {
128 //error during import
129 _errorDetails="";
130 PyObject* new_stderr = newPyStdOut(_errorDetails);
131 PySys_SetObject((char*)"stderr", new_stderr);
132 PyErr_Print();
133 PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
134 Py_DECREF(new_stderr);
135 modified();
136 PyGILState_Release(gstate);
138 }
139 else
140 {
141 Py_DECREF(res);
142
143 typedef struct {
144 PyObject_HEAD
145 void *ptr;
146 void *ty;
147 int own;
148 PyObject *next;
149 } SwigPyObject;
150
151 PyObject * _pyAlgo = PyDict_GetItemString(globals, "algo");
152 Py_XINCREF(_pyAlgo);
153 SwigPyObject* pyalgo = (SwigPyObject*)PyDict_GetItemString(globals, "swigalgo");
154 _alg=(OptimizerAlgBase*)pyalgo->ptr;
156 }
157 PyGILState_Release(gstate);
158 }
159 else
160 {
161 //else try to load a dynamic library
163 }
164}
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
virtual void modified()
Sets Node in modified state and its father if it exists.
Definition: Node.cxx:805
std::string _errorDetails
Definition: Node.hxx:93
Base class factorizing common methods for all algorithms interfaces.
virtual void setPool(Pool *pool)
virtual void loadAlgorithm()
Load the algorithm from the dynamic library.
PyObject * newPyStdOut(std::string &out)
Definition: PyStdout.cxx:129

References YACS::ENGINE::OptimizerLoop::_alg, YACS::ENGINE::OptimizerLoop::_alglib, YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::OptimizerLoop::_myPool, _pyAlgo, YACS::ENGINE::OptimizerLoop::_symbol, YACS::ENGINE::OptimizerLoop::loadAlgorithm(), YACS::ENGINE::Node::modified(), YACS::ENGINE::newPyStdOut(), YACS::ENGINE::OptimizerAlgBase::setPool(), and YASSERT.

◆ simpleClone()

Node * SalomeOptimizerLoop::simpleClone ( ComposedNode father,
bool  editionOnly 
) const
protectedvirtual

Reimplemented from YACS::ENGINE::OptimizerLoop.

Definition at line 75 of file SalomeOptimizerLoop.cxx.

76{
77 SalomeOptimizerLoop* sol=new SalomeOptimizerLoop(*this,father,editionOnly);
78 // TODO: Remove this const_cast (find a better design to get the type codes from the original node)
79 Proc * procForTypes = sol->getProc();
80 if (procForTypes == NULL) {
81 const Proc * origProc = getProc();
82 procForTypes = const_cast<Proc *>(origProc);
83 }
84 sol->setAlgorithm(_alglib, _symbol, false, procForTypes);
85 return sol;
86}
virtual Proc * getProc()
Definition: Node.cxx:401
Base class for all schema objects.
Definition: Proc.hxx:44
class to build optimization loops
SalomeOptimizerLoop(const std::string &name, const std::string &algLibWthOutExt, const std::string &symbolNameToOptimizerAlgBaseInstanceFactory, bool algInitOnFile, bool initAlgo=true, Proc *procForTypes=NULL)

References YACS::ENGINE::OptimizerLoop::_alglib, YACS::ENGINE::OptimizerLoop::_symbol, YACS::ENGINE::Node::getProc(), SalomeOptimizerLoop(), and YACS::ENGINE::OptimizerLoop::setAlgorithm().

◆ typeName()

virtual std::string YACS::ENGINE::SalomeOptimizerLoop::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::OptimizerLoop.

Definition at line 42 of file SalomeOptimizerLoop.hxx.

42{return "YACS__ENGINE__SalomeOptimizerLoop";}

Member Data Documentation

◆ _pyAlgo

PyObject* YACS::ENGINE::SalomeOptimizerLoop::_pyAlgo = nullptr
private

Definition at line 44 of file SalomeOptimizerLoop.hxx.

Referenced by loadAlgorithm(), and ~SalomeOptimizerLoop().


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