linear-programming

Minimize sum of distances in point pairs

回眸只為那壹抹淺笑 提交于 2019-12-06 00:06:09
问题 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:

Linear Programming - variable that equals the sign of an expression

血红的双手。 提交于 2019-12-05 18:28:10
I am trying to write a linear program and need a variable z that equals the sign of x-c, where x is another variable, and c is a constant. I considered z = (x-c)/|x-c| . Unfortunately, if x=c, then this creates division by 0. I cannot use z=x-c, because I don't want to weight it by the magnitude of the difference between x and c. Does anyone know of a good way to express z so that it is the sign of x-c? Thank you for any help and suggestions! You can't model z = sign(x-c) exactly with a linear program (because the constraints in an LP are restricted to linear combinations of variables).

Find the Discrete Pair of {x,y} that Satisfy Inequality Constriants

戏子无情 提交于 2019-12-05 10:45:48
I have a few inequalities regarding {x,y} , that satisfies the following equations: x>=0 y>=0 f(x,y)=x^2+y^2>=100 g(x,y)=x^2+y^2<=200 Note that x and y must be integer. Graphically it can be represented as follows, the blue region is the region that satisfies the above inequalities: The question now is, is there any function in Matlab that finds every admissible pair of {x,y} ? If there is an algorithm to do this kind of thing I would be glad to hear about it as well. Of course, one approach we can always use is brute force approach where we test every possible combination of {x,y} to see

Interpretation of GAP in CPLEX

眉间皱痕 提交于 2019-12-05 02:57:30
问题 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

Linear Programming library for iOS

你说的曾经没有我的故事 提交于 2019-12-05 02:47:12
I am looking for an iOS library that enables solving LP, IP, BIP, MIP for an application I am developing. I've found GLPK but have no idea how to compile it for iOS, and after searching the web for some time, I did not find anything interesting... I'd appreciate if someone can help me how to compile GLPK for iOS or either knows of some open source LP solver for iOS. János I used GMP (GNU Multiple Precision Arithmetic Library) for iOS development, what is basically a C based static library for various mathematical purpose. I had to do calculation on a big matrix, so I needed a library that

Any good implementation of greedy set cover for large datasets?

风流意气都作罢 提交于 2019-12-05 00:28:37
问题 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

Simplex in z3 via for-all

情到浓时终转凉″ 提交于 2019-12-04 21:06:57
A very similar questions were asked on SO already, but I couldn't find answer to the following problem. A linear maximization problem can be easily stated using for-all quantifier: obj = f(x) AND \forall x . Ax <= b => f(x) <= obj The queries like above can be posed to z3. Consequently I want to ask whether z3 is smart enough to recognize an LP problem when it sees one and will it apply a simplex method to eliminate a for-all quantifier? I did a few experiments and it seemed to work, but I haven't tried it on more complex examples. Thanks! Z3 does not recognize it as an LP optimization problem

How to solve a system of inequalities?

空扰寡人 提交于 2019-12-04 13:23:39
问题 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

Any good tools to solve integer programs on linux? [closed]

让人想犯罪 __ 提交于 2019-12-04 12:07:22
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Are there any good tools to solve integer programs on Linux? I have a small problem that I want to compute to save time :D. It is kind of a subset sum problem. I have a list of around 20 Integer-Values and I want to compute the subset with the smallest sum that satisfies a certain minimum. You could formulate

Linear programming library for .NET / C# [closed]

强颜欢笑 提交于 2019-12-04 12:02:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I need to solve an under-determined linear system of equations and constraints, then find the particular solution that minimises a cost function. This needs to be done in purely portable managed code that will run in .NET and Mono. What freely available libraries are there that I can use to implement this? All