コード例 #1
0
 public void Solve()
 {
     ITrajectorySearch min = sol;
     sol = sol.GenerateInitialSolution();
     while (!sol.StopSearch() && !stopProcess)
     {
         lock (locker)
         {
             sol = sol.AdjustSolution();
             if (sol.ObjectifFunction() < min.ObjectifFunction())
             {
                 min = sol;
             }
         }
     }
     if (tm != null)
     {
         StopTimer();
     }
 }        
コード例 #2
0
 public void Solve()
 {
     sol = sol.GenerateInitialSolution();
     while (!sol.StopSearch() && !stopProcess)
     {
         // find a better neighbourgh solution
         ITrajectorySearch sTemp = sol.AdjustSolution();                
         if(!tabuList.Contains(sTemp.ObjectifFunction()))
         {
            // lock (locker) {
                 tabuList.Add(sTemp.ObjectifFunction());
                 if (sTemp.ObjectifFunction() > sol.ObjectifFunction())
                 {                            
                     sol = sTemp;
                 }
           //  }
         }                
     }
     if(tm!=null) 
         StopTimer();                      
 }
コード例 #3
0
 public void Solve()
 {
     ITrajectorySearch solTemp;           
     sol = sol.GenerateInitialSolution();            
     temperature = 1;
     while (!sol.StopSearch() && !stopProcess)
     {
         lock (locker)
         {
             solTemp = sol.AdjustSolution();
             if (solTemp.ObjectifFunction() > sol.ObjectifFunction() || boltzman(solTemp, sol))
             {
                 sol = solTemp;
             }
             updateTemperature();
         }
     }
     if (tm != null)
     {
         StopTimer();
     }     
 }