'operator': 'lte',
    'bound': 35
}]

# Blocks
import_csv = wf.Import(type_='csv')
instantiate_pareto = wf.InstanciateModel(model_class=ParetoSettings,
                                         name='Pareto Settings')
instantiate_catalog = wf.InstanciateModel(model_class=Catalog,
                                          name='Cars Instantiation')
filter_method = wf.ModelMethod(model_class=Catalog,
                               method_name='filter_',
                               name='Filters')
filtered_catalog = wf.InstanciateModel(model_class=Catalog,
                                       name='Filtered Catalog')
display = wf.Display(order=0, name="Display")
# display = wf.MultiPlot(choice_args, 1, name='Display')
filtered = wf.Display(order=1, name="Filtered")
# filtered = wf.MultiPlot(choice_args, 1, name='Filtered')
# objectives_method = wf.ModelMethod(model_class=Catalog,
#                                    method_name='find_best_objective',
#                                    name="Find best objectives")
# objectives_attributes = wf.ModelAttribute(attribute_name='objectives',
#                                           name='Objectives')

blocks = [
    import_csv, instantiate_pareto, instantiate_catalog, filter_method,
    filtered_catalog, display, filtered
]
# , objectives_method, objectives_attributes]
Exemplo n.º 2
0
# from dessia_api_client import Client
import numpy as np
from dessia_common.typings import MethodType

block_generator = wf.InstanciateModel(objects.GearBoxGenerator,
                                      name='Gearbox Generator')
block_generate = wf.ModelMethod(MethodType(class_=objects.GearBoxGenerator,
                                           name='generate'),
                                name='Generate')
block_efficiencymap = wf.InstanciateModel(objects.EfficiencyMap,
                                          name='Efficiency Map')
block_engine = wf.InstanciateModel(objects.Engine, name='Engine')
block_gearbox = wf.InstanciateModel(objects.GearBox, name='Gearbox')
block_cluster = wf.InstanciateModel(objects.Clustering, name='Clustering')

display = wf.Display(name='Display')

block_workflow = [
    block_generator, block_generate, block_gearbox, block_engine,
    block_efficiencymap, block_cluster, display
]
pipe_workflow = [
    wf.Pipe(block_generator.outputs[0], block_generate.inputs[0]),
    wf.Pipe(block_gearbox.outputs[0], block_generator.inputs[0]),
    wf.Pipe(block_engine.outputs[0], block_gearbox.inputs[0]),
    wf.Pipe(block_efficiencymap.outputs[0], block_engine.inputs[0]),
    wf.Pipe(block_generate.outputs[0], block_cluster.inputs[0]),
    wf.Pipe(block_cluster.outputs[0], display.inputs[0])
]

workflow = wf.Workflow(block_workflow, pipe_workflow,
Exemplo n.º 3
0
filtered_catalog1 = wf.InstanciateModel(model_class=Catalog,
                                        name='Filtered Catalog 1')

filter_max = [{'attribute': 'MPG', 'operator': 'gte', 'bound': 30}]
catalog2 = wf.InstanciateModel(model_class=Catalog, name='Car 2')
filter2 = wf.ModelMethod(model_class=Catalog,
                         method_name='filter_',
                         name='Filter 2')
filtered_catalog2 = wf.InstanciateModel(model_class=Catalog,
                                        name='Filtered Catalog 2')

catalogs = wf.Sequence(number_arguments=2, name='Catalogs')
concatenate = wf.ClassMethod(class_=Catalog,
                             method_name='concatenate',
                             name='Concatenate')
display = wf.Display(order=0)

array_attribute = wf.ModelAttribute(attribute_name='array', name='Array')

blocks = [
    import_csv, instantiate_pareto, catalog1, filter1, filtered_catalog1,
    catalog2, filter2, filtered_catalog2, catalogs, concatenate, display,
    array_attribute
]

# Pipes
pipes = [
    wf.Pipe(import_csv.outputs[0], catalog1.inputs[0]),
    wf.Pipe(import_csv.outputs[1], catalog1.inputs[1]),
    wf.Pipe(instantiate_pareto.outputs[0], catalog1.inputs[2]),
    wf.Pipe(import_csv.outputs[0], catalog2.inputs[0]),