mathematical-optimization

Binpacking — multiple constraints: weight+volume

不羁的心 提交于 2020-08-01 09:08:06
问题 I have a dataset with 50,000 orders. Each order has ~20 products. Product volume and weight are present (as well as x,y,z dimensions). I have shipping boxes of constant volume V_max and maximum weight capacity of W_max. Per order I want to minimize the number of boxes used under the constraint that V < V_max, and W < W_max. In searching the web I have come across many binpacking algorithms, but none of them seem to do the trick. Does anyone know of an elegant (and fast) python algorithm for

Split a vector into chunks such that sum of each chunk is approximately constant

若如初见. 提交于 2020-07-21 08:29:10
问题 I have a large data frame with more than 100 000 records where the values are sorted For example, consider the following dummy data set df <- data.frame(values = c(1,1,2,2,3,4,5,6,6,7)) I want to create 3 groups of above values (in sequence only) such that the sum of each group is more or less the same So for the above group, if I decide to divide the sorted df in 3 groups as follows, their sums will be 1. 1 + 1 + 2 +2 + 3 + 4 = 13 2. 5 + 6 = 11 3. 6 + 7 = 13 How can create this optimization

Split a vector into chunks such that sum of each chunk is approximately constant

爷,独闯天下 提交于 2020-07-21 08:29:08
问题 I have a large data frame with more than 100 000 records where the values are sorted For example, consider the following dummy data set df <- data.frame(values = c(1,1,2,2,3,4,5,6,6,7)) I want to create 3 groups of above values (in sequence only) such that the sum of each group is more or less the same So for the above group, if I decide to divide the sorted df in 3 groups as follows, their sums will be 1. 1 + 1 + 2 +2 + 3 + 4 = 13 2. 5 + 6 = 11 3. 6 + 7 = 13 How can create this optimization

How to use 'cbc' in pyomo's SolverFactory in Windows 10

不羁岁月 提交于 2020-07-10 10:26:46
问题 I have been trying to use 'cbc' solver in pyomo as following: """ import pyomo.environ as pe solver = pe.SolverFactory('cbc') result = solver.solve(m) """ Currently, I have been relying on the embedded solver with pyomo installation, which is 'glpk', and I have found that 'cbc' can do better job in many circumstances. I am using: python 3.XX Anaconda environment Windows 10 Pyomo (installed via Conda) It would be great to upgrade the ability of pyomo by using advanced solver! 回答1: You will

Numeric issues during ellipsoid fitting using with SCS to perform SDPs?

我怕爱的太早我们不能终老 提交于 2020-06-16 17:46:38
问题 I've attempted to implement the Calafiore (2002) method of fitting ellipsoids to data using CVXPY as a wrapper to SCS to perform the semi-definite programming. When I run this implementation, I get decent agreement with the first ellipsoid of Section IVB (Fig 6a). However, I don't get numeric agreement with the second ellipsoid of that section (Fig 6b), although the results are visually close. Worse, when I try to fit a very well defined ellipse (the points below) I get an obviously poor fit

Numeric issues during ellipsoid fitting using with SCS to perform SDPs?

纵饮孤独 提交于 2020-06-16 17:46:10
问题 I've attempted to implement the Calafiore (2002) method of fitting ellipsoids to data using CVXPY as a wrapper to SCS to perform the semi-definite programming. When I run this implementation, I get decent agreement with the first ellipsoid of Section IVB (Fig 6a). However, I don't get numeric agreement with the second ellipsoid of that section (Fig 6b), although the results are visually close. Worse, when I try to fit a very well defined ellipse (the points below) I get an obviously poor fit

block of consecutive variables to have same value in mixed-integer linear programming

匆匆过客 提交于 2020-06-16 07:08:20
问题 I am trying to model the operation of a system component, the component will have two operating modes, let's call them 1 and 2, plus the idle mode 0 There is no limit on idling, but each operating mode will last for exactly 3 time-series points, so x_{i}= 1 means x_{i+1} = x_{i+2} = 1 (cannot post images, please use the link below for the equation) operation mode 1 same goes for operating mode 2. For example. 011102220 is valid, but 01110220 is not. 111111 or 222222 are not valid, but this is

How to ask for second best solution to a MIP using JuMP

房东的猫 提交于 2020-06-14 04:06:54
问题 I have a Mixed Integer Programming problem. I can use JuMP to find the optimal solution. But how can I find the second best solution? Or the third-best etc. This potentially might be another equally optimal solution, or it might be a worse solution, or it might be :Infeasible -- there might be no most solutions. I know for a TSP-like problem, I can find additional solutions by progressively removing links that are on the optimal path (I.e setting the distances between some of the cities to be