<commit_before>package gr.ntua.cslab.asap.optimization;

import gr.ntua.ece.cslab.panic.core.containers.beans.InputSpacePoint;
import gr.ntua.ece.cslab.panic.core.models.Model;
import org.apache.log4j.Logger;
import org.moeaframework.core.Solution;
import org.moeaframework.core.variable.EncodingUtils;
import org.moeaframework.core.variable.RealVariable;
import org.moeaframework.problem.AbstractProblem;

import java.util.ArrayList;
import java.util.List;

public class MultiObjectiveOptimizer extends AbstractProblem {
    protected static Model model;
    protected static InputSpacePoint isp;
    protected static List<RealVariable> variables;
    protected static List<String> missingVars = new ArrayList<>();
    private static Logger logger = Logger.getLogger(MultiObjectiveOptimizer.class);

    public MultiObjectiveOptimizer() {
        super(variables.size(), 1);
    }

    @Override
    public void evaluate(Solution solution) {
        try {

            double[] x = EncodingUtils.getReal(solution);
            double f; //Objective 1 (exec time)
            for (int i=0; i<solution.getNumberOfVariables(); ++i){
                isp.addDimension(missingVars.get(i), x[i]);
            }
            f = model.getPoint(isp).getValue();
            System.out.printf("%s => %f\n", isp, f);
            solution.setObjective(0, f);
        }
        catch (Exception e){
            logger.info("MultiObjectiveOptimizer Exception: "+e.getLocalizedMessage());
        }<commit_msg>updates<commit_after>package gr.ntua.cslab.asap.optimization;

import gr.ntua.ece.cslab.panic.core.containers.beans.InputSpacePoint;
import gr.ntua.ece.cslab.panic.core.models.Model;
import org.apache.log4j.Logger;
import org.moeaframework.core.Solution;
import org.moeaframework.core.variable.EncodingUtils;
import org.moeaframework.core.variable.RealVariable;
import org.moeaframework.problem.AbstractProblem;

import java.util.ArrayList;
import java.util.List;

public class MultiObjectiveOptimizer extends AbstractProblem {
    protected static Model model;
    protected static InputSpacePoint isp;
    protected static List<RealVariable> variables;
    protected static List<String> missingVars = new ArrayList<>();
    private static Logger logger = Logger.getLogger(MultiObjectiveOptimizer.class);

    public MultiObjectiveOptimizer() {
        super(variables.size(), 1);
    }

    @Override
    public void evaluate(Solution solution) {
        try {

            double[] x = EncodingUtils.getReal(solution);
            double f; //Objective 1 (exec time)
            for (int i=0; i<solution.getNumberOfVariables(); ++i){
                isp.addDimension(missingVars.get(i), x[i]);
            }
            f = model.getPoint(isp).getValue();
            solution.setObjective(0, f);
        }
        catch (Exception e){
            logger.info("MultiObjectiveOptimizer Exception: "+e.getLocalizedMessage());
        }
{'fraction_non_alphanumeric': 0.10917775503241214, 'fraction_numerical': 0.0034118048447628795, 'mean_word_length': 3.2928257686676425, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6039333', 'n_tokens_mistral': 872, 'n_tokens_neox': 844, 'n_words': 172}