linear-programming

lpsolve - unfeasible solution, but I have example of 1

孤街醉人 提交于 2019-12-10 18:39:30
问题 I'm trying to solve this in LPSolve IDE: /* Objective function */ min: x + y; /* Variable bounds */ r_1: 2x = 2y; r_2: x + y = 1.11 x y; r_3: x >= 1; r_4: y >= 1; but the response I get is: Model name: 'LPSolver' - run #1 Objective: Minimize(R0) SUBMITTED Model size: 4 constraints, 2 variables, 5 non-zeros. Sets: 0 GUB, 0 SOS. Using DUAL simplex for phase 1 and PRIMAL simplex for phase 2. The primal and dual simplex pricing strategy set to 'Devex'. The model is INFEASIBLE lp_solve

Find all alternative basic solutions using existing linear-programming tool

久未见 提交于 2019-12-10 13:50:22
问题 I have to find all basic solutions of some tiny linear-programming problems. Here's an example (in lp_solve format): max: x1 + x2; x1 + x2 <= 1; x1 <= 0.8; x2 <= 0.8; All 2 basic solutions: x1 = 0.2, x2 = 0.8 x1 = 0.8, x2 = 0.2 Of course there is a way of finding alternative solutions, but I really prefer using existing libraries instead of crafting my own simplex code. I'm using Python as my programming language, and hoping there's some method in lp_solve or GLPK's C API can do this. Thanks.

Python server “Aborted (Core dumped)”

谁说我不能喝 提交于 2019-12-10 12:53:35
问题 I use web.py to create a Python web server. This server is called to solve linear programming problems, and it uses the library CBC to do that. Every once in a while, the server crashes with a log that looks like that: 78.243.184.3:56271 - - [03/Jun/2016 04:35:54] "HTTP/1.1 GET /optimization" - 200 OK Aborted (core dumped) I belive "Aborted (core dumped)" is a C error, so it comes from either web.py or CBC. Is there any way to trace back the source of the error? 回答1: A core dump is caused by

How do I specify multiple variable constraints using Integer Programming in PuLP?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 11:39:09
问题 I am trying to solve the Bin Packing Problem using the Integer Programming Formulation in Python PuLP. The model for the problem is as follows: I have written the following Python Code using the PuLP library from pulp import * #knapsack problem def knapsolve(bins, binweight, items, weight): prob = LpProblem('BinPacking', LpMinimize) y = [LpVariable("y{0}".format(i+1), cat="Binary") for i in range(bins)] xs = [LpVariable("x{0}{1}".format(i+1, j+1), cat="Binary") for i in range(items) for j in

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

感情迁移 提交于 2019-12-09 06:51:20
问题 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 last year . 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. 回答1: Since I couldn't

Code a linear programming exercise by hand

六眼飞鱼酱① 提交于 2019-12-09 05:52:49
问题 I have been doing linear programming problems in my class by graphing them but I would like to know how to write a program for a particular problem to solve it for me. If there are too many variables or constraints I could never do this by graphing. Example problem, maximize 5x + 3y with constraints: 5x - 2y >= 0 x + y <= 7 x <= 5 x >= 0 y >= 0 I graphed this and got a visible region with 3 corners. x=5 y=2 is the optimal point. How do I turn this into code? I know of the simplex method. And

The integer linear programming(ILP) function in CVXOPT returns non integers

我们两清 提交于 2019-12-08 14:37:39
I wanted to optimize a function using ILP implementing by CVXOPT , GLPK in python. I wrote this code, but it gives me non integer solution especially 0.5. Could anyone help me? import math import numpy as np import cvxopt from cvxopt import glpk from cvxopt import matrix G = np.array([ [-1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., -1., 0., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., -1., 0., 1., -1., 0., 1., 1., 0., 0., -1., 0., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., -1., 0., 0., 0., 0.,

Shift planning with Linear Programming

偶尔善良 提交于 2019-12-08 13:32:36
问题 The Modeling and Solving Linear Programming with R book has a nice example on planning shifts in Sec 3.7. I am unable to solve it with R. Also, I am not clear with the solution provided in the book. Problem A company has a emergency center which is working 24 hours a day. In the table below, is detailed the minimal needs of employees for each of the six shifts of four hours in which the day is divided. Shift Employees 00:00 - 04:00 5 04:00 - 08:00 7 08:00 - 12:00 18 12:00 - 16:00 12 16:00 -

Mixed Integer Programming - Warehouse Location (Python + GLPK)

非 Y 不嫁゛ 提交于 2019-12-08 13:05:27
I am relatively new in optimizationa nd I am trying to optimize a problem (from a pas class in Coursera, 2 years ago) about Warehouse Location. The problem is, its been more than 6 hours and its still running on an instance with 100 warehouses and 1000 customers. The problem is the following. I have a set of warehouses that I can either open or not. Opening each of them has a cost s_w. Also, they all have a maximum capcity, cap_w. On the other side, there is a bunch of clients, all of them have to be connected to one (and only one) open warehouse. Each of them has a demand d_c and for each of

Identifying column and row clusters with linear programming

陌路散爱 提交于 2019-12-08 12:06:29
问题 I believe that the question Is there a good way to do this type of mining? could be solved using linear programming techniques. But I am completely new to this and do not know the best way to frame this as a minimization. Would the following approach be OK? Have a continuous variable for each row and column which is the "length" spanned by all members in that row/column Have a variable for each "point" (each black dot) that indicates whether it is a member of the row or column group Minimize