#include
#include
#include
#include
#include
#include //vs03fstream、iostreamh,using namespace std;
using namespace std;
ILOSTLBEGIN
typedef IloArray NumVarMatrix;
typedef IloArray NumVarMatrix3;
typedef IloArray NumVarMatrix4;
typedef IloArray NumVarMatrix5;
class Data{
public:
int T,M,A,B,V,CD,C;
int d[2][5][7];//ait
int dw[2][5][7];//bit
int asp[2][5];//ai
int tA[5][5];//ij
int vsp[2][5];//vi
int P[2];//a
int Pw[2];//b
int R[5][7][5][7];//isjt
int wa[2];//a
int wb;//b
int cap[2];//v
};
int main (int argc, char **argv)
{
IloInt i,j,a,v,b,tI,s;
IloInt an,bn,tn,vn,cn;//tIt
int I,II,III,IIII;
an=2;bn=2;tn=7;vn=2;cn=5;
IloNumExpr z=NULL,x1=NULL,y1=NULL,z1=NULL;//obj1=NULL,obj2=NULL,obj;
IloEnv env;
Data data;
ifstream infile1("single.txt");//txt。
infile1>>data.T>>data.A>>data.B>>data.V>>data.CD>>data.C;// 6
infile1.close();
ifstream infile2("invendem.txt");//
for(a=0; a>data.d[a][i][tI];}}}//ait
for(a=0; a>data.dw[b][i][tI];}}}//bit
for(b=0; b>data.asp[a][i];}}//0317
for(v=0; v>data.vsp[v][i];}}//
for(i=0; i>data.tA[i][j];}}
infile4.close();
ifstream infile5("weight.txt");//、、V
for(a=0; a>data.P[a];
for(b=0; b>data.Pw[b];
for(a=0; a>data.wa[a];
infile5>>data.wb;//kg
for(v=0; v>data.cap[v];
infile5.close();
for(i=0; itm_year + 1900,
t->tm_mon + 1,
t->tm_mday,
t->tm_hour,
t->tm_min,
t->tm_sec);
try {
IloModel model(env);
// the capacity variable of the warehouse. model.add(IloSum(assignVars[w]) == capVars[w]);
// for(i = 0; i =y1);}//4
x1=0;y1=0;
for(s=0;s=y1+z1);}}}//7
x1=0;y1=0;z1=0;
for(i=0; i for(v=0;v for(s=0;s for(j=0; j x1 += ( Z[i][j][v][s]-Z[j][i][v][s]);}}
model.add(x1<=data.vsp[v][i]);}}//8
x1=0;y1=0;z1=0;
IloCplex cplex(model);
cplex.extract(model);
cplex.setParam(IloCplex::MIPEmphasis, 1);//,
cplex.solve();
if (cplex.getStatus() == IloAlgorithm::Infeasible)
env.out() << "No Solution" << endl;
// Print results
env.out() << "MIN unsatisfied:" << cplex.getObjValue() << endl;
for(b=0;b for(s=0;s env.out()<
for(b=0;b for(i=0; i for(j=0; j for(v=0;v for(s=0;s env.out()<< ""<
}//try{
catch (IloException ex) {
cerr << "Error: " << ex << endl;
}
catch (...) {
cerr << "Error" << endl;
}
env.end();
system ("PAUSE");
return 0;
}