Questions tagged [r]

For questions about solving Operations Research problems using the R programming language.

Filter by
Sorted by
Tagged with
0 votes
0 answers
27 views

R package cannot find PYOMO. How do I point to the correct location of where it's located?

As a quick note this is a re-post from the main StackOverflow. I am trying to use the PYOMO linear programming solver from within an R script. When I type ...
Abed's user avatar
  • 1
2 votes
1 answer
63 views

How to Group IDs Based on the Difference of Each ID’s Min and Max Value?

I have a dataset that contains IDs along with their corresponding minimum and maximum values. Here’s a sample of the data: ...
Shibaprasad's user avatar
2 votes
3 answers
157 views

Grouping values based on a difference constraint

I am trying to write an MILP to do a grouping (clustering) given one difference condition. Suppose, I have the following elements in a list: 1,2,3,4,6,8,9,10. My goal here is to group them so that the ...
Shibaprasad's user avatar
1 vote
0 answers
34 views

Calling Cplex from R through a MPS-like file

I have a working - and long - R code to generate a mps file to be read by cplex. Because I work with large instances I am finding troubles (too much time) in producing a large mps file. Is there a way ...
Di Al's user avatar
  • 11
0 votes
0 answers
80 views

different constraints for each row

I'm using the IpSolve package to solve a problem to optimize the assignment (minimum distance) between sellers (rows)and customers (columns) using Rstudio. The problem I faced when using lp/lp....
Angel Diaz's user avatar
2 votes
1 answer
183 views

Solving a Global Optimization problem using Differential Evolutionary Algorithm using R

I need to determine the global optimum results of this objective function. I define the problem by minimizing the squared difference as represented in function $f(q_1,q_2,\alpha_1,\alpha_2)$ The ...
Mrinmoy Chakraborty's user avatar
2 votes
0 answers
97 views

Supply chain simulation is not working. Any help please?

I am trying to simulate a supply chain scenario. Demand is random (e.g. between 100-400 units) and lead time vary 2 to 4 days for each supply. The holding cost(h), penalty cost (p) for lost_sales, ...
Roger's user avatar
  • 21
2 votes
2 answers
223 views

Assign jobs to least people with multiple job constraints

Assume I have an infinite number of staff/supply. I have a table of how much time in hours needs to be spent on certain tasks: Task Demand A 0.75 B 0.8 C 0.65 D 0.7 E 0.6 F 0.65 And the tasks ...
Elis's user avatar
  • 23
2 votes
0 answers
72 views

find unique neighbour pairs between two point clouds in R

Given two point clouds I want to find for each point from the first point cloud the nearest neighbour from the second point cloud. Also, each pair of neighbours should be unique. The solution was ...
mri's user avatar
  • 121
2 votes
2 answers
338 views

Optimization gives me negative value

Not sure if this question is appropriate, but there is some error in my code which I just cannot seem to find. Probably been staring myself blind to this, so I could really use some help. It is a MILP,...
user9867's user avatar
2 votes
1 answer
46 views

Two criteria in a problem that involves multiple-criteria decision-making

I would like your valuable opinion on one issue: I created a decision matrix considering two criteria and 10 alternatives, as below. My problem involves determining the optimal number of clusters from ...
Antonio's user avatar
  • 319
3 votes
2 answers
292 views

How to calculate the average distance between two points in seperate dataframes in r

I have two data frames, the first indicating customer locations and the second indicating facility locations. I want to calculate the average distance of all customers to the closest facility location ...
user9867's user avatar
2 votes
0 answers
26 views

Matrix normalization to use multicriteria methods

I'm using the TOPSIS and VIKOR multicriteria methods to generate rankings according to the decision matrix that I call a database. I would like to know if the ...
Antonio's user avatar
  • 319
1 vote
2 answers
166 views

Include dataframe linear optimization in r

For a linear optimization problem I want to include a dataframe (d_ij) which has binary variables, 1 if customer i is located within the assignable distance of facility j, 0 otherwise. So unless d_ij =...
user9867's user avatar
2 votes
2 answers
64 views

How to verify the correctness of forecast?

I would like to forecast the car rental (count time series). Given hourly integer valued car rentals for a month's period from 24th september to 24th October. I need to forecast car rental demand ...
Jose_Peeterson's user avatar
2 votes
2 answers
99 views

Adjust result to equal mode values

The code below is generating the mode value considering the columns Method1, Method2, Method3...
Antonio's user avatar
  • 319
-1 votes
1 answer
80 views

Create random coordinates with pre specified degree of clustering

In R, I want to create a random data frame of x and y coordinates, that has a certain degree of clustering. For example 15 $k$-...
user9867's user avatar
2 votes
1 answer
469 views

Is it possible to merge two objective functions using the LpSolve package in R?

I have been using the LpSolve package to solve a minimization problem in my final course work, but I need to reconcile this problem with a maximization problem. Conducting several researches, I ...
Éric Dias Rosso's user avatar
3 votes
1 answer
1k views

3D Knapsack Problem: R or Python Packages?

For an upcoming client project, I'm looking to do a 3D variant on the knapsack problem. Basically, there's a bin of dimensions $x,y,z$, and I have $K$ units of an item with dimensions $a,b,c$. (...
Ralph Asher's user avatar
3 votes
1 answer
89 views

Application with VIKOR multicriteria method

What to do in these cases where I can't rank by the VIKOR multicriteria method because Q has no value? ...
Antonio's user avatar
  • 319
0 votes
1 answer
211 views

Conflicts with weights of the topsis method in R

Why can't I generate for the topsis method, choosing a w <- c(1, 0)? As far as I know it has to be the sum of the weights ...
Antonio's user avatar
  • 319
6 votes
3 answers
254 views

Linear Programming problem for finding supplier

I have a linear programming problem in front of me that I am searching to solve in R (any package). It seems like an unbalanced assignment problem to me with relaxed constraints on columns (repeated ...
Patrik's user avatar
  • 183
1 vote
0 answers
30 views

How to utilize Spearman Rho coefficient

The dataset below presents the ranking of different multicriteria methods. My idea is to generate a final ranking based on the multicriteria methods for all alternatives, but it can be seen that in ...
Antonio's user avatar
  • 319
2 votes
1 answer
137 views

Using VIKOR multicriteria method in R

I'm using the VIKOR multicriteria method from the MCDM package. The example can be found here: https://cran.r-project.org/web/...
Antonio's user avatar
  • 319
1 vote
0 answers
73 views

How to use PROMETHEE multicriteria method in R

I used TOPSIS multicriteria method to select the best number of clusters out of the 34 options. As weights I used 0.5 for each criterion. The ...
Antonio's user avatar
  • 319
1 vote
1 answer
275 views

How to Use the Weighted Sum Method in R

I would like to use the weighted sum method to select the best number of clusters out of the 34 options. As weights I would like to use 0.5 for each criterion. The coverage criterion is to minimize ...
Antonio's user avatar
  • 319
1 vote
1 answer
263 views

Use the Weighted Sum Method in R

I would like to use the Weighted Sum Method (Multi Criteria Decision Making) in R in this database below. The resolution of the issue is here: https://www.geeksforgeeks.org/weighted-sum-method-multi-...
Antonio's user avatar
  • 319
5 votes
2 answers
445 views

R package for multi objective integer evolutionary algorithm

I have a discrete event simulation (simmer package) based on probability distributions in R. I would like to optimize the variables according to several (2 or more) objectives. I used the NSGA-II ...
mcfly's user avatar
  • 51
2 votes
2 answers
148 views

How to use `cplexAPI` to solve quadratic programs/quadratically constrained linear programs?

I am trying to use cplexAPI to solve quadratic programs or quadratically constrained linear program. While it seems to be pretty straightforward to use ...
wayne's user avatar
  • 21
4 votes
2 answers
211 views

Optimizing a capacitated clustering problem with Greedy search algorithm

So, I am trying to implement a greedy search algorithm to cluster a number of points. Each point has a specific demand and each cluster shouldn't exceed that demand. Now, when I run it for a smaller ...
Shibaprasad's user avatar
3 votes
0 answers
123 views

How to approach this Truck Utilisation problem?

The problem statement currently I have is very broad (or you can say very vague at the same time): I have a number of dropping locations (Customer locations) I have the location of the HUB I have a ...
Shibaprasad's user avatar
5 votes
4 answers
713 views

Solving Capacitated VRP with multiple various sized vehicles

I am looking to form a Capacitated VRP problem like this: I have 40,000 dropping locations with Demands of each point available I have 5-6 types of vehicles available with different capacities and ...
Shibaprasad's user avatar
4 votes
1 answer
272 views

Problems with reading CPLEX LP models from file in R by package 'lpSolveAPI'

As an R user, I'm trying to read a CPLEX LP model from file by using the read.lp function from package lpSolveAPI. Here's the command line (from within RStudio): ...
Antonio Piemontese's user avatar
3 votes
0 answers
142 views

R ompr MILPModel array multiplication?

In R, I regularly ompr::MILPModel for optimization. I adapt the below snippet to enable multiplication of a decision variable with two dimensions (e.g., x[i,j] ) ...
Ralph Asher's user avatar
3 votes
1 answer
421 views

Non-numeric argument to binary operator in MILPModel of ompr package

I am familiar with how to use ompr::MIPModel but I am trying to learn how to use MILPModel to take advantage of the model build ...
Ralph Asher's user avatar
3 votes
2 answers
171 views

Using R for coding Matheuristic for Research Publication

Given that R possesses superior data pre-processing and post-processing packages, I am thinking of coding a matheuristic using R for publishing in an academic research journal. However, I am unable ...
Mike's user avatar
  • 707
5 votes
3 answers
200 views

Reducing number of suppliers for product portfolio

I have the following matrix of suppliers who are able to make a certain product, against all products in my portfolio. What is the best way of finding the solution to "the least suppliers necessary ...
Roman's user avatar
  • 151
5 votes
2 answers
2k views

VRP package for R

I work almost exclusively in R and Rstudio, and have found it to be an excellent ecosystem for data analysis and OR, including discrete event simulation, Monte Carlo simulation, MILP, and the ...
Ralph's user avatar
  • 371
6 votes
1 answer
116 views

DAG shortest path in R - I have a list of nodes, each node's completion time and each node's predecessor(s). How can I turn this to a list of arcs?

Without trying to manually sketch out a graph on paper, is there a simple way I could get the arcs between nodes in this problem? I am using R and it seems there must be an elegant way of doing so but ...
Jacob Myer's user avatar
9 votes
2 answers
226 views

When should I use a solver for IP and MIP and can I just use a library from Python, R, Matlab, etc...?

Are there any rules of thumb for figuring out when you need to use a solver like Gurobi or CPLEX, and when you can just solve you problems directly with a Python, R, or Matlab package? Is it just a ...
Skander H.'s user avatar
  • 2,139
4 votes
2 answers
819 views

Queuing models in R, $\lambda$ Little

It's noted that the number of folks in a stationary system will maintain an average equal to the rate of arrival multiplied by the mean of the service distribution. The formula $L = \lambda w$ is ...
pulselaserman_quantum's user avatar