glpk

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.,

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

Mixed Integer Programming - Warehouse Location (Python + GLPK)

六月ゝ 毕业季﹏ 提交于 2019-12-08 07:57:55
问题 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

Python: Why am I encountering this error with importing glpk on MacOSX?

本秂侑毒 提交于 2019-12-04 12:14:16
I followed these steps and got my first error: wget http://www.dcc.fc.up.pt/~jpp/code/python-glpk/python-glpk_0.4.43.orig.tar.gz tar -xzf python-glpk_0.4.43.orig.tar.gz cd python-glpk-0.4.43/src/ sudo make install I got this error: make -C swig all make[1]: pyversions: Command not found gcc -Wall -c -fPIC glpkpi_wrap.c -DHAVE_CONFIG_H -I/usr/include/ -I/usr/lib//config glpkpi_wrap.c:130:11: fatal error: 'Python.h' file not found # include <Python.h> ^ 1 error generated. make[1]: *** [glpkpi_wrap.o] Error 1 make: *** [all] Error 2 Then I linked to the python by changing the Python version or

What happens when I modified the RHS of a constraint (GLPK)?

亡梦爱人 提交于 2019-12-01 13:20:58
I am increasing the RHS of less-than-or-equal constraint of a MIP problem with GLPK. However, sometimes, after re-optimizing, GLPK cannot find any feasible solution within the time limit. So I am guessing it does not check if the previous solution was feasible. Does anybody have any experience with that? Or can point me to a document that is not the source code itself? Also, I would like to know what is the workflow after I add a constraint for any other solver (e.g. Gurobi, Cplex, SCIP, CBC) so any information is helpful. Cheers! After changing something in the model, all solving information

What happens when I modified the RHS of a constraint (GLPK)?

社会主义新天地 提交于 2019-12-01 11:49:25
问题 I am increasing the RHS of less-than-or-equal constraint of a MIP problem with GLPK. However, sometimes, after re-optimizing, GLPK cannot find any feasible solution within the time limit. So I am guessing it does not check if the previous solution was feasible. Does anybody have any experience with that? Or can point me to a document that is not the source code itself? Also, I would like to know what is the workflow after I add a constraint for any other solver (e.g. Gurobi, Cplex, SCIP, CBC)

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

余生颓废 提交于 2019-12-01 00:09:56
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 I found in the "w64"-folder I should use(?) according to " Installing GLPK " I do not have Visual

PuLP very slow when adding many constraints

好久不见. 提交于 2019-11-30 14:43:28
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 reduce the setup time to 4 or 5 seconds for this particular problem by only including nonzero

if condition in ampl

你说的曾经没有我的故事 提交于 2019-11-29 18:00:28
I am new in ampl and I want to use if condition in ampl with the following information: I have a binary variable X[p,r], where {p in P, r in R}. Now I want to make a new constraint such that the variable R[p,r] is used where X[p,r]=0. I do not know how I can write it or even if the ampl can handle it or not, I tried the following constraint but they did not work: s.t. a1{r in R, p in P and X[p,r]=0}: s.t. a2{r in R p in P and X[p,r]=0}; s.t. a2{r in R ,p in P, and X[p,r]=0}; s.t. a2{r in R, p in P: and X[p,r]=0}; You cannot include a decision variable in the "for all" part of the constraint

GLPK: No such file or directory error when trying to install R package

流过昼夜 提交于 2019-11-29 06:53:25
I am trying to install sparkTable in R 3.1.0 which depends on Rglpk . I manually installed GPLK on the system and added the libs folder to LD_LIBRARY_PATH before going into R for the install.packages("sparkTable") procedure. I get this error during the installation process. Any ideas? * installing *source* package ‘Rglpk’ ... ** package ‘Rglpk’ successfully unpacked and MD5 sums checked ** libs /bin/sh: line 0: cd: GLPK: No such file or directory make: *** [GLPK.ts] Error 1 ERROR: compilation failed for package ‘Rglpk’ * removing ‘/opt/R/R-3.1.0/lib64/R/library/Rglpk’ ERROR: dependency ‘Rglpk’