tspswapmove.java

来自「一个java的tabu search算法框架」· Java 代码 · 共 31 行

JAVA
31
字号
public class TSPSwapMove implements net.iharder.opents.Move {    public int pos1;    public int pos2;        private int   a; // Used repeatedly in swap operation    private int[] t; // Used repeatedly in swap operation        public TSPSwapMove(){}    public TSPSwapMove( int pos1, int pos2 )    {   this.pos1 = pos1;        this.pos2   = pos2;    }   // end constructor        /** Swap two customers in this solution. */    public void operateOn( net.iharder.opents.Solution solution )    {           t       = ((TSPSolution)solution).tour;        a       = t[pos1];        t[pos1] = t[pos2];        t[pos2] = a;    }   // end operateOn}   // end class TSPSwapMove

⌨️ 快捷键说明

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