?? myswapmove.java
字號:
import org.coinor.opents.*;public class MySwapMove implements Move { public int customer; public int movement; public MySwapMove( int customer, int movement ) { this.customer = customer; this.movement = movement; } // end constructor public void operateOn( Solution soln ) { int[] tour = ((MySolution)soln).tour; int pos1 = -1; int pos2 = -1; // Find positions for( int i = 0; i < tour.length && pos1 < 0; i++ ) if( tour[i] == customer ) pos1 = i; pos2 = pos1 + movement; // Swap int cust2 = tour[pos2]; tour[pos1] = cust2; tour[pos2] = customer; } // end operateOn /** Identify a move for SimpleTabuList */ public int hashCode() { return customer; } // end hashCode } // end class MySwapMove
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -