GithubHelp home page GithubHelp logo

chen0040 / java-datasets-discrete-optimization Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 66 KB

Package provides datasets in the domain of discrete optimization

License: MIT License

Shell 35.50% Batchfile 27.41% Java 37.09%
tsp tsp-benchmark

java-datasets-discrete-optimization's Introduction

java-datasets-discrete-optimization

Package provides datasets in the domain of discrete optimization

Features

  • TSP

Install

Add the following dependency to your POM file:

<dependency>
  <groupId>com.github.chen0040</groupId>
  <artifactId>java-datasets-discrete-optimization</artifactId>
  <version>1.0.1</version>
</dependency>

Usage

TSP

The sample code below shows how to list all the TSP benchmarks:

Tsp.Instance[] instances = Tsp.Instance.values();
      for(Tsp.Instance instance : instances){
         TspBenchmark benchmark = Tsp.get(instance);
      }
}

The sample code belows show how to obtain use the api of a TSP benchmark:

TspBenchmark benchmark = Tsp.get(Tsp.Instance.a280);
System.out.println(benchmark.size());

for(int v = 0; v < benchmark.size(); ++v){
   System.out.println(benchmark.position(v)); // print the (x, y) coordinate of vertex v 
   for(int w = v+1; w < benchmark.size(); ++w) {
      System.out.println(benchmark.distance(v, w)); // symmetric distance between vertices v and w
   }
}

// optTour is the known optimal tour for which the last vertex is connected to the first vertex
for(Integer v : benchmark.optTour()){
   System.out.println(v);
}

System.out.println(benchmark.optCost()); // print the total distance of the known optimal tour

java-datasets-discrete-optimization's People

Contributors

chen0040 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.