linear-programming

R optimisation buy sell

戏子无情 提交于 2020-06-01 05:55:19
问题 I need to find a solution to an optimisation problem. In my simplified example, I have a prediction of prices for the next year. I have inventory that can contain max 25 products. I can either sell or buy each month. I cannot buy more than 4 products or sell more than 8 products per month. I am looking for profit by buying for lower price than selling. Is there a package/function that can indicate when to buy and when to sell? The objective is to maximise the profit at the end of the period

R optimisation buy sell

社会主义新天地 提交于 2020-06-01 05:54:13
问题 I need to find a solution to an optimisation problem. In my simplified example, I have a prediction of prices for the next year. I have inventory that can contain max 25 products. I can either sell or buy each month. I cannot buy more than 4 products or sell more than 8 products per month. I am looking for profit by buying for lower price than selling. Is there a package/function that can indicate when to buy and when to sell? The objective is to maximise the profit at the end of the period

R optimisation max buy/sell dependent on stock level

风格不统一 提交于 2020-06-01 05:03:50
问题 I would like to find a solution to an optimisation problem. The aim is to maximise profit by buying for low price and selling for a higher one. There are constraints such as maximum stock level, and max buy/sell number of units. Moreover, sell and buy limits depend on the inventory levels. I have asked a similar question albeit without the last condition here R optimisation buy sell. Here is an example: price = c(12, 11, 12, 13, 16, 17, 18, 17, 18, 16, 17, 13) capacity = 25 max_units_buy_30 =

R optimisation max buy/sell dependent on stock level

﹥>﹥吖頭↗ 提交于 2020-06-01 05:03:19
问题 I would like to find a solution to an optimisation problem. The aim is to maximise profit by buying for low price and selling for a higher one. There are constraints such as maximum stock level, and max buy/sell number of units. Moreover, sell and buy limits depend on the inventory levels. I have asked a similar question albeit without the last condition here R optimisation buy sell. Here is an example: price = c(12, 11, 12, 13, 16, 17, 18, 17, 18, 16, 17, 13) capacity = 25 max_units_buy_30 =

Linear Programming - Google ortools - incorrect decision variable final values

拜拜、爱过 提交于 2020-04-11 07:52:09
问题 I am trying to solve a linear programming problem. Following are specs of the problem: I have a network flow problem that's been converted to a linear programming problem. So, all the flow constraints, such as capacity, flow conservation etc., will have to be enforced. My objective is to minimize cost. Decision Variables - I have built two 8x8 matrices by defining a dictionary and adding decision variable at each of those 128 locations. Constraints - there are in total 24 constraints, namely:

What is the minimum cost to connect all the islands?

柔情痞子 提交于 2020-04-05 06:58:05
问题 There is a grid of size N x M . Some cells are islands denoted by '0' and the others are water . Each water cell has a number on it denoting the cost of a bridge made on that cell. You have to find the minimum cost for which all the islands can be connected. A cell is connected to another cell if it shares an edge or a vertex. What algorithm can be used to solve this problem? What can be used as a brute force approach if the values of N, M are very small, say NxM <= 100? Example : In the

How to set upper and lower bounds for each element in a set?

断了今生、忘了曾经 提交于 2020-02-02 13:35:06
问题 I am creating a GAMS model to solve a simple maximization problem. I have a set J with 3 elements (1,2,3) and a variable x(J) that encompasses all the elements. I am wondering if there is a way in GAMS to set a lower bound of 0 and upper bound of 3 to each element in the set without having to set each element bound individually and without using the positive variable keyword for the lower bound. I have tried using x.lo =e= 0 and x.up =e= 3 but none of these are working. I am guessing I am not

How to set upper and lower bounds for each element in a set?

纵然是瞬间 提交于 2020-02-02 13:31:37
问题 I am creating a GAMS model to solve a simple maximization problem. I have a set J with 3 elements (1,2,3) and a variable x(J) that encompasses all the elements. I am wondering if there is a way in GAMS to set a lower bound of 0 and upper bound of 3 to each element in the set without having to set each element bound individually and without using the positive variable keyword for the lower bound. I have tried using x.lo =e= 0 and x.up =e= 3 but none of these are working. I am guessing I am not

Julia - Parallel mathematical optimizers

断了今生、忘了曾经 提交于 2020-01-24 20:01:10
问题 Im using GLPK with through Julia, and I need to optimize the same GLPK.Prob repeatedly. What changes between each optimization is that some combination of variables gets fixed to 0 simply put in pseudocode lp = GLPK.Prob() variables_to_block = [[1,2,3], [2,3], [6,7], [19,100,111]...] for i in variables_to_block block_vars(lp, i) simplex(lp) restore_vars(lp, i) end when I then run this, it looks like CPU1 acts as a scheduler, staying in the 9-11% range, and the load on CPU3 and CPU4 alternates

“Too many indices” big matrix vector length issue in R

百般思念 提交于 2020-01-17 08:55:42
问题 Hello and thanks in advance. I'm using Rx64 version 3.1.2 on a Windows Server and have a file-backed big matrix generated from the package bigmemory that I'm trying to use in a linear programming problem. The matrix is 7062 rows by 364520 columns for a total of 2574240240 entries (of integers). When I run the line for the linear program, I get the following error: Error in GetElements.bm(x, i, j) : Too many indices (>2^31-1) for extraction. That number, 2147483647, from what I read is the