Creating own optimization

Follow creating a process steps

Optimization is just a specific process, now let's see what we have to add to a standard process to handle optimization.

Add optimization directives to your process

    def get_builders(self):
        '''
        default initialisation test
        '''
        # Select the nested subprocess
        repo = 'sostrades_core.sos_processes.test.sellar'
        sub_proc = 'test_sellar_list'
        list_builder = self.ee.factory.get_builder_from_process(
            repo=repo, mod_id=sub_proc)

        # coupling builder
        coupling_name = 'SellarCoupling'
        coupling_builder = self.ee.factory.create_builder_coupling(
            f'{coupling_name}')
        coupling_builder.set_builder_info('cls_builder', list_builder)

        # shift nested subprocess namespaces
        self.ee.ns_manager.add_ns(
            'ns_OptimSellar', f'{self.ee.study_name}.{coupling_name}')

        return coupling_builder

Update ontology

  • move to .../sostrades-dev-tools folder
    cd ...\sostrades-dev-tools

  • run the UpdateOntology.py script to initialize the ontology of parameters, models and processes :
    python scripts/UpdateOntology.py

Check your process appear in the platform

  • start the platform, select the upper-left three horizontal bars and in the menu select Ontology/Processes

  • Use the Filter to check if your process appears

  • select the book icon at the end of your model line in list, to check informations were well retrieved (models used, documentation...)