• 大小: 25KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-06-14
  • 语言: Java
  • 标签: FJSP  PSO  

资源简介

之前与老师做项目的时候写的粒子群算法解决柔性作业车间调度问题,是用Java写的,标准测试数据及优解在data文件夹下 之前与老师做项目的时候写的粒子群算法解决柔性作业车间调度问题,是用Java写的,标准测试数据及优解在data文件夹下

资源截图

代码片段和文件信息

import util.Mtime;
import util.Pro;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FileRead {
    public ArrayListPronum;
    int [][] Time;
    ArrayList>ProTime;
    int MachineNum;
    int WorkpieceNum;
    int ProcessNum;

    FileRead(){
        Pronum=new ArrayList();
        ProTime=new ArrayList>();
    }



    public void Read(String path)
    {


        int p_numm_num;
        String[] data;
        try{
            Pattern pat = Pattern.compile(“[0-9]{1}“);
            ArrayListarrayList=new ArrayList();
            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(path) “UTF-8“));
            String line;
            line=br.readLine();

            arrayList.clear();
            Matcher matcher = pat.matcher(line);
            while (matcher.find()) {
                String temp = line.substring(matcher.start()matcher.end());
                arrayList.add(Integer.valueOf(temp));
            }

            p_num=arrayList.get(0);
            m_num=arrayList.get(1);
            MachineNum=m_num;
            WorkpieceNum=p_num;
            ProcessNum=0;

            for(int i=0;i            {
                int ptr=0;
                line=br.readLine();

                arrayList.clear();
                matcher = pat.matcher(line);
                while (matcher.find()) {
                    String temp = line.substring(matcher.start()matcher.end());
                    arrayList.add(Integer.valueOf(temp));
                }

                Pro pro=new Pro();
                pro.start = ProcessNum;
                int p=arrayList.get(ptr++);
                ProcessNum += p;
                pro.num = p;
                Pronum.add(pro);
                for (int j = 0; j < p; j++)
                {
                    int m=arrayList.get(ptr++);
                    ArrayListprotime=new ArrayList();
                    for (int k = 0; k < m; k++)
                    {
                        Mtime a=new Mtime();
                        a.m=arrayList.get(ptr++);
                        a.time=arrayList.get(ptr++);
                        protime.add(a);
                    }
                    ProTime.add(protime);
                }
            }

            Time=new int[ProcessNum][MachineNum];
            for(int i=0;i                for(int j=0;j                    Time[i][j]=Integer.MAX_VALUE/1000;

            for (int i = 0; i < ProcessNum; i++)
            {
                for (int j = 0; j < ProTime.get(i).size(); j++)
                {
                    Time[i][ProTime.get(i).get(j).m-1]=ProTime.get(i).get(j).time;
      

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件           0  2020-05-19 15:29  说明.txt
     目录           0  2020-04-11 14:44  PSO_for_FJSP\
     目录           0  2020-04-11 14:44  PSO_for_FJSP\.idea\
     文件         276  2020-04-11 14:29  PSO_for_FJSP\.idea\misc.xml
     文件         271  2020-04-11 14:29  PSO_for_FJSP\.idea\modules.xml
     文件        4186  2020-04-11 14:44  PSO_for_FJSP\.idea\workspace.xml
     目录           0  2020-04-11 14:48  PSO_for_FJSP\data\
     文件         632  2019-06-01 10:27  PSO_for_FJSP\data\mk01.txt
     文件        1132  2019-06-01 17:00  PSO_for_FJSP\data\mk02.txt
     文件        2598  2019-06-01 17:02  PSO_for_FJSP\data\mk03.txt
     文件         951  2019-06-01 21:25  PSO_for_FJSP\data\mk04.txt
     文件        1026  2019-06-01 21:25  PSO_for_FJSP\data\mk05.txt
     文件        2363  2019-06-01 21:21  PSO_for_FJSP\data\mk06.txt
     文件        1563  2019-06-01 21:26  PSO_for_FJSP\data\mk07.txt
     文件        2122  2019-06-01 21:26  PSO_for_FJSP\data\mk08.txt
     文件        3466  2019-06-01 21:27  PSO_for_FJSP\data\mk09.txt
     文件        3992  2019-06-01 21:27  PSO_for_FJSP\data\mk10.txt
     文件         203  2019-08-03 11:03  PSO_for_FJSP\data\优解.txt
     目录           0  2020-04-11 14:30  PSO_for_FJSP\out\
     目录           0  2020-04-11 14:30  PSO_for_FJSP\out\production\
     目录           0  2020-04-11 14:44  PSO_for_FJSP\out\production\PSO_for_FJSP\
     文件        4450  2020-04-11 14:44  PSO_for_FJSP\out\production\PSO_for_FJSP\FileRead.class
     文件        2579  2020-04-11 14:44  PSO_for_FJSP\out\production\PSO_for_FJSP\Main.class
     文件       10544  2020-04-11 14:44  PSO_for_FJSP\out\production\PSO_for_FJSP\Panicle.class
     目录           0  2020-04-11 14:30  PSO_for_FJSP\out\production\PSO_for_FJSP\util\
     文件         281  2020-04-11 14:30  PSO_for_FJSP\out\production\PSO_for_FJSP\util\Mtime.class
     文件         278  2020-04-11 14:30  PSO_for_FJSP\out\production\PSO_for_FJSP\util\Pro.class
     文件         433  2020-04-11 14:29  PSO_for_FJSP\PSO_for_FJSP.iml
     目录           0  2020-04-11 14:45  PSO_for_FJSP\src\
     文件        3532  2020-04-11 14:35  PSO_for_FJSP\src\FileRead.java
     文件        2422  2020-04-11 14:45  PSO_for_FJSP\src\Main.java
............此处省略4个文件信息

评论

共有 条评论