linear-programming

Matching algorithms in R (bipartite matching, Hungarian algorithm)

寵の児 提交于 2019-12-04 10:32:38
问题 I wonder how to set up some example some fundamental matching procedures in R. There are many examples in various programming languages, but I have not yet found a good example for R. Let’s say I want to match students to projects and I would consider 3 alternative approaches which I came across when googling on this issue: 1) Bipartite matching case: I ask each student to name 3 projects to work on (without stating any preference ranking among those 3). ID T.1 T.2 T.3 T.4 T.5 T.6 T.7 1 1 1 1

How to solve a linear programing in matlab in canonical representation? [closed]

萝らか妹 提交于 2019-12-04 05:30:41
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Is it possible to enter matlab a string like that: MAX 140 x1 + 160 x2 +x3 SUBJECT TO 2 x1 + 4 x2 <= 28 5x1 + 5.333x2 -500X3 = 0 x1 <= 8 x2 <= 6 END The toolbox I have installed: v = ver; setdiff({v.Name},

Minimize sum of distances in point pairs

自闭症网瘾萝莉.ら 提交于 2019-12-04 04:18:33
I have a bunch of points on a 2-dimensional Grid. I want to group the Points into pairs, while minimizing the sum of the euclidean distances between the points of the pairs. Example: Given the points: p1: (1,1) p2: (5,5) p3: (1,3) p4: (6,6) Best solution: pair1 = (p1,p3), distance = 2 pair2 = (p2,p4), distance = 1 Minimized total distance: 1+2 = 3 I suspect this problem might be solvable with a variant of the Hungarian Algorithm ?! What is the fastest way to solve the problem? (Little Remark: I always should have less than 12 points.) ChuckCottrill The problem you are trying to solve is

Optimisation/knapsack algorithm with multiple contraints in JavaScript

拟墨画扇 提交于 2019-12-03 21:53:45
I'm looking for a solution to the knapsack problem where multiple constraints are in place. Say our knapsack has a maximum weight of 30kg and we have a set of 100 objects, each with a weight and each with a benefit. These objects could look like this: { name: 'water bottle', weight: 2, benefit: 5 }, { name: 'potatoes', weight: 10, benefit: 6 } Finding the combination of objects with the highest benefit within the maximum weight is simple enough. Here is a nodeJS plugin showing how it can be done... https://gist.github.com/danwoods/7496329 Where I'm struggling is when the objects have more

Interpretation of GAP in CPLEX

旧巷老猫 提交于 2019-12-03 17:28:10
This is a part of the engine-log output that I get from a small-scale mixed integer linear optimization problem that I solved in CPLEX 12.7.0 Nodes Cuts/ Node Left Objective IInf Best Integer Best Bound ItCnt Gap 0 0 280.0338 78 280.0338 72 0 0 428.8558 28 Cuts: 89 137 0 0 429.5221 34 Cuts: 2 142 0 0 429.7745 34 MIRcuts: 2 143 * 0+ 0 460.9166 429.7745 6.76% 0 2 429.7745 34 460.9166 429.8666 143 6.74% Elapsed time = 0.49 sec. (31.07 ticks, tree = 0.01 MB, solutions = 1) * 35 8 integral 0 438.1448 435.6381 211 0.57% Cover cuts applied: 17 Implied bound cuts applied: 10 Flow cuts applied: 11

What is the benefit of using exponential backoff?

本秂侑毒 提交于 2019-12-03 15:54:24
问题 When the code is waiting for some condition in which delay time is not deterministic, it looks like many people choose to use exponential backoff, i.e. wait N seconds, check if the condition satisfies; if not, wait for 2N seconds, check the condition, etc. What is the benefit of this over checking in a constant/linearly increasing time span? 回答1: This is the behavior of TCP congestion control. If the network is extremely congested, effectively no traffic gets through. If every node waits for

Any good implementation of greedy set cover for large datasets?

房东的猫 提交于 2019-12-03 14:40:58
This question follows from a related question of mine posted here . @mhum suggested that my problem falls into the covering problem domain. I tried encoding my question into a minimum set cover problem and currently I have a dataset in this form: Set Cost (1,2) 1 (1) 1 (1,2,3) 2 (1) 2 (3,4) 2 (4) 3 (1,2) 3 (3,4) 4 (1,2,3,4) 4 The objective is to find a good set cover that covers all numbers and one that attempts to minimize the total cost. My dataset is big with at least 30000 sets (of size varying from 5-40 elements) like this. Are there any good greedy implementations to solve this or am I

Why solving Knapsack problem is not considered as linear programming?

纵饮孤独 提交于 2019-12-03 11:35:24
Why isn't the knapsack problem included under the category of linear programming algorithms in spite of the fact that the Knapsack problem statement seems similar to the problems in linear programming ? Knapsack can be written as an integer linear programming program. Unlike normal linear programming, this problem requires that variables in the solution are integers. Linear programming is known to be solvable in polynomial time, while integer linear programming is NP-complete. Exercise for the reader: show that 3SAT can be reduced to integer linear programming. Trivia: there are approximation

Java Library? - Simplex / Linear Programming / Optimization [closed]

拈花ヽ惹草 提交于 2019-12-03 09:31:31
I'm looking for an optimization library. My two requirements are that it does not use JNI and that it does not have license restrictions preventing it from being used on multiple computers commercially. The only one I've found that meets these requirements is Choco, but it is unusably buggy. Since I couldn't find any optimization software in Java I wrote my own implementation of the Simplex Method and submitted it to Apache Commons Math library: https://issues.apache.org/jira/browse/MATH-246 http://ojalgo.org/generated/org/ojalgo/optimisation/linear/LinearSolver.html Recently JOptimizer , free

How to solve a system of inequalities?

不想你离开。 提交于 2019-12-03 08:25:21
I've reduced my problem (table layout algorithm) to the following problem: Imagine I have N variables X 1 , X 2 , ..., X N . I also have some (undetermined) number of inequalities, like: X 1 >= 2 x 2 + X 3 >= 13 etc. Each inequalities is a sum of one or more variables, and it is always compared to a constant by using the >= operator. I cannot say in advance how many inequalities I will have each time, but all the variables have to be non-negative, so that's already one for each variable. How to solve this system in such a way, that the values of the variables are as small as possible? Added: