fairsacontrol.cpp

来自「随机需求VRP(VRPSD)」· C++ 代码 · 共 80 行

CPP
80
字号
#include "fairSAControl.h"bool fairSAControl::setSAOrOptParameters(){  //---------- SIMULATED ANNEALING IN LOCAL SEARCH -----------------      int sa = 11;  div_t r;  int rateTempLengthInd, iniTempFactorInd, idle_length_reheatingInd;  if (sa >11 || sa <0)    exit(1);  alfa = 0.98;  if (sa == 11)    {      initTempFactor = 0;      rateTempLength = INT_MAX;      idle_length_reheating = INT_MAX;    }  else     {      int val=sa;        r = div(val,2);          rateTempLengthInd = r.rem + 1;      switch (rateTempLengthInd) {      case 1:	rateTempLength = 1;	break;      case 2:	rateTempLength = 10;	break;      default:	(*os)<<"Error in neigh. configuration!"<<endl;	exit(1);      }          r = div(r.quot,2);          iniTempFactorInd = r.rem + 1;      switch (iniTempFactorInd) {      case 1:	initTempFactor = 0.01;	break;      case 2:	initTempFactor = 0.05;	break;      default:	(*os)<<"Error in TempScvInd configuration!"<<endl;	exit(1);      }          idle_length_reheatingInd = r.quot + 1;      switch (idle_length_reheatingInd) {      case 1:	idle_length_reheating = 5;	break;      case 2:	idle_length_reheating = 20;	break;      case 3:	idle_length_reheating = 40;	break;      default:	(*os)<<"Error in rejectedLimScv configuration!"<<endl;	exit(1);      }    }//    (*os)<<"rateNeighbourhood "<<rateTempLength<<"\n";//    (*os)<<"iniTempFactorScv "<<initTempFactor<<"\n";//    (*os)<<"alfa "<<alfa<<"\n";      //    (*os)<<"rejectedLimScv "<<idle_length_reheating<<"\n";  return true;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?