From a019d490cc61dad57f3202e76fec1d1842dfdc6f Mon Sep 17 00:00:00 2001 From: Stefano Borini <sborini@enthought.com> Date: Fri, 28 Jul 2017 13:59:03 +0100 Subject: [PATCH] Removed braindump directory --- braindump/datasource.py | 35 ---------------------------------- braindump/kpi_calculator.py | 16 ---------------- braindump/main.py | 38 ------------------------------------- braindump/mco.py | 26 ------------------------- braindump/workflow.py | 25 ------------------------ 5 files changed, 140 deletions(-) delete mode 100644 braindump/datasource.py delete mode 100644 braindump/kpi_calculator.py delete mode 100644 braindump/main.py delete mode 100644 braindump/mco.py delete mode 100644 braindump/workflow.py diff --git a/braindump/datasource.py b/braindump/datasource.py deleted file mode 100644 index af36fd9..0000000 --- a/braindump/datasource.py +++ /dev/null @@ -1,35 +0,0 @@ -class DataSource(): - """Base class that performs calculation or extraction of information - """ - __metaclass__ = abc.ABCMeta - - def __init__(self, name): - self.name = name - - @abstractclassmethod - def provides(cls): - return [CUBA.key] - - def execute(self, parameters): - """Performs the evaluation and returns a list of Result. - """ - - -class Simulator(DataSource): - pass - - -class Database(DataSource): - pass - - -# Represents the result of a simulator. -# It contains the resulting cuba key, the associated uncertainty and the -# originating simulator. -# Difference between uncertainty and quality: uncertainty is a numerical value -# of the value, as in the case of an experimental simulation. -# quality is the level of accuracy of the (e.g.c omputational) method, as -# the importance and reliability of that value. It should be an enumeration -# value such as HIGH, MEDIUM, POOR -Result = namedtuple("Result", "cuba_key value uncertainty originator quality") - diff --git a/braindump/kpi_calculator.py b/braindump/kpi_calculator.py deleted file mode 100644 index d9e7d0d..0000000 --- a/braindump/kpi_calculator.py +++ /dev/null @@ -1,16 +0,0 @@ -class KPICalculator(): - """Base class that defines the equaation to compute the KPIs values from - the results of the simulators - - input: a list of SimulatorResult - output: a list of KPIs. - """ - __metaclass__ = abc.ABCMeta - - def execute(self, datasource_results) - """Returns the KPIResult""" - - -KPIResult = namedtuple("KPIResult", "name cuba_key value uncertainty quality") - - diff --git a/braindump/main.py b/braindump/main.py deleted file mode 100644 index a61d6a0..0000000 --- a/braindump/main.py +++ /dev/null @@ -1,38 +0,0 @@ -from force_bdss import * - -wf=Workflow() -wf.set_mco(Dakota()) -wf.set_datasources([ - ViscositySimulator(), - CostExtractor(), -]) -wf.objectives([ - Objective(), - Objective() - ]) - - -wf.set_parameters({ - "material_1": { - CUBA.FORMULA: "H2O", - CUBA.CONCENTRATION: Range(0, 100) - }, - "material_2": { - CUBA.FORMULA: "glycol", - CUBA.CONCENTRATION: Formula("material_1", - lambda material_1: 100 - material_1[CUBA.CONCENTRATION]) - } -}) - -wf.set_result_callback(callback) - -# constraints vs computed value -# e.g. constraint = value from 0 to 100 -# computed value = 100 - other value -# TODO: Study dakota better to understand how it works and what kind of -# interface it expects - -pareto_front = wf.execute() - -plot(pareto_front) - diff --git a/braindump/mco.py b/braindump/mco.py deleted file mode 100644 index 6b47562..0000000 --- a/braindump/mco.py +++ /dev/null @@ -1,26 +0,0 @@ -class MCO(): - """Receives a list of KPIResult to decide the next step in the parameter - space""" - __metaclass__ = abc.ABCMeta - starting_point - variable_constraints - objectives - - def get_next_parameters(kpi_results): - pass - - -class Dakota(MCO): - def __init__(self, options): - pass - - -class DakotaInput(): - """Read the parameters from the dakota input file and returns - the parameters for further consumption""" - def parse(filename): - """Returns the parameters""" - - -class DakotaOutput(): - """Writes the KPIs to the file for consumption by Dakota""" diff --git a/braindump/workflow.py b/braindump/workflow.py deleted file mode 100644 index 70c268a..0000000 --- a/braindump/workflow.py +++ /dev/null @@ -1,25 +0,0 @@ -# This is a prototype for the Workflow in FORCE -import abc - - -class Workflow(): - # calculates the KPIs from the list of the cuba keys coming from the - # simulators - mco = None - data_sources = None - - - - -class ViscosityCalculator(Simulator): - pass - - -class CostExtractor(Database): - provides_kpi = [] - - -class Objective() - kpi = None - optimization_type = MAXIMIZE - -- GitLab