lobatopedro / OPLA-Tool

Current version

Home Page:https://otimizes.github.io/OPLA-Tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OPLA-Tool

OPLA-Tool

Description

This project was created to automate the Multi-Objective Optimization Approach for PLA Design (MOA4PLA).

Requirements

Before to compile the code, you need to install the following softwares on your PC:

How to Build

This section show the step-by-step that you should follow to build the OPLA-Tool.

  • Create a directory to build OPLA-Tool:
mkdir opla-tool
  • Access the folder:
cd opla-tool
  • Download all projects:
git clone https://github.com/otimizes/OPLA-Tool.git
  • Compile
mvn clean install Obs: If it is the first run, execute **mvn clean** first to install local dependencies
  • Open OPLA-Tool:
java -jar modules/opla-api/target/opla-api-1.0.0-SNAPSHOT.jar

How to use the tool

<Click here to see how using the tool>

How to open the PLAs

How to import into eclipse IDE

mvn eclipse:clean

Import into eclipse IDE using Maven Project Type

File > Import > Maven > Exists Maven Project > Select the directory created for build OPLA-Tool

How to contribute to this project

Make Fork this project and create a Pull Request with your changes

<Click here to see how to contribute>.

Documentation

<Click here to access the backend documentation>

<Click here to access the frontend documentation>

Implementing a new Objective Function

@Entity
@Table(name = "myobj_obj")
public class MYOBJObjectiveFunction extends ObjectiveFunctionDomain {

    private static final long serialVersionUID = 1L;

    @Column(name = "value1")
    private Double value1;

    @Column(name = "value2")
    private Double value2;

    public MyObjectiveFunction(String idSolution, Execution execution, Experiment experiement) {
        super(idSolution, execution, experiement);
    }
    // GETTERS AND SETTERS
}
public class MYOBJ extends ObjectiveFunctionImplementation {

    public MYOBJ(Architecture architecture) {
        super(architecture);
        //Code as Example...
        double aclassFitness = 0.0;
        ClassDependencyIn CDepIN = new ClassDependencyIn(architecture);
        ClassDependencyOut CDepOUT = new ClassDependencyOut(architecture);
        aclassFitness = CDepIN.getResults() + CDepOUT.getResults();
        //Always set the results and access using the getResults();
        this.setResults(aclassFitness);
    }
}
  • Add your metrics into Metrics Enum and the Objective Function into the ObjectiveFunctions Enum.
public enum ObjectiveFunctions implements ObjectiveFunctionsLink {
// ...
    MYOBJ {
        @Override
        public Double evaluate(Architecture architecture) {
            return new MYOBJ(architecture).getResults();
        }

        @Override
        public ACLASSObjectiveFunction build(String idSolution, Execution Execution, Experiment experiement,
                                             Architecture arch) {
            MYOBJObjectiveFunction myobj = new MYOBJObjectiveFunction(idSolution, Execution, experiement);
            myobj.setSumClassesDepIn(Metrics.SumClassDepIn.evaluate(arch));
            myobj.setSumClassesDepOut(Metrics.SumClassDepOut.evaluate(arch));
            return aclass;
        }
    }
}
  • Implement the tests in the core inside the MetricsTest
  • ** ATTENTION ** Use the exactly name of the object function (in enum ObjectiveFunctions) as prefix of your resource, service and repository. Also use the pattern of posfix. It is used reflection to facilitate the development of new objective functions. -- Example:
  • MYOBJ.java -> Implementation of the objective function
  • MYOBJObjectiveFunction.java -> Domain of the objective function
  • MUOBJObjectiveFuntionRepository -> Repository of the objective function
  • MYOBJObjectiveFunctionService -> Service of the objective function
  • MYOBJObjectiveFunctionResource -> Resource of the objective function
  • It will appears in the front-end, at the Objective functions section

Implementing a new Optimization Algorithm

  • <Click here to see the implemented Optimization algorithms>
  • Put your metaheuristic in jmetal4 > metaheuristics > youralgorithmpackage
  • Observe how was implemented the existent algorithms, following the current steps
  • Create your config in jmetal4 > experiments > base inheriting the ExperimentCommonConfigs
  • Use the name of optimization algorithm config with the posfix Configs, ex: MyOptAlgConfigs
  • Create your base to the Optimization Algorithm in jmetal4 > experiments > base
  • Use the name of optimization algorithm base with the posfix OPLABase, ex: MyOptAlgOPLABase
  • In order to link the algorithm in the api, it is necessary to create the gateway into the opla-api > gateway
  • Use the name of the gateway with the posfix Gateway, ex: MyOptAlgGateway
  • Add the gateway class in enum OptimizationAlgorithms, implementing the method getType
  • It will appears in the front-end, at the Settings section

Implementing a new Mutation Operator

Implementing a new Crossover Operator

Implementing new methods in JMetal

Implementing tests and main classes

  • Every created method need to be in the tests at the respective module
  • You do not need to remove the main classes, but you must to maintain them in the package named main in tests

About

Current version

https://otimizes.github.io/OPLA-Tool

License:GNU Affero General Public License v3.0


Languages

Language:Java 94.9%Language:TypeScript 2.9%Language:HTML 1.2%Language:D 0.7%Language:CSS 0.1%Language:JavaScript 0.1%Language:SCSS 0.0%