Example #1
0
int chooseVar6(const Problem<type,type2>& P,type epsilon){
  type2 max=std::numeric_limits<type2>::min();
  int j=-1;
  int i=0;
  while (i<P.nbTask){
    if (P.A[i].Fi(P.bmax(i))*(P.d(i)-P.r(i))-P.W(i)>=max && P.smax(i) - P.r(i)>epsilon) {
      j=i;
      max=P.A[i].Fi(P.bmax(i))*(P.d(i)-P.r(i))-P.W(i);
    }
    if (P.A[i].Fi(P.bmax(i))*(P.d(i)-P.r(i))-P.W(i)>max && P.d(i)-P.emin(i)>epsilon){ 
      j=i+P.nbTask;
      max=P.A[i].Fi(P.bmax(i))*(P.d(i)-P.r(i))-P.W(i);
    }
    ++i;
  }
  return j;
}
Example #2
0
int createConstraintMinDur(const Problem<double>& P, IloModel& model, IloNumVarArray& t, IloNumVarMatrix& x, IloNumVarMatrix& y){
  const int E=2*P.nbTask;
  for (int i=0;i<P.nbTask;i++){
    for (int e=1;e<E-1;e++) {
      for (int f=e;f<E;f++)
	model.add(t[f] >= t[e] + x[i][e] * (P.A[i].emin-P.A[i].ri) - (1-y[i][f])*(P.W(i)/P.A[i].Fi(P.bmax(i))));
    }
  }
  return 0;    
}
Example #3
0
int createConstraintEnergy(const Problem<double>& P, IloEnv& env, IloModel& model, IloNumVarArray& t, IloNumVarMatrix& b, IloNumVarMatrix& w){
  for (int i=0;i<P.nbTask;++i){
    IloExpr expr(env);
    for (int e=0;e<2*P.nbTask-1;++e){
      for (int q=0;q<P.A[i].Fi.nbPiece;++q)
	model.add(P.A[i].Fi.F[q].f.a*b[i][e]+
		  P.A[i].Fi.F[q].f.c*(t[e+1]-t[e])>=w[i][e]);
      expr+=w[i][e];
    }
    model.add(expr == P.W(i));
    expr.end();
  }
  return 0;
}
Example #4
0
int createConstraintNulEnergy(const Problem<double>& P, IloEnv& env,IloModel& model, IloNumVarMatrix& x, IloNumVarMatrix& y, IloNumVarMatrix& w){
  for (int i=0;i<P.nbTask;i++){
    for (int e=0;e<2*P.nbTask-1;e++){	
      IloExpr expr(env);
      for (int f=0; f<= e;f++){
	expr+= x[i][f];
	expr-= y[i][f];
      }
      expr*=P.W(i);
      model.add(expr >= w[i][e]);
      expr.end();
    }
  }

  /*  for (int i=0;i<P.nbTask;++i){
    for (int e=0;e<2*P.nbTask-1;++e){
      model.add(w[i][e] <= z[i][e] * P.W(i));
    }
    }*/
  return 0;
}