Models
The model file refers to the program file that you are running in BQPhy. It is essentially the optimization problem written as a computer program to be run in BQPhy.
The model file must be created with a chromosome taken in as input and the fitness value of the chromosome as output.
General flow of Model file
The generic flow of the model file is as follows.
-
Finding the decision variables from chromosome : The decision variables are the parameters that you are varying to get the optimal results. Since BQPhy accepts variables as a list of binary variables or as a list of continuous variables, the decision variable would have to be encoded into the chromosome, in such a way that the possible combinations of the chromosomes span the entire design space / feasible region. In the model file, the values of the decision variables are derived from the input chromosome and used in the further part of the optimization problem in the model file.
-
Finding the objective / fitness value of the chromosome : The objective refers to the mathematical quantity the model file is trying to extremize by changing the design variables.
-
Adding the constraints : In most problems, the feasible regions is not just restricted by the bounds in the decision variables, but also by the bounds in certain derived quantities. These bounds are referred to as constraints. They can be inequalities as well as equalities.
-
Adding the Penalty type : Once the objective and constraints are set, the penalty method to be used for solving the problem is to be chosen. Currently, BQPhy can handle the following penalty methods
No_Penalty: This method means that the problem is an unconstrained problem (excluding the bounds on input)Death_Penalty: This method eliminates all infeasible solutions (i.e. whose constraints are violated) for optimization.Static_Penalty: For this method, the degree of violation of the constraints are calculated and a weighted sum of the violation is added to the actual fitness value of the problem. The problem is solved with the new form of fitness value.Debs_Penalty: This problem uses the Deb's approach to solve the optimization problem
Creating a Model file
BQPhy can work with model files written in Python, C++ and MATLAB. But it must adhere to a template (which is provided in the webpage).
For model file example, you can refer the Examples section in the documentation.
Modifying the Model file in BQPHy
Adding the Model file
To add the model file,
- Go to the
Modelstab in BQPhy webpage and click onAdd Model - In the pop up box, fill the fields
- Name: The unique name provided for the model file
- Function Nmae: The name of the function in the model file that takes the chromosome input and returns the fitness value
For the template files, the function name is Evaluator for C++ and Model for Python template.
- Language: The programming language in which the model file is used.
BQPhy currently supports Python, C++ and MATLAB
- Description: Brief description on the model file
- Model file: You add the program file of the model here
- Edit Template: Insted of uploading a model file, you can create one in the online editor of BQPhy
- Press
Register Model - The model file is sent for approval. Once the concerned authorities approve, you can run the model file to solve the optimization problem
To know how to run the model file, refer the Executions section of the documentation
Modifying the Model file
The BQPhy platform allows you to modify the (approved) model files in the webpage itself, without the need of reupload.
To modify
- Click on
⋮and selectChange file - There are three methods
- File upload: The modified file can be uploaded to replace the original file
- Edit Current file: This opens the current model file in an editor, where you could make the necessary changes.
- New template: the old file can be discarded and you can create the model file from the new template opened in the editor.
- Click on
Change file
Removing the Model file
Removing the model file is as follows
- Click on
⋮of the file you want to remove - Click
Deleteand confirm in the dialog box