Skip to content

Create new basis

Marco Rossignolo edited this page May 22, 2021 · 9 revisions

How to create and test a new basis

You can follow these steps to create a new basis for quocs.

Check how your package is installed

Before starting, check your quocslib package is installed in the editable mode by using:

python -m pip list -e

This command returns the list of the packages you installed in the editable mode in your current environment, something like this:

Package                Version Location
---------------------- ------- -----------------------------------------------
quocs-lib              0.0a1   /home/mrossign/QuOCS/QuOCS/src
quocs-pyside2interface 0.0a1   /home/mrossign/QuOCS/QuOCS-pyside2interface/src
quocs-thesuite         0.0a1   /home/mrossign/QuOCS/QuOCS-thesuite
quocs-tools            0.0a1   /home/mrossign/QuOCS/QuOCS-tools

If quocs-lib does not appear as an editable package please install it in the editable mode

Create the module

  • Copy the Dummy_basis.py module in src/quocslib/basis folder and rename it with your basis name.
  • Open this file and follow the instructions. The main points are
    • Choose a suitable name for the basis class, to prevent confusion with the current implemented one. Usually the same name of the module is fine.
    • Rename the basis name variable
    • Set the number of super parameters, i.e. the parameters which are chosen randomly at the beginning of every super iteration.
    • Set the number of parameters you want to optimize
    • Build the shape of your basis function in get_shape()

Test the new basis

  • Go to the test folder and create/copy a new test algorithm function with the algorithm, and the basis you want to use in the file name
  • To use your basis insert the current module and base class name, and put all the compulsory variables in the basis dictionary

Clone this wiki locally