资源简介
求解大规模具有能力约束的车辆路径问题(Capacitated Vehicle Routing Problem, CVRP)求解大规模具有能力约束的车辆路径问题(Capacitated Vehicle Routing Problem, CVRP)求解大规模具有能力约束的车辆路径问题(Capacitated Vehicle Routing Problem, CVRP)求解大规模具有能力约束的车辆路径问题(Capacitated Vehicle Routing Problem, CVRP)
代码片段和文件信息
import java.io.*;
import java.awt.Point;
/**
* CVRPData.java
*
* This class reads in a CVRP data file and provides “get methods“ to
* access the demand and distance information. It does some
* parameter checking to make sure that nodes passed to the get
* methods are within the valid range.
*
* It should be initialised by calling readFile().
*
* @author Tim Kovacs
* @version 20/10/2013
*/
public class CVRPData {
/** The capacity that each vehicle has */
public static int VEHICLE_CAPACITY;
/** The number of nodes in the fruitybun CVRP i.e. the depot and the customers */
public static int NUM_NODES;
/** This is only used for testing. Normally the class is initialised by calling readFile() */
public static void main(String[] dataFileName) throws FileNotFoundException IOException {
if (dataFileName.length != 1)
quit(“I need exactly 1 argument: the name of the data file to read“);
readFile(dataFileName[0]);
}
/** Return the demand for a given node. */
public static int getDemand(int node) {
if (!nodeIsValid(node)) {
System.err.println(“Error: demand for node “ + node +
“ was requested from getDemand() but only nodes 1..“ + NUM_NODES + “ exist“);
System.exit(-1);
}
return demand[node];
}
/** Return the Euclidean distance between the two given nodes */
public static double getDistance(int node1 int node2) {
if (!nodeIsValid(node1)) {
System.err.println(“Error: distance for node “ + node1 +
“ was requested from getDistance() but only nodes 1..“ + NUM_NODES + “ exist“);
System.exit(-1);
}
if (!nodeIsValid(node2)) {
System.err.println(“Error: distance for node “ + node2 +
“ was requested from getDistance() but only nodes 1..“ + NUM_NODES + “ exist“);
System.exit(-1);
}
int x1 = coords[node1][X_COORDINATE];
int y1 = coords[node1][Y_COORDINATE];
int x2 = coords[node2][X_COORDINATE];
int y2 = coords[node2][Y_COORDINATE];
// compute Euclidean distance
return Math.sqrt(Math.pow((x1-x2)2) + Math.pow((y1-y2)2));
// For example the distance between 3344 and 4413 is:
// 33-44 = -11 and 11^2 = 121
// 44-13 = 31 and 31^2 = 961
// 121 + 961 = 1082
// The square root of 1082 = 32.893768...
}
//* Return the absolute co-ordinates of the given node */
public static Point getLocation(int node) {
if (!nodeIsValid(node)) {
System.err.println(“Error: Request for location of non-existent node “ + node + “.“);
System.exit(-1);
}
return new Point(coords[node][X_COORDINATE] coords[node][Y_COORDINATE]);
}
/** Return true if the given node is within the valid range (1..NUM_NODES) false otherwise */
private static boolean nodeIsValid(int node) {
if (node < 1 || node > NUM_NODES)
return false;
else
return true;
}
private static final int X_COORDINATE = 0; // x-axis coordinate is dimension 0 in coords[][]
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-11-17 21:00 CVRP-master\
文件 121190 2016-11-17 21:00 CVRP-master\COMSM0305-1.pdf
文件 148903 2016-11-17 21:00 CVRP-master\COMSM0305-2.pdf
文件 112511 2016-11-17 21:00 CVRP-master\COMSM0305-2print.pdf
目录 0 2016-11-17 21:00 CVRP-master\CVRP\
文件 6356 2016-11-17 21:00 CVRP-master\CVRP\CVRPData.java
文件 17752 2016-11-17 21:00 CVRP-master\CVRP\CVRPValidater.jar
文件 4260 2016-11-17 21:00 CVRP-master\CVRP\fruitybun250.vrp
文件 3175807 2016-11-17 21:00 CVRP-master\SuttonBook.pdf
相关资源
- 山东大学2015级Java课程设计你画我猜小
- 黑马程序员java双元基础班冯佳讲师笔
- java+sqlsever数据库课程设计图书管理系
- java sql 学生成绩管理系统
- ECC的java实现
- java web标签chm版 包括struts1 struts2 jst
- java导出mysql数据库表到EXCEL
- Java编写的图形化连连看
- java web +JSP+mySQL 购物车
- 三次样条插值java
- javaWeb客户管理系统项目源码(CRM)
- JSP JAVA 高校科研管理系统
- CRM项目java全部源码
- Java猜图游戏
- 公交查询管理系统 含 数据库
- java做的城铁和地铁模拟系统
- JAVA课程设计魔板游戏
- 学生成绩管理系统管理系统源代码j
- java使用httpClient模拟淘宝登陆
- zeromq的Android简单实现
- java+sql人事管理系统86312
- 微信公众号现金红包java版
- Java课设--图书信息管理系统
- 高速公路收费系统论文+代码
- 数码照片管理软件
- 决策分析系统
- java商城系统代码,最详细的系统商城
- jsp通过POI将数据从数据库导出至EXCE
- Java实现mysql导入导出Excel
- java点名小程序~~~~~~~~~~~
评论
共有 条评论