使用java将数据写入3列的.dat文件中

时间:2016-06-20 18:06:17

标签: java

我想将我的java代码中循环中生成的数据写入.dat文件和三列中,以便我可以使用此.dat文件在matlab或gnuplot中绘制绘图。请问你能帮帮我吗。

public static initialpop evolalgorithm(initialpop Population, File results) throws IOException {
        initialpop newPopulation = new initialpop(mu+landa,false);
        double AverageFit = Population.chooseBests(mu);
        double LeastParentsFitness= Population.getroute(mu-1).fitness();
        int Alived=mu;

        for(int i=0;i<Alived;i++)
        {
            newPopulation.saveroute(i, Population.getroute(i));
        }      

        for (int i = Alived; i < newPopulation.populationSize(); i++) {

            route child = inheritance(Population);

            newPopulation.saveroute(i, child);
        }


        for (int i = Alived; i < newPopulation.populationSize(); i++) {

            mutate(newPopulation.getroute(i));
        }

        double bestIndividualFitness=newPopulation.getFittest().fitness();

        return newPopulation;}

我希望在我的数据文件中有一列AverageFit值,一列LeastParentsFitness值以及另一列bestIndividualFitness列。每次调用此函数evolalgorithm时,都应将这些值添加到文件中。

0 个答案:

没有答案