⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 一个java的tabu search算法框架
💻 JAVA
字号:
import org.coinor.opents.*;public class Main {    public static void main (String args[])     {        // Initialize our objects        java.util.Random r = new java.util.Random( 12345 );        double[][] customers = new double[20][2];        for( int i = 0; i < 20; i++ )            for( int j = 0; j < 2; j++ )                customers[i][j] = r.nextDouble()*200;                ObjectiveFunction objFunc = new MyObjectiveFunction( customers );        Solution initialSolution  = new MySolution( customers );        MoveManager   moveManager = new MyMoveManager();        TabuList         tabuList = new SimpleTabuList( 7 ); // In OpenTS package                // Create Tabu Search object        TabuSearch tabuSearch = new SingleThreadedTabuSearch(                initialSolution,                moveManager,                objFunc,                tabuList,                new BestEverAspirationCriteria(), // In OpenTS package                false ); // maximizing = yes/no; false means minimizing                // Start solving        tabuSearch.setIterationsToGo( 100 );        tabuSearch.startSolving();                // Show solution        MySolution best = (MySolution)tabuSearch.getBestSolution();        System.out.println( "Best Solution:\n" + best );        int[] tour = best.tour;        for( int i = 0; i < tour.length; i++ )            System.out.println(              customers[tour[i]][0] + "\t" + customers[tour[i]][1] );    }   // end main}   // end class Main

⌨️ 快捷键说明

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