I am trying to solve a variant of the multidimensional multiple knapsack problem which tries to optimize the values in each knapsack so that a percentage of each of them can be “taken” and added to create a “final knapsack” with the ideal values. See this question below. https://cs.stackexchange.com/questions/14163/linear-programming-algorithm-to-check-if-ratios-can-be-combined-with-n-bottles
The problem I linked to says "given n bottles find a solution where you can take a ratio of every bottle and add them to equal the predetermined values (A, B, C)." The problem I have is "given a set of values organize them in the n bottles in such a way that there is a solution where you can take a ratio of every bottle and add them to equal the predetermined values (A, B, C)."
Essentially I would like to create an algorithm that organizes incoming values knapsacks (or bottles as they call it in the question above) so that they could be combined in a way that could guarantee the desired result.
The main difference between the multiple multidimensional knapsack problem and what I am trying to do is what I am trying to maximize. Instead of trying to maximize the total value of all the knapsacks, I want to first multiply each knapsack by a variable Lambda[i] and add them together so that they equal the item F which is a vector with constants (A, B, C, D). I want the knapsacks optimized in such a way that the combination gives back the most amount of item F.
Here are the variables
The objective function I am trying to maximize N = Σ n(i) * Lambda(i)
some constraints I have are
n[i] <= m[i]
Σ a(i) * Lambda[i] = A
Σ b(i) * Lambda[i] = B
Σ C(i) * Lambda[i] = C
Σ D(i) * Lambda[i] = D
0 <= Lambda[i] <= 1
I have tried implementing this solution in Gurobi and OR-Tools but the problem I'm having is that the weight of each bin is only found after optimizing so there is no way for me to maximize the function I need.
Ultimately I would like to solve an Online version of this problem where the algorithm wouldn't be able to reject any item coming in but I figured starting with the offline version with a dataset would be easier.
Does this mean this algorithm is not a linear programming problem or I am just missing a step? If it isn't a linear program is there any other method like machine learning that could help me solve this?
Any help would be greatly appreciated.
It looks to me to be probably a linear programming problem, but you are having a problem with the objective being not-linear? There are ways to reformulate some of these not-linear terms to make them solveable: See for example Erwin Kalvelagen's excellent mathematical programming examples such as http://yetanothermathprogrammingconsultant.blogspot.com/2017/05/linearizing-average.html which is probably not quite the same as you need but may give you enough ideas to help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.