glpk

PuLP very slow when adding many constraints

牧云@^-^@ 提交于 2019-12-30 03:27:04
问题 I'm trying to use PuLP, but it is taking 50 seconds to add 4000 constraints (with 67 variables). Solving the problem only takes a fraction of a second. We want to use PuLP to easily test several solvers on a large set of problems. Should it be taking PuLP this long? Using PyGLPK directly takes only a fraction of second including both setup and solving, so I hope not. What can I do to improve the efficiency of this step in PuLP? Update My constraints matrix is very sparse, and I was able to

Meaning of “Time” in pyomo's results.json

只愿长相守 提交于 2019-12-24 06:58:10
问题 I am solving an ILP with Pyomo and GLPK. Running on the command line, pyomo outputs the time in seconds it takes for each step. Now, when I look into the results.json file that is output, I get a section that looks like this: "Solver": [ { "Error rc": 0, "Statistics": { "Branch and bound": { "Number of bounded subproblems": "13", "Number of created subproblems": "13" } }, "Status": "ok", "Termination condition": "optimal", "Time": 2.9578073024749756 } ] What is the meaning of "Time" in this

Unable to compile pyglpk on OSX 10.8 / Ubuntu 14.x

允我心安 提交于 2019-12-23 07:49:53
问题 I am struggling to compile PyGLPK on OSX 10.8. I have installed glpk and gmp through homebrew. I have verified that the following files are all present in /usr/local/include gmp.h gmpxx.h glpk.h Yet I still get the following error. python setup.py build running build running build_ext building 'glpk' extension clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -Isrc -I/usr

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

旧时模样 提交于 2019-12-23 03:33:02
问题 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

How do you install glpk-solver along with pyomo in Winpython

吃可爱长大的小学妹 提交于 2019-12-19 04:03:15
问题 I want to use "pyomo" for my studies. I installed pyomo via easy_install coopr install instructions, Pyomo needs a solver to work so I wanted to install the (GNU Linear Programming Kit) glpk_webpage, pyomo seems to be installed just right because I can import it in spyder (i am using WinPython-64bit-2.7.5.3) with import coopr.pyomo However, I cannot do anything without glpk I guess... I downloaded glpk-4.52 (latest version) from the ftp server but I do not know what to do with the batch files

Input/output in GLPK for Java

流过昼夜 提交于 2019-12-13 16:50:09
问题 I find a lot of GLPK for Java examples about how to specify the model (problem/constraints) to the solver and read parameters from a data file, but very little about programmatic parameter input/output. In my case I need to submit values (array of weights and values) to a knapsack problem programmatically and postprocess the solution as well (perform addtional numeric checks on the solution found) in order to decide whether to proceed or not. Think of the equivalent of reading a param: line

LP relaxation in SCIP

梦想的初衷 提交于 2019-12-11 08:28:59
问题 I'm trying to solve a MIP using the SCIP command line, with the problem input in CPLEX LP format. However, due to large number of variables, the optimization is taking a lot of time. Is there some way to compute the LP Relaxtion solution of the same MIP in SCIP? Or any other way to get an approximate, somewhat suboptimal solution? 回答1: If you are just interested in the LP relaxation you should try to use SoPlex to solve your problem. If you want to limit the computation time in SCIP you can

glpk.LPX backward compatiblity?

心不动则不痛 提交于 2019-12-11 03:26:15
问题 Newer versions of glpk do not have the LPX api, which is required by older packages. How can I use an older package (like COBRA) with the newer versions of glpk ? Note that COBRA is available for MATLAB and Python. Both require glpk and the LPX api, and I would like to use both. 回答1: Ideally you should switch to a version that uses the new API. It has been around for years. If that is no option, then the following entry in the ChangeLog to V4.53 points in the right direction * examples/oldapi

Linear programming in Python : 'module' object has no attribute 'LPX'

放肆的年华 提交于 2019-12-11 02:56:11
问题 For a Django website, I used Thomas Finley's glpk Python library (http://tfinley.net/software/pyglpk/glpk.html#LPX) to solve an integer linear program. I followed his tutorial (see "simple example" in http://tfinley.net/software/pyglpk/discussion.html or at the bottom of the post) to build my instance, but after an update of my system (and, I assume, of python-glpk) I now get this error: ----> 1 lp = glpk.LPX() AttributeError: 'module' object has no attribute 'LPX' If you want to reproduce

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.