# Tag Info

8

You can model this as a set covering problem (or hitting set problem -- different terminology, same mathematical model). The (binary) decision variables would determine which suppliers you select; the constraints would be "select at least one that can handle this product" for each product. The objective would be to minimize the number of selections (sum of ...

8

I assume the solver you're referring to in Python/R/Matlab, are the open-source solvers such as CBC or GLPK (you can find out more in this question: Where can I find open source LP solvers?). If that's the case then you should consider: The size of the problem Solution time: which can be very different between open-source and commercial solvers How much ...

7

You mention data pre-/post-processing. If what you propose to do is in the context of data science (for instance, a matheuristic for outlier identification to be embedded in some statistical data-torturing exercise), I don't see any problem at all. If what you propose to do is not specifically related to data science (for instance, a heuristic for solving ...

7

Not directly answering your question of how to code it manually but for discrete simulation of queues in R I would strongly recommend the simmer package. The minimal code for your example would look like this (adapted from the tutorial). library(simmer) library(simmer.plot) lambda <- 2 queue <- trajectory() %>% seize("server", amount=1) %>% ...

6

The package netgen (v1.3) can be used to generate networks and benchmark instances of VRP and TSP. As this article shows it is also possible to solve a variant of VRP (CVRP) in R Shiny, which is another package used for interactive modelling/applications.

5

You could cluster 40,000 dropping locations (by grouping them based on location/vehicle type need) to some reasonable number and can try to implement metaheuristics like Simulated annealing, Particle swarm etc. . Though they won't guarantee optimality but can tune accordingly to achieve desired solution quality.

4

The main reasons are performance and quality of numerics. Non-professional stuff tend to lack the polish professionals spend time doing to ensure that numerical issues don't compromise the solving procedure. Performance-wise, a good rule of thumb is problem density: if a problem is large but really sparse, open source solvers can perform really well. If a ...

4

Your distance constraint for each cluster limits the sum of the distance from each cluster point to its nearest neighbor (excluding the last point selected for the cluster, whose nearest neighbor is not taken). It does not look at the total distance between all pairs of points in the cluster, nor the maximum distance between any pair of points (the cluster &...

4

I'm not an expert in Vehicle Routing Problems, maybe someone else will have something more relevant to propose. I think that a good starting point is this article: "Efficiently solving very large-scale routing problems" (Arnold et al., 2019) DOI PDF This paper is not exactly about your problem, but about the Capacitated Vehicle Routing Problem (...

3

I'm assuming in what follows that all demands must be met. R has a very good genetic algorithm package ("GA") that includes support for permutation chromosomes. Assuming $n$ destinations and $m$ vehicles (not vehicle types, but actual vehicles), you can use a GA with each chromosome a permutation of $1, \dots, n + m$. To decode a chromosome, use ...

3

The problem here seems to be that the data is provided in a somewhat untidy fashion. To use the function the data needs to be preprocessed to extract each entry from the column "Predecessor(s)". You can use the function separate_rows from the R package tidyr (contained in the tidyverse) to do this. You'll also have to convert the letters to numbers. library(...

3

Let $b_{i,j}$ denote product $i$ is taken from supplier $j$. and $x_j$ denote whether supplier $j$ is selected once or not. $i \in n$ (product) $j \in m$ (supplier) Now: \begin{align}\max&\quad \sum_{i,j} b_{i,j}\times 2 - \sum_j x_j\\\text{s.t.}&\quad\sum_j b_{i,j} \leq 1\\&\quad M \times x_j \geq \sum_i b_{i,j} -1 + \delta\\&\quad M \...

2

I guess it is a bit late now, but recently I have been developing a package for solving large instances of the capacitated multiple-depot vehicle routing problem with mileage constraints, which is available here: vrpoptima - Genetic Solver for a Capacitated Multiple-Depot Vehicle Routing Problem with Mileage Constraints This is actually a generalization of ...

2

The first issue is that "LP" format means different things to lpsolve and CPLEX. See the warning about that near the top of the lpsolve page describing their format. There are converters available, but I don't know if there are any packaged for R. So you may need to install one and then convert the CPLEX .lp file to lpsolve format outside of R (or ...

2

A couple of years ago we had a student who wanted to call CPLEX from R and I think after spending a lot of time with a colleague they couldn't get it to work. The situation may have been improved, but back then Gurobi was a lot easier to call from R, and these kinds of struggles may be one reason why R is not very popular in papers that focus on MIPs. There ...

2

A short look into the literature shows that mixed integer multi objective algorithms are still in an early stage with people proposing different formulations and approaches. I am not aware of any open solvers that could be readily used even outside the R ecosystem. So i see multiple options for you: Weighted sum approach and use the package GA as prubin ...

1

1

This document available on link https://cran.r-project.org/web/packages/Rcplex/Rcplex.pdf for RCplex might be helpful for you. Page 7 & 8 has an example of QCP.

1

The question is in itself incomplete as the number of depots is not mentioned. Given that, the solutions become evident. Please correct the question. Still, the solution is in breaking down the problem, yet, keeping it minimized is the challenging part. The only feasible approach is to create Primary and Secondary routing in which Primary is Pan-Country ...

1

Adding a follow-up on how to style matrix multiplication-type constraints and objective function values. This has been a major pain point for me, and now that I have a template, this will be a real productivity boost as I switch to being "MILPModel native". Replace SYMPHONY with the solver of your choice... library(tidyverse) library(magrittr) ...

1

Please try the below code. I modified the way you import i, j vectors. Also, check the initial matrix on how products are linked with suppliers, there are suppliers with no product and vice versa. Then you should fix some b[i,j] values accordingly when NA in initial matrix 0 in b[i,j]. model <- MIPModel() %>% add_variable(b[i,j], i = 1:n, j = 1:m, ...

1

So far this is what I have come up with lambda <- 2 interarrivals <- rexp(5000,lambda) ## (2 items per minute) Provided the $\mu$ we expect that the interarrivals is about half a minute mean(interarrivals) <- 0.516 service.times <- rnorm(5000, mean=8,sd=1) where the service distribution is $N(8,1)$ arrival.times <- cumsum(interarrivals) ...

Only top voted, non community-wiki answers of a minimum length are eligible