Giter Club home page Giter Club logo

Comments (3)

daniel-j-h avatar daniel-j-h commented on August 15, 2024

Great to hear this project is useful for you!

Hm I don't really know how to help you here - if you need features implemented in this project feel free to open detailed tickets - maybe someone from the community will step up. I'm also happy to give you some guidance into the right direction but I'm not able to run features out for you.

What features are you looking for specifically?

from node-or-tools.

joaopiopedreira avatar joaopiopedreira commented on August 15, 2024

Hi @daniel-j-h , we have those features implemented in our own vrp.cc, in pure C++. Let me give you an example. Below an extract of our vpr.cc.

feature: enforcing a max distance per route:

implementation: (jsonObj is the json object with the algorithm input - we use the nlohmann/json library

(...)
using operations_research::ServiceTimePlusTransition;
using operations_research::RoutingModel;
(...)
RoutingModel routing(2*numShipments + numServices + numTotalDifferentDepots,
      numVehicles, vDepots);  
(...)
// Adding a maximun distance constraint
  const int64 kMaxDistance = 999999999;
  std::vector<int64> vMaxDistance (numVehicles);
  const int64 kTimePerDemandUnitFake = 0;//Using a fake value
  for (int i=0; i<numVehicles; i++){
      if(jsonObj["vehicles"][i].count("max_distance")==0){
          vMaxDistance[i]=kMaxDistance;
      } else {
          vMaxDistance[i]=jsonObj["vehicles"][i]["max_distance"];
      }
  }
  ServiceTimePlusTransition distance(
      kTimePerDemandUnitFake, NewPermanentCallback(&demand, &DeterministicDemand::ServiceTime),
      NewPermanentCallback(&locations, &LocationContainer::DistanceBetweenNodes));
  routing.AddDimensionWithVehicleCapacity(
      NewPermanentCallback(&distance, &ServiceTimePlusTransition::Compute),
      kMaxDistance, vMaxDistance, /*fix_start_cumul_to_zero=*/true, kDistance);
  const operations_research::RoutingDimension& distance_dimension =
      routing.GetDimensionOrDie(kDistance);
  std::cout << "Done Max Dist\n";
(...)

Question: How would we translate this bit of code in order to add it to your existing vrp.cc in node-or-tools? Many thanks.

from node-or-tools.

daniel-j-h avatar daniel-j-h commented on August 15, 2024

Interaction with the solver happens in the vrp worker here. You need to parse the parameter from the JavaScript side in vrp_params.h, store it, and pass it on to the worker in vrp.cc.

from node-or-tools.

Related Issues (20)

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.