c++程序运行中出现的问题

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{ const int n=3;
const int m=3;
double fitness[3];
//从FT06.txt读入machine sequence
ifstream infile;
infile.open("FT031.txt",ios::in);
if(!infile) cout<<"error"< int t1;
//存入数组
// cout int Machine_sequence[n][m];//MS[n][m]代表 Machine sequence
int*p=&Machine_sequence[0][0];
while(infile>>t1) //遇到空白符结束
{
*p=t1;
p++;
}
infile.close();

ifstream ifile;
ifile.open("FT032.txt",ios::in);
if(!ifile) cout<<"error"<<endl;
int t2;

//存入数组
// cout<<"存入数组"< int Operation_time[n][m];//MS[n][m]代表 Machine sequence
int*q=&Operation_time[0][0];
while(ifile>>t2) //遇到空白符结束
{
*q=t2;
q++;
}
ifile.close();
cout<<"输出操作顺序矩阵"<<endl;
for(int i=0;i<3;i++)
{

for (int j=0;j<3;j++)
{ 
    cout<<Machine_sequence[i][j]<<" ";


}
cout<<endl;
}
cout<<"输出时间矩阵"<<endl;
for(int i=0;i<3;i++)
{

for (int j=0;j<3;j++)
{ 
    cout<<Operation_time[i][j]<<" ";


}
cout<<endl;

}


int sequence[3][9]={3,2,1,3,2,2,1,3,1,1,2,3,2,3,1,1,2,3,1,1,2,1,2,3,3,2,3};
 for (int i=0;i<3;i++)
{   int a[n]={0};      //用来计算工件的第几个工序  参见论文《基于遗传算法的多目标车间调度问题的研究》第三章
    double tj[m]={0};   //某个机器最近空闲时间点
    double  ti[n][m]={0};//工件i的第j道工序完成时间
    for(int j=0;j<9;j++)
    {    if(a[sequence[i][j]-1]==0)
        { ti[sequence[i][j]-1][a[sequence[i][j]-1]]=tj[Machine_sequence[sequence[i][j]-1][a[sequence[i][j]-1]]]+Operation_time[sequence[i][j]-1][a[sequence[i][j]-1]];
        tj[Machine_sequence[sequence[i][j]-1][a[sequence[i][j]-1]]]=ti[sequence[i][j]-1][a[sequence[i][j]]-1]];
    a[sequence[i][j]-1]=a[sequence[i][j]-1]+1;//记录是第几道工序
    }
    else
        {if(ti[sequence[i][j]]-1][a[sequence[i][j]-1]-1]>tj[Machine _sequence[sequence[i][j]-1][a[sequence[i][j]-1]])

        //{ti[sequence[i][j]-1][a[sequence[i][j]-1]]=max(ti[sequence[i][j]]-1][a[sequence[i][j]-1]-1],tj[Machine_sequence[sequence[i][j]-1][a[sequence[i][j]-1]])+Operation_time[sequence[i][j]-1][a[sequence[i][j]-1]];//这一行有问题
        ti[sequence[i][j]-1][a[sequence[i][j]-1]]=ti[sequence[i][j]]-1][a[sequence[i][j]-1]-1]+Operation_time[sequence[i][j]-1][a[sequence[i][j]-1]];
        else
        {ti[sequence[i][j]-1][a[sequence[i][j]-1]]=tj[Machine_sequence[sequence[i][j]-1][a[sequence[i][j]-1]]+Operation_time[sequence[i][j]-1][a[sequence[i][j]-1]];}
        tj[Machine_sequence[sequence[i][j]-1][a[sequence[i][j]-1]]]=ti[sequence[i][j]-1][a[sequence[i][j]]-1]];//有问题
        a[sequence[i][j]-1]=a[sequence[i][j]-1]+1;
    }
    }

    double x=tj[0];
     int k=1;
     while(k<m)
     {
         if(tj[k]>x)
             x=tj[k];
             k++;
     }
    fitness[i]=x;
 }
return 0;

}

4个回答

不知道有啥问题,编译不通过啊

求教各位了
,这是一个求解工作车间调度问题的程序

代码太乱了,正常代码和注释的都混到了一起,导致编译时出现很多没有定义的变量,还有大括号和中括号都匹配不起来,整理一下代码在看看

已经解决了,谢谢

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!