Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.5 kB
3
Indexable
Never
#ifndef EXAMPLEFUNCTION_H
#define EXAMPLEFUNCTION_H

#include "Wrapper.hpp"
#include "NumericalOptimizerInterface.h"
#include "GlobalPlacer.h"

// class Bin {
// public:    
//     double x_center;
//     double y_center;
// };

class ExampleFunction : public NumericalOptimizerInterface
{
public:
    ExampleFunction(wrapper::Placement& placement, GlobalPlacer& globalplacer);
    wrapper::Placement& _placement;
    GlobalPlacer& _globalplacer;

    void evaluateFG(const vector<double>& x, double& f, vector<double>& g);
    void evaluateF(const vector<double>& x, double& f);
    unsigned dimension();
    void increase_lambda();

private:
    double calculateLSE_F(const vector<double>& x);
    double calculateBinDensity_F(const vector<double>& x);

    double calculateLSE_FG(const vector<double>& x, vector<double>& g);
    double calculateBinDensity_FG(const vector<double>& x, vector<double>& g);

    unsigned num_modules = 0;
    int lambda = 0;
    unsigned bin_cut = 15;
    unsigned bin_total_num = 0;
    double eta = 0.0, bound_width = 0.0, bound_height = 0.0;
    double core_area = 0.0;
    double bin_width = 0.0, bin_height = 0.0, bin_area = 0.0, avg_density = 0.0;
    vector<double> grad, x_exp;
    vector<double> bin_density;

    // Bin bins[bin_cut][bin_cut];
    // void BinInitialization(const double w, const double h);



    vector<bool> module_isPlaced;
};

#endif // EXAMPLEFUNCTION_H
Leave a Comment