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

📄 cityinfo.java

📁 新型模拟退火算法解决TSP优化问题。自能退火。可用于大多数情况下的优化问题。
💻 JAVA
字号:
package test;import java.io.*;import java.util.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class CityInfo {//    int cityCount = 24978;    int cityCount = 100;//    int cityCount = 724;    double[] xcoords;    double[] ycoords;        public CityInfo() {    }    public void readCoords() {        xcoords = new double[cityCount];        ycoords = new double[cityCount];        try {            BufferedReader br = new BufferedReader(new InputStreamReader(new                FileInputStream(cityCount+".txt")));            for (int i = 0; i < cityCount; i++) {                String line = br.readLine();                if (line == null) {                    break;                }                StringTokenizer st = new StringTokenizer(line, " ");                String index =  st.nextToken();                xcoords[i] = Double.parseDouble(st.nextToken());                ycoords[i] = Double.parseDouble(st.nextToken());//		System.out.println("read coord " + index + " " + xcoords[i] + " " + ycoords[i]);            }            br.close();        }        catch (Exception ex) {            ex.printStackTrace();        }    }        }

⌨️ 快捷键说明

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