OpenStudioCore:analysis
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Related Functions | List of all members
openstudio::analysis::OptimizationProblem Class Reference

#include <OptimizationProblem.hpp>

+ Inheritance diagram for openstudio::analysis::OptimizationProblem:

Public Member Functions

Constructors and Destructors
 OptimizationProblem (const std::string &name, const std::vector< Function > &objectives, const std::vector< WorkflowStep > &workflow)
 
 OptimizationProblem (const std::string &name, const std::vector< Function > &objectives, const std::vector< WorkflowStep > &workflow, const std::vector< Function > &responses)
 
 OptimizationProblem (const std::string &name, const std::vector< Function > &objectives, const std::vector< Variable > &variables, const std::vector< Function > &responses, const runmanager::Workflow &simulationWorkflow)
 Construct from objectives, variables, responses and simulationWorkflow. More...
 
 OptimizationProblem (const std::string &name, const std::vector< Function > &objectives, const std::vector< Variable > &variables, const runmanager::Workflow &simulationWorkflow)
 
 OptimizationProblem (const UUID &uuid, const UUID &versionUUID, const std::string &name, const std::string &displayName, const std::string &description, const std::vector< Function > &objectives, const std::vector< WorkflowStep > &workflow, const std::vector< Function > &responses)
 Constructor provided for deserialization; not for general use. More...
 
virtual ~OptimizationProblem ()
 
Getters and Queries
std::vector< Functionobjectives () const
 
int numObjectives () const
 
Setters
void pushObjective (const Function &objective)
 
bool insertObjective (int index, const Function &objective)
 
bool eraseObjective (const Function &objective)
 
bool swapObjectives (const Function &objective1, const Function &objective2)
 
void setObjectiveFunctions (const std::vector< Function > &objectives)
 Sets objectives. More...
 
void clearObjectiveFunctions ()
 Clear all objective functions. More...
 
- Public Member Functions inherited from openstudio::analysis::Problem
 Problem (const std::string &name, const std::vector< WorkflowStep > &workflow=std::vector< WorkflowStep >())
 
 Problem (const std::string &name, const std::vector< WorkflowStep > &workflow, const std::vector< Function > &responses)
 
 Problem (const std::string &name, const std::vector< Variable > &variables, const std::vector< Function > &responses, const runmanager::Workflow &simulationWorkflow)
 Construct from variables (order will be preserved), response functions, and simulation workflow. More...
 
 Problem (const std::string &name, const std::vector< Variable > &variables, const runmanager::Workflow &simulationWorkflow)
 
 Problem (const UUID &uuid, const UUID &versionUUID, const std::string &name, const std::string &displayName, const std::string &description, const std::vector< WorkflowStep > &workflow, const std::vector< Function > &responses)
 Constructor provided for deserialization; not for general use. More...
 
virtual ~Problem ()
 
std::vector< WorkflowStepworkflow () const
 Returns the vector of WorkflowSteps that defines how this Problem will generate parametrically related DataPoints. More...
 
boost::optional< int > getWorkflowStepIndexByJobType (const runmanager::JobType &jobType) const
 If there is a runmanager::WorkItem of jobType in workflow(), returns the index of the first such runmanager::WorkItem. More...
 
int numWorkflowSteps () const
 
std::vector< InputVariablevariables () const
 Returns this problem's (ordered) list of input variables, that is, individual model parameters. More...
 
InputVariable getVariable (int index) const
 Returns the variable at index, where index refers to the vector returned by variables(). More...
 
boost::optional< int > getVariableIndexByUUID (const UUID &uuid) const
 Returns the index of the InputVariable with uuid, where index refers to the vector returned by variables(). More...
 
boost::optional< InputVariablegetVariableByUUID (const UUID &uuid) const
 
int numVariables () const
 Returns the number of variables in this problem. More...
 
int numContinuousVariables () const
 Returns the number of variables in this problem that derive from ContinuousVariable. More...
 
int numDiscreteVariables () const
 Returns the number of variables in this problem that derive from DiscreteVariable. More...
 
int numStaticTransformations () const
 Returns the number of discrete variables that have 0-1 measures selected. More...
 
bool allVariablesAreContinuous () const
 Returns true if numContinuousVariables() == numVariables(). More...
 
bool allVariablesAreContinuousOrStaticTransformations () const
 Returns true if all DiscreteVariables have either zero or one measure selected. More...
 
bool allVariablesAreDiscrete () const
 Returns true if numContinuousVariables() == 0. More...
 
std::vector< Functionresponses () const
 Returns this problem's response functions. More...
 
boost::optional< FunctiongetResponseByUUID (const UUID &uuid) const
 
int numResponses () const
 Returns the number of response functions associated with this problem. More...
 
boost::optional
< FileReferenceType > 
inputFileType () const
 Returns the input file type expected by workflow(). More...
 
bool isValid (const DataPoint &dataPoint) const
 Returns true if dataPoint.variableValues() make sense in the context of this Problem. More...
 
bool fileTypesAreCompatible (const WorkflowStep &childStep, const boost::optional< FileReferenceType > &proposedInputFileType, const boost::optional< FileReferenceType > &proposedOutputFileType) const
 Returns true if childStep is in this Problem, and proposedInputFileType and proposedOutputFileType would be acceptable in that position. More...
 
bool fileTypesAreCompatible (const InputVariable &childVariable, const boost::optional< FileReferenceType > &proposedInputFileType, const boost::optional< FileReferenceType > &proposedOutputFileType) const
 Returns true if childVariable is in this Problem, and proposedInputFileType and proposedOutputFileType would be acceptable in that position. More...
 
std::vector< QVariant > getVariableValues (const std::vector< Measure > &measures) const
 Converts measures to a vector of variable values stored in QVariant format. More...
 
std::vector< QVariant > getVariableValues (const std::vector< boost::optional< Measure > > &measures) const
 Converts measures to a vector of variable values stored in QVariant format, including null QVariant values (of the correct type, int or double) as necessary. More...
 
std::vector< boost::optional
< Measure > > 
getMeasures (const std::vector< QVariant > &variableValues) const
 Converts variableValues to a vector of Measures, leaving gaps for continuous variables by inserting boost::nones in the appropriate locations. More...
 
std::vector< boost::optional
< Measure > > 
getDiscretePerturbations (const std::vector< QVariant > &variableValues) const
 
boost::optional< int > combinatorialSize (bool selectedOnly) const
 If allVariablesAreDiscrete(), returns the number of DataPoints that would have to be simulated to populate the full mesh for this problem. More...
 
bool push (const WorkflowStep &step)
 
bool insert (int index, const WorkflowStep &step)
 
bool erase (const WorkflowStep &step)
 
bool swap (const WorkflowStep &step1, const WorkflowStep &step2)
 
bool setWorkflow (const std::vector< WorkflowStep > &workflow)
 
void clearWorkflow ()
 
void pushResponse (const Function &response)
 
bool insertResponse (int index, const Function &response)
 
bool eraseResponse (const Function &response)
 
bool swapResponses (const Function &response1, const Function &response2)
 
void setResponseFunctions (const std::vector< Function > &responses)
 
void clearResponseFunctions ()
 
bool updateMeasure (const BCLMeasure &newVersion, const std::vector< ruleset::OSArgument > &newArguments, bool keepOldArgumentsIfNewEmpty)
 Updates objects using BCLMeasures with the same UUID as newVersion to use newVersion. More...
 
std::string dakotaInFileDescription (const DakotaAlgorithm &algorithm) const
 Returns a description of this problem for using in dakota.in files. More...
 
boost::optional< DataPointcreateDataPoint (const std::vector< QVariant > &variableValues) const
 Constructs a new (incomplete) DataPoint for this problem using variableValues (if possible). More...
 
boost::optional< DataPointcreateDataPoint (const std::vector< Measure > &measures) const
 Returns a DataPoint if measures can be transformed into a valid set of variableValues. More...
 
boost::optional< DataPointcreateDataPoint (const DakotaParametersFile &params, const DakotaAlgorithm &algorithm) const
 Attempts to create a new DataPoint from params. More...
 
runmanager::Workflow createWorkflow (const DataPoint &dataPoint, const openstudio::path &rubyIncludeDirectory=openstudio::path()) const
 Returns the runmanager::Workflow created by instantiating all of the InputVariable WorkflowSteps as runmanager::WorkItems using the variable values specified in dataPoint. More...
 
void updateDataPoint (DataPoint &dataPoint, const runmanager::Job &completedJob) const
 Updates dataPoint post-simulation. More...
 
std::vector< WorkflowStepJobgetJobsByWorkflowStep (const DataPoint &dataPoint, bool optimize=false) const
 Returns the jobs stored in dataPoint broken down by WorkflowStep. More...
 
boost::optional< std::string > getDakotaResultsFile (const DataPoint &dataPoint) const
 Returns the DAKOTA results file string corresponding to dataPoint, if dataPoint completed successfully. More...
 
std::vector< int > getContinuousDesignVariableIndices (const DakotaAlgorithm &dakotaAlgorithm) const
 Returns the indices into variables() that correspond to variables that DAKOTA will treat as continuous design variables. More...
 
std::vector< int > getDiscreteDesignVariableIndices (const DakotaAlgorithm &dakotaAlgorithm) const
 Returns the indices into variables() that correspond to variables that DAKOTA will treat as discrete design variables. More...
 
std::map
< UncertaintyDescriptionType,
std::vector< int > > 
getUncertainVariableIndices (const DakotaAlgorithm &dakotaAlgorithm) const
 Returns the indices into variables() that correspond to variables that DAKOTA will treat as uncertain variables, broken down by UncertaintyDescriptionType. More...
 
- Public Member Functions inherited from openstudio::analysis::AnalysisObject
virtual ~AnalysisObject ()
 
AnalysisObject clone () const
 Deep copy. More...
 
std::string name () const
 
std::string displayName () const
 
std::string description () const
 
openstudio::UUID uuid () const
 
openstudio::UUID versionUUID () const
 
bool isDirty () const
 Returns true if this object has been changed since its dirty flag was last cleared. More...
 
bool operator== (const AnalysisObject &other) const
 Compare impls. More...
 
bool operator!= (const AnalysisObject &other) const
 
bool uuidEqual (const AnalysisObject &other) const
 
bool uuidAndVersionEqual (const AnalysisObject &other) const
 
boost::optional< AnalysisObjectparent () const
 
void setName (const std::string &newName)
 
void setDisplayName (const std::string &newDisplayName)
 
void setDescription (const std::string &newDescription)
 
bool clearDirtyFlag ()
 Call this method to reset the dirty flag of this object and all its children. More...
 
bool connect (const char *signal, const QObject *receiver, const char *slot, Qt::ConnectionType type=Qt::AutoConnection) const
 Connect signal from this AnalysisObject to slot on receiver. More...
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *slot=nullptr) const
 
template<typename T >
cast () const
 Cast to type T. More...
 
template<typename T >
boost::optional< T > optionalCast () const
 Cast to boost::optional<T>. More...
 

Related Functions

(Note that these are not member functions.)

typedef std::vector
< OptimizationProblem
OptimizationProblemVector
 
typedef boost::optional
< OptimizationProblem
OptionalOptimizationProblem
 

Detailed Description

OptimizationProblem is a Problem that has objective functions in addition to variables, response functions, and a simulation workflow.

The goal of solving an OptimizationProblem is to find the combination of variable values that minimizes one or more objective functions. If numObjectiveFunctions > 1, then any non-dominated point may be deemed desirable by a decision maker. (A non-dominated point is a point for which no objective function can be improved (decreased) without harming (increasing) another objective. OptimizationProblem ensures that OptimizationDataPoints are populated with their objective function values following successful simulation.

Constructor & Destructor Documentation

openstudio::analysis::OptimizationProblem::OptimizationProblem ( const std::string &  name,
const std::vector< Function > &  objectives,
const std::vector< WorkflowStep > &  workflow 
)
openstudio::analysis::OptimizationProblem::OptimizationProblem ( const std::string &  name,
const std::vector< Function > &  objectives,
const std::vector< WorkflowStep > &  workflow,
const std::vector< Function > &  responses 
)
openstudio::analysis::OptimizationProblem::OptimizationProblem ( const std::string &  name,
const std::vector< Function > &  objectives,
const std::vector< Variable > &  variables,
const std::vector< Function > &  responses,
const runmanager::Workflow &  simulationWorkflow 
)

Construct from objectives, variables, responses and simulationWorkflow.

In this context, response functions are design metrics of interest that are not being optimized over.

Deprecated:
openstudio::analysis::OptimizationProblem::OptimizationProblem ( const std::string &  name,
const std::vector< Function > &  objectives,
const std::vector< Variable > &  variables,
const runmanager::Workflow &  simulationWorkflow 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

openstudio::analysis::OptimizationProblem::OptimizationProblem ( const UUID &  uuid,
const UUID &  versionUUID,
const std::string &  name,
const std::string &  displayName,
const std::string &  description,
const std::vector< Function > &  objectives,
const std::vector< WorkflowStep > &  workflow,
const std::vector< Function > &  responses 
)

Constructor provided for deserialization; not for general use.

virtual openstudio::analysis::OptimizationProblem::~OptimizationProblem ( )
inlinevirtual

Member Function Documentation

void openstudio::analysis::OptimizationProblem::clearObjectiveFunctions ( )

Clear all objective functions.

bool openstudio::analysis::OptimizationProblem::eraseObjective ( const Function objective)
bool openstudio::analysis::OptimizationProblem::insertObjective ( int  index,
const Function objective 
)
int openstudio::analysis::OptimizationProblem::numObjectives ( ) const
std::vector<Function> openstudio::analysis::OptimizationProblem::objectives ( ) const
void openstudio::analysis::OptimizationProblem::pushObjective ( const Function objective)
void openstudio::analysis::OptimizationProblem::setObjectiveFunctions ( const std::vector< Function > &  objectives)

Sets objectives.

bool openstudio::analysis::OptimizationProblem::swapObjectives ( const Function objective1,
const Function objective2 
)

Friends And Related Function Documentation

typedef std::vector<OptimizationProblem> OptimizationProblemVector
related
typedef boost::optional<OptimizationProblem> OptionalOptimizationProblem
related