Re: [Fwd: GLPK doubt]

2024-02-16 Thread Michael Hennebry
On Thu, 8 Feb 2024, Manuel Muñoz Márquez wrote: You have a decision problem if and only if you have decision variables. I think OP is using "decision variables" in a non-standard way: binary auxilliary variables representing choices, e.g., project p is done in month m. OP wants to reduce it

Re: [Fwd: GLPK doubt]

2024-02-12 Thread Michael Hennebry
To represent a choice of one out of 61 possibilities, you will likely need at least 6 integer variables. A single variable with range 0..61 is unlikely to produce an MILP formulation. -- Michael henne...@mail.cs.ndsu.nodak.edu "His longhand was fairly good in his youth, but as he got older it

Re: glpsol will not handle example

2023-11-12 Thread Michael Hennebry
On Sun, 12 Nov 2023, Chris Matrakidis wrote: You need --math instead of --glp. Thanks. I figured it would be a duh moment. I'd mistaken GLPK format for GMPL format. -- Michael henne...@mail.cs.ndsu.nodak.edu "I was just thinking about the life of a pumpkin. Grow up in the sun, happily

glpsol will not handle example

2023-11-12 Thread Michael Hennebry
From the glpk manual, I copied example E.1 to ex1.gmpl . glpsol did not like it: [hennebry@fedora triangle-free]$ glpsol --glp ex1.gmpl GLPSOL--GLPK LP/MIP Solver 5.0 Parameter(s) specified in the command line: --glp ex1.gmpl Reading problem data from 'ex1.gmpl'... ex1.gmpl:1: error: problem

Re: bpp plus type constrain

2023-10-11 Thread Michael Hennebry
On Wed, 11 Oct 2023, Leonardo Corato wrote: About the upper bound, I realized the bins could't have been enough, so my first code was a greedy solution: 1 bin per 1 item. Two items per bin would also work. Do you think I should write the full bpp with types, code? Maybe it could help

Re: bpp plus type constrain

2023-10-09 Thread Michael Hennebry
On Fri, 6 Oct 2023, Michael Hennebry wrote: YY{y in mouldTypes, b in 1..n, i in I: mo[i]==t} y[t, b] >= x[i, b] ; Oops. A y where a t was needed. The corrected version: YY{t in mouldTypes, b in 1..n, i in I: mo[i]==t} y[t, b] >= x[i, b] ; -- Michael henne...@mail.cs.ndsu.nod

Re: bpp plus type constrain

2023-10-06 Thread Michael Hennebry
On Fri, 6 Oct 2023, Michael Hennebry wrote: Your estimate of the number of bins necessary could be an underestimate. It does not enforce the only two types in a bin requirement. For larger problems, I think that that would be necessary. I think that all that is needed is another else if: else

Re: bpp plus type constrain

2023-10-06 Thread Michael Hennebry
Your estimate of the number of bins necessary could be an underestimate. It does not enforce the only two types in a bin requirement. For larger problems, I think that that would be necessary. -- Michael henne...@mail.cs.ndsu.nodak.edu "Occasionally irrational explanations are required" --

Re: bpp plus type constrain

2023-10-06 Thread Michael Hennebry
On Fri, 6 Oct 2023, Leonardo Corato wrote: As you can see in bin 2 and 3 there are 3 mold types, so sadly s.t. fred is not limiting to 2 I'd misunderstood. I'd thought that you want no more than two of a given type. Using an auxillary array is probably easiest: y[t, b] == 1 iff bin b has an

Re: bpp plus type constrain

2023-10-05 Thread Michael Hennebry
type must be linked to i, because each item can be of just 1 mould type. So I tried with a t[ti,i], but in this case it is not bound to bin and I need this. So I asked me if I just had to add ti as a third variable in z[i,j,ti] but in this latter I would get that i can be of each type while each i is

Re: bpp plus type constrain

2023-10-04 Thread Michael Hennebry
On Sat, 30 Sep 2023, Leonardo Corato wrote: param m := 6; param w := 1 50, 2 60, 3 30, 4 40, 5 40, 6 40; --> param t := 1 A, 2 B , 3 B, 4 C, 5 C, 6 C; param c := 100; end; I have to add a constraint so that the number of types for every bin is limited to maximum 2. Each bin can contain

Re: Nonlinear constraint in MPS format

2023-07-18 Thread Michael Hennebry
On Tue, 18 Jul 2023, Prabhu Manyem wrote: I have a non-linear model in AMPL format (which is very similar to GMPL format)... I would like to convert this to free-MPS format.. Unfortunately, glpsol is unable to convert non-linear models to MPS.. (And the free version of AMPL which I have does

Re: [Fwd: Integer solutions]

2023-01-18 Thread Michael Hennebry
On Wed, 18 Jan 2023, Andrew Makhorin wrote: Forwarded Message Date: Tue, 17 Jan 2023 20:33:01 -0800 Subject: Integer solutions To: 'Help-glpk@gnu.org' From: neillcl...@gmail.com

Re: [Fwd: Inquiry about using GNU MathProg]

2022-10-11 Thread Michael Hennebry
Traditionally, the way to represent a subset of edges has been an array of booleans. As there appear to be multiple subsets of edges, an array of arrays of edges might be needed. A path represented as a sequence of nodes is hard to exploain to a solver. -- Michael

Re: Linear Program Optimal Extreme Points

2022-10-11 Thread Michael Hennebry
My first thought on such a task is to fix all variablee, structural and otherwise, with nonzero reduced costs. Unless using exact arithmetic, that is an interesting task in itself. Even so, I'd expect it to be better than using a single linear constraint to implicitly fix them. A better tactic

Re: GLPK memory problem

2022-07-03 Thread Michael Hennebry
This is a bit late. On Wed, 4 May 2022, Domingo Alvarez Duarte wrote: You are right about the maximum index is limited by using an 32 bits integer but that doesn't mean that the memory allocation is also limited, we can have several GigaBytes of allocated memory on 64 bits platforms and still

Re: [Fwd: GLPK Linear Programming solver]

2022-06-28 Thread Michael Hennebry
From: Prabhu Manyem I get an optimal solution with the SAME objective function value, but now, some variables are NOT integers... I get a fractional solution. Why the difference between the 2 methods? How to fix this problem for the command line execution of GLPK? Since they have the same

RE: [Fwd: Discussion on GLPK]

2022-04-22 Thread Michael Hennebry
I expect that 50 million wss not quite arbitrary. If GLPK runs out of real RAM, 'twill become grindingly slow running from swap. Even with enough RAM, the time required is superlinear in problem size. On Tue, 19 Apr 2022, Meketon, Marc wrote: Typically when I see that many coefficients, it

Re: [Fwd: identifying infeasible problem without using the LP presolver]

2022-03-22 Thread Michael Hennebry
On Mon, 21 Mar 2022, Andrew Makhorin wrote: Forwarded Message From: Will Tipton To: help-glpk@gnu.org Cc: John Rice Subject: identifying infeasible problem without using the LP presolver Date: Mon, 21 Mar 2022 11:15:44 -0400 Running without the presolver usually works

Re: specially ordered sets variables in Mathprog

2022-03-15 Thread Michael Hennebry
On Tue, 15 Mar 2022, Tommaso Cucinotta wrote: I'd like to know whether Mathprog supports (or is there any plan to support) SOS (special ordered sets) variables, at least type 1. I often use mathprog and glpsol to convert MILP problems (actually, BLP mostly) for other solvers (CBC, CPLEX),

Re: [Fwd: gmpl question]

2021-12-21 Thread Michael Hennebry
On Fri, 17 Dec 2021, Andrew Makhorin wrote: Forwarded Message From: Davor Ocelic To: m...@gnu.org Subject: gmpl question Date: Fri, 17 Dec 2021 10:07:38 +0100 In the glpk example `assign.mod`, the constraint is that an agent can have only one task assigned: s.t. phi{i in

Re: [Fwd: Feeding an initial feasible solution to GLPK for MILP in CVXPy]

2021-09-10 Thread Michael Hennebry
On Thu, 9 Sep 2021, Andrew Makhorin quoted "Vasebi, Saeed [JJCUS]" : I have a MILP problem in GLPK, using CVXPy library. GLPK quickly finds a primary solution (optimal but not integer). But when GLPK switches to branch-and-cut to find an optimal integer solution, it moves very slowly. The main

Re: Constraint on a binary variable

2021-07-01 Thread Michael Hennebry
On Wed, 30 Jun 2021, Philippe Jugla wrote: In my model, I have a variable "p" which has an upper bound pmax := 2.5 and a lower bound pmin := -2.5. I would simply like to add a binary variable "sign" which takes the values : 1 if variable p is positive 0 if variable p is negative (or

Re: [Fwd: Constraint not respected]

2021-06-23 Thread Michael Hennebry
From: Gioia Lorusso Hi GLPK team,I am using GLPK and I am struggling in understanding why an upper bound constraint is not respected.  I have submitted a question on Stack Overflow but I was not able to find an answer. This is my question https://stackoverflow.com/question

Re: Solver delivers wrong answer when 2 constraints are close

2021-03-09 Thread Michael Hennebry
I suspect the best value for eps might be sqrt(DBL_EPSILON), usually 2**-26, roughly 1.6*10**-8 . If a model requires distinguishing between 1-eps and 1+eps, another model might be in order. Not a lot of generic advice can be given, that said, X >= L1, X>= L2 can always become X>=max(L1, L2).

Re: Small program that seems to loop

2020-10-16 Thread Michael Hennebry
The problem seems to be that lack of an objective function. In the transition from branch and bound to branch and bound and cut, bound lost billing: branch and cut. With an all-zero objective function, the solver cannot do bounding. Every solution will be dual-degenerate. That messes up selection

Re: GLPSOL in webassemby faster than native ?

2020-10-02 Thread Michael Hennebry
On Thu, 1 Oct 2020, Domingo Alvarez Duarte wrote: But in reality it seems that musl/qsort results in "stable sort" but actually for hashi.mod and tiling.mod the order of the "tie-breaker" results in a lot shorter solving time. Note that you have achieved consistency of result, not

Re: GLPSOL in webassemby faster than native ?

2020-10-01 Thread Michael Hennebry
On Thu, 1 Oct 2020, Heinrich Schuchardt wrote: On 9/30/20 10:02 PM, Michael Hennebry wrote: On Tue, 29 Sep 2020, Domingo Alvarez Duarte wrote: I found why GLPK in wasm was faster with "--cuts" option than native, it was due wasm using qsort from muslc that is a "stable so

Re: GLPSOL in webassemby faster than native ?

2020-09-30 Thread Michael Hennebry
" folder only "color.mod" produces a different solution (that seems to be valid anyway). Michael Hennebry wrote: Roadblocks include the toolchain and the system libraries. The math library can matter. How did you find it? -- Michael henne...@web.cs.ndsu.nodak.edu "Sorr

Re: GLPSOL in webassemby faster than native ?

2020-09-27 Thread Michael Hennebry
On Sat, 26 Sep 2020, Domingo Alvarez Duarte wrote: I did a revision of the usage of "glp_long_double" see here https://github.com/mingodad/GLPK/commit/4941d1633e52b802bdc5f102715ac3db25db5245 Revised usage of glp_long_double, now it does solve hashi.mod and tiling.mod faster with

Re: GLPSOL in webassemby faster than native ?

2020-09-27 Thread Michael Hennebry
On Fri, 25 Sep 2020, Andrew Makhorin wrote: Why do you want glpk to produce absolutely identical results on different platforms? This has no practical sense. In some cases, it does make sense, but in C89 might be difficult to achieve. If the different platforms have effectively identical

Re: GLPSOL in webassemby faster than native ?

2020-09-24 Thread Michael Hennebry
On Thu, 24 Sep 2020, Domingo Alvarez Duarte wrote: I just got glpsol with "long double" working and add binaries for anyone that want to test then here https://github.com/mingodad/GLPK/releases As noted there it'll benefit from tuning the constants in src/glpk_real.h Any

Re: GLPSOL in webassemby faster than native ?

2020-09-22 Thread Michael Hennebry
On Tue, 22 Sep 2020, Domingo Alvarez Duarte wrote: Due to the big difference in solver time how could we figure out what's is it in order to use this knowledge to improve the native solver time ? I mean what debug/verbose options could help us have a clue ? I expect the answer is none. My

Re: [Help-glpk] Operand following / has invalid type

2020-09-10 Thread Michael Hennebry
On Thu, 10 Sep 2020, Andrew Makhorin wrote: On Wed, 2020-09-09 at 18:17 -0300, yami...@cock.li wrote: I'm trying to make a program that populates a binary matrix keeping as  many blank lines as possible, e.g. Add another variable for each row in the binary matrix: z[row]>=m[row, col]

Re: Excessive copies of set elements in GMPL

2020-07-24 Thread Michael Hennebry
On Fri, 24 Jul 2020, Andrew Makhorin wrote: The issue can be illustrated by the following example: for (i = 0; i < 100; i++) for (j = 0; j < 100; j++) for (k = 0; k < 100; k++) if (j == i+1 && j == j+2) foo(i, j, k); Would you expect the C compiler to optimize this

Re: Excessive copies of set elements in GMPL

2020-07-23 Thread Michael Hennebry
items each, it will be grindly slow, assuming it finishes. If they have 10,000 items each, the set will be to big for the handler to store. Of course, done right, a set of 10,000 3-tuples should not be a problem. On 21/7/20 15:24, Michael Hennebry wrote: Are these changes supposed to deal with t

Re: Excessive copies of set elements in GMPL

2020-07-21 Thread Michael Hennebry
Are these changes supposed to deal with things like nested set iterations? -- Michael henne...@web.cs.ndsu.nodak.edu "Sorry but your password must contain an uppercase letter, a number, a haiku, a gang sign, a heiroglyph, and the blood of a virgin."

Re: GLPK and OPENMP - GLP_SIMPLEX running concurrently

2020-05-13 Thread Michael Hennebry
On Wed, 13 May 2020, Sierra Ansuas, Juan Pablo wrote: The program is returning correct values as long as the call to glp_simplex is enclosed inside an OMP CRITICAL region. This is the only part requiring a mutex. The rest of the glp_* functions are called concurrently by several threads with

Re: [Fwd: Need help in Fixing GUSEK Code]

2020-04-10 Thread Michael Hennebry
On Fri, 10 Apr 2020, Andrew Makhorin wrote: Forwarded Message From: sahani rathnasiri To: help-glpk@gnu.org Subject: Need help in Fixing GUSEK Code Date: Fri, 10 Apr 2020 19:08:39 +1000 ... I am running code in GUSEK and I need to define three indexes. I am getting a

Re: Gmpl How can I do this?

2020-03-31 Thread Michael Hennebry
On Thu, 26 Mar 2020, siirto1 wrote: I am trying to do some simple gmpl model but as a complete beginner I noticed I cannot do it. THe issue appears not to be representing a model in GMPL, but getting a model to represent. col1 col2 col3 row1 x row2 xx row3 xxx Assign

Re: Help with slow model translation

2020-02-23 Thread Michael Hennebry
On Fri, 21 Feb 2020, Greg Gruber wrote: I came across this on the wikipedia entry: " The take-home message is that nested set iterations should be avoided where possible, as these greatly expand the dimensionality and size of the model space to be processed.", and it discusses a case on the

Re: Off-by-one error when solving integer linear program

2019-12-19 Thread Michael Hennebry
On Tue, 17 Dec 2019, Michael Hennebry wrote: On Tue, 17 Dec 2019, Matthew Keeter wrote: I used GLPK to solve a problem in this year?s Advent of Code [1], and noticed that it produces a very slightly wrong answer for one of the examples. As noted elsewhere, an upper bound of a trillion

Re: Off-by-one error when solving integer linear program

2019-12-19 Thread Michael Hennebry
On Wed, 18 Dec 2019, Matthew Keeter wrote: Ah, I just realized that you only see Part 2 if you're logged in and have solved Part 1. The goal of Part 2 is to maximize production of the FUEL element, starting with 1 trillion units of ORE; that's the problem that I'm solving in my LP file. That

Re: Off-by-one error when solving integer linear program

2019-12-17 Thread Michael Hennebry
On Tue, 17 Dec 2019, Matthew Keeter wrote: I used GLPK to solve a problem in this year?s Advent of Code [1], and noticed that it produces a very slightly wrong answer for one of the examples. As noted elsewhere, an upper bound of a trillion requires more precision than GLPK will normally

Re: Off-by-one error when solving integer linear program

2019-12-17 Thread Michael Hennebry
On Tue, 17 Dec 2019, Michael Hennebry wrote: What problem are you trying to solve? If it's not this one: 71 ORE => 8 CNZTR Oops. Should have benn 171 ORE Now I get 2,210,736 which I now see is the value listed above the example I mistook for puzzle data. I infer that "

Re: Off-by-one error when solving integer linear program

2019-12-17 Thread Michael Hennebry
What problem are you trying to solve? If it's not this one: 71 ORE => 8 CNZTR 7 ZLQW, 3 BMBT, 9 XCVML, 26 XMNCP, 1 WPTQ, 2 MZWV, 1 RJRHP => 4 PLWSL 114 ORE => 4 BHXH 14 VRPVC => 6 BMBT 6 BHXH, 18 KTJDG, 12 WPTQ, 7 PLWSL, 31 FHTLT, 37 ZDVW => 1 FUEL 6 WPTQ, 2 BMBT, 8 ZLQW, 18 KTJDG, 1 XMNCP, 6

Re: next question - find some element of a set

2019-12-12 Thread Michael Hennebry
I think the answer is no: GMPL does not believe in the axiom of choice. -- Michael henne...@web.cs.ndsu.nodak.edu "Sorry but your password must contain an uppercase letter, a number, a haiku, a gang sign, a heiroglyph, and the blood of a virgin."

Re: Use more precision for bounds, GMP

2019-11-27 Thread Michael Hennebry
On Wed, 27 Nov 2019, Daniel Jour wrote: Hi, I have a problem whose bounds are values which need (really) a lot of precision. Much more than double can offer. I've handled these values so far with GNU MPFR, which can AFAIK convert to GNU GMP types which are (?) internally used by GLPK if it's

Re: Redefine parameter in Monte Carlo analysis

2019-11-12 Thread Michael Hennebry
On Tue, 12 Nov 2019, Guidati Gianfranco wrote: I am using GLPK to optimize an energy system model for Switzerland. Lots of parameters such as costs or efficiencies are defined in a dat file. Now I want to systematically vary some of these parameters using a Monte Carlo approach. The easiest

Re: [Help-glpk] ERROR = basis matrix is singular to working precision

2018-09-09 Thread Michael Hennebry
On Thu, 30 Aug 2018, Garcia, Christophe wrote: I have a problem understanding GLPK behavior with my model when I get this error message : GLPK Simplex Optimizer, v4.65 5157 rows, 5980 columns, 892762 non-zeros 0: obj = 0.0e+000 inf = 2.300e+001 (23) Perturbing LP to avoid

Re: [Help-glpk] TRYING TO GET A NON-OPTMIAL SOLUTION OF A MIP MODEL.

2018-06-14 Thread Michael Hennebry
On Wed, 13 Jun 2018, Joshua Friedman wrote: The technique you described of relaxing all but 1-2 days and fixing the integer part sounds interesting. Are there any published works implenting the technique. I am also working on a timetabling/student enrollment problem at my college. Probably,

Re: [Help-glpk] Slow performance on "Select minimum" task

2018-06-07 Thread Michael Hennebry
On Wed, 6 Jun 2018, Jan van Rijn wrote: The way I interpreted your solution was that 'at least one y-value per column will be >= 1'. I don't see exactly which constraint makes sure that there will be exactly one y-value per column 1 (which, again, we don't need if all values in M are >= 0).

Re: [Help-glpk] Slow performance on "Select minimum" task

2018-06-06 Thread Michael Hennebry
On Tue, 5 Jun 2018, Jan van Rijn wrote: 2018-06-05 23:39 GMT-04:00 Michael Hennebry : On Tue, 5 Jun 2018, Jan van Rijn wrote: - M[r,c] should contain positive values (which guarantees that y[r,c] == 1 iff x[r] - SUM x[s] == 1) I'm pretty sure that is not necessary. the y's depend only

Re: [Help-glpk] Slow performance on "Select minimum" task

2018-06-05 Thread Michael Hennebry
On Tue, 5 Jun 2018, Jan van Rijn wrote: I need to add two things: - It is my conjecture that there should be an additional constraint, i.e., y[r,c] > 0 (Otherwise non-selected rows could participate towards a lower score) Correct, - M[r,c] should contain positive values (which guarantees

Re: [Help-glpk] Slow performance on "Select minimum" task

2018-06-05 Thread Michael Hennebry
On Tue, 29 May 2018, Jan van Rijn wrote: Yes, it is indeed a matrix of floats. 2018-05-29 15:45 GMT-04:00 Kevin Martin : I have re-read your problem and I may have misinterpreted it. I thought your matrix was binary, as in each element was in {0,1}, the sum condition was supposed to be

Re: [Help-glpk] How to linearize a weighted average with a decision variable?

2018-04-25 Thread Michael Hennebry
On Tue, 24 Apr 2018, Matt wrote: *max sum(i) { enabled[i] * value[i] * weight[i] } / sum(i) { enabled[i] * weight[i] }* *s.t. sum (i) enabled[i] = M* - *value* is a vector of decimal numbers in [0, 1] (precomputed) - *weight* is a vector of decimal numbers in [0, 1] (precomputed) - *enabled*

Re: [Help-glpk] [Fwd: Antonio Carlos Moretti <moretti+dated+1521124706.e2c...@ime.unicamp.br>]

2018-03-11 Thread Michael Hennebry
On Sun, 11 Mar 2018, Andrew Makhorin wrote: Forwarded Message From: Antonio Carlos Moretti To: help-glpk@gnu.org Subject: Date: Sat, 10 Mar 2018 11:38:24 -0300 Hello, Is there any way to call glpk from a fortran program?

Re: [Help-glpk] [Fwd: Re: [Fwd: graceful tree labeling example]]

2017-10-06 Thread Michael Hennebry
On Thu, 5 Oct 2017, Heinrich Schuchardt wrote: your model uses more integers than needed. This typically makes problems harder to solve. You just need the binaries gt, vx, and ex. All other variables can be float. The constraints enforce that they will be integer. Of course not labeling them

Re: [Help-glpk] MathProg, glpk and C language

2017-10-04 Thread Michael Hennebry
On Wed, 4 Oct 2017, Lyndon D'Arcy wrote: Below is some example code for reading MathProg using my extension: int status; char *buf = "var x1;\ var x2;\ maximize obj: 0.6 * x1 + 0.5 * x2;\ s.t. c1: x1 + 2 * x2 <= 1;\ s.t. c2: 3 * x1 + x2 <= 2;\ end;"; glp_prob *lp; glp_tran *tran =

Re: [Help-glpk] MathProg, glpk and C language

2017-10-04 Thread Michael Hennebry
On Wed, 4 Oct 2017, john tass wrote: One possible way I suppose that is to use the API's of Glpk inside that function, using #include "glpk.h". But this way has the following drawback: in order to declare a structural variable of my model, say X1, I have to write something like

Re: [Help-glpk] non-official updated version of glpk (4.63 pre-release)

2017-08-09 Thread Michael Hennebry
< On Mon, 2017-08-07 at 10:18 -0500, Michael Hennebry wrote: I get a zero-byte document. Sorry. I don't know why that url doesn't work now. Try http://www.ia.pw.edu.pl/~wogrycza/publikacje/artykuly/mymps87.pdf It should work. It does. -- Michael henne...@web.cs.ndsu.nodak.edu &qu

Re: [Help-glpk] non-official updated version of glpk (4.63 pre-release)

2017-08-07 Thread Michael Hennebry
On Sun, 6 Aug 2017, Andrew Makhorin wrote: On Sun, 2017-08-06 at 12:13 +0300, Andrew Makhorin wrote: Interesting to note that exactly the same picture (cycling on two bases near the optimum on solving LP with MPSX/370) is described in the paper: W.Ogryczak, On practical stopping rules for

Re: [Help-glpk] [Fwd: Re: Objective function defined with max, min.]

2017-01-06 Thread Michael Hennebry
On Fri, 6 Jan 2017, Andrew Makhorin wrote: Forwarded Message From: Alexey Karakulov <ankaraku...@gmail.com> To: Michael Hennebry <henne...@web.cs.ndsu.nodak.edu> Cc: Andrew Makhorin <m...@gnu.org>, help-glpk@gnu.org Subject: Re: [Help-glpk] Objective functio

Re: [Help-glpk] Objective function defined with max, min.

2017-01-05 Thread Michael Hennebry
On Thu, 5 Jan 2017, Michael Hennebry wrote: The objective function includes crop(s) = median(0, s, 1) where the range of s includes both negative values and values > 1 . The set defined is not convex and so cannot be defined purely with linear constraints. One can get around the n

Re: [Help-glpk] Objective function defined with max, min.

2017-01-05 Thread Michael Hennebry
The objective function includes crop(s) = median(0, s, 1) where the range of s includes both negative values and values > 1 . The set defined is not convex and so cannot be defined purely with linear constraints. One can get around the need for a binary by using optimality. Add nonnegative

Re: [Help-glpk] Formulate a large scale linear programing model by reducing the number of similar constraints and keeping them all satisfied

2016-09-07 Thread Michael Hennebry
On Tue, 6 Sep 2016, Michael Hennebry wrote: Let us name the constraints. First, I am unclear as to what the exact model is. This is what I got from yur first post: The i SUMs run from 1 to N. The j SUMs run from 1 to L. Max SUM P_i*X_i i Constraint A: T + SUM K_j <= SU

Re: [Help-glpk] Formulate a large scale linear programing model by reducing the number of similar constraints and keeping them all satisfied

2016-09-06 Thread Michael Hennebry
On Tue, 6 Sep 2016, usa usa wrote: * A: "an exponential number of constraints." will cause "run out of memory" error ? * No. The idea would be that the constraints could be generated from a formula. Finding the most violated constraint would mean finding the formula input that generates

Re: [Help-glpk] Formulate a large scale linear programing model by reducing the number of similar constraints and keeping them all satisfied

2016-09-06 Thread Michael Hennebry
Let us name the constraints. On Sun, 4 Sep 2016, usa usa wrote: On Fri, Sep 2, 2016 at 3:36 PM, Michael Hennebry < henne...@web.cs.ndsu.nodak.edu> wrote: First, I am unclear as to what the exact model is. This is what I got from yur first post: The i SUMs run from 1 to N. The j SU

Re: [Help-glpk] Formulate a large scale linear programing model by reducing the number of similar constraints and keeping them all satisfied

2016-09-01 Thread Michael Hennebry
On Wed, 31 Aug 2016, usa usa wrote: The problem is that the number of constraints of decVarK_i for i=1 to L and L can be very large, e.g. 100,. I think that the given constraints were not what you really intended. It means that it will have 100,000 constraints in the LP, which I want

Re: [Help-glpk] quadruple precision

2016-06-04 Thread Michael Hennebry
On Wed, 1 Jun 2016, zephod wrote: Does GLPK support quadruple precision for floating point operations? If yes, how to enable it? If not, could it be achieved by textually replacing the types in the whole source? Kind Regards, Placek GLPK has double built in. I expect a global change to

Re: [Help-glpk] MIP problems

2016-03-07 Thread Michael Hennebry
On Mon, 7 Mar 2016, ΤΑΣΣΟΠΟΥΛΟΣ ΙΩΑΝΝΗΣ wrote: I have been aware that MIP problems are NP-Complete or even NP-Hard. Does any one know a reference (perhaps a published paper) in which it is *proven* that MIP problems are NP- Complete or NP- Hard? MILP can solve satisfiability, the seminal

Re: [Help-glpk] [Fwd: glp_intopt conversion of solutions via callback]

2016-01-18 Thread Michael Hennebry
On Sat, 16 Jan 2016, Chris Matrakidis wrote: On 16 January 2016 at 17:17, Sascha Brügmann <sascha.bruegm...@gmail.com> wrote: Michael Hennebry web.cs.ndsu.nodak.edu> writes: Perhaps it would be a good idea to make the presolving and scaling transformation available to the use

Re: [Help-glpk] [Fwd: glp_intopt conversion of solutions via callback]

2016-01-15 Thread Michael Hennebry
On Fri, 15 Jan 2016, Heinrich Schuchardt wrote: Looking at the code in src/glpkapi09.c and glpapi13.c the documentation is wrong. The problem accessible in the MIP callback is the presolved and scaled problem. So if you have a heuristic solution expressed in your original variables you should

Re: [Help-glpk] [Fwd: Help]

2016-01-14 Thread Michael Hennebry
On Thu, 14 Jan 2016, L. Felipe Castañeda G. wrote: CHd {(i,t) in GH: t-1 != 0}:V[i,t] = V[i,t-1] + g[i,t]*r[i,t] - S[i,t] - g[i,t]*k[i,t]; But I need to set an initial value for V[i,t]. I mean, I want to set V[i,1] = 60. How can I do that? You mean fred { (i,t)

Re: [Help-glpk] Improving the execution time of the MILP program

2016-01-07 Thread Michael Hennebry
On Thu, 7 Jan 2016, esma mehiaoui wrote: Is it true that the expression of the logical constraint (a and b) with the following constraints { x <=a ; x <= b ; a+b <= x+1} is less time consuming then its expression with the only constraint 0 <= a + b – 2x <= 1 ?  It took me a while to suspect

Re: [Help-glpk] build and solve large scale linear programming model by GLPK

2015-12-19 Thread Michael Hennebry
On Thu, 17 Dec 2015, usa usa wrote: I need to build and solve large scale linear programming model by GLPK (4.57) from C# (4.0) VS2013 oin win 7 with 8GB memory. The model size can be as large as 1 million decision variables and 1 million constraints. Are there some limits on this kind of

Re: [Help-glpk] Computation on outputs on outputs

2015-12-14 Thread Michael Hennebry
On Sun, 13 Dec 2015, Shaghayegh Mokarami wrote: Hi Dear All I solved two separated LP problems at the same time, using .awk in my mac. the optimal solution of two LPs are saved in 2 files which are attached here, Now I need to compute sum {(i,j) in E} tau_scenario(i,j)*x_nominal_opt(i,j)

Re: [Help-glpk] the theoretic formula about the integrality gap for MILP and 0-1 knapsack integer programing model

2015-12-04 Thread Michael Hennebry
GLPK uses |best_found - best_bound|/(|best_found| + DBL_EPSILON) . A better formula would be to get rid of the absolute values and replace DBL_EPSILON with -lp_obj, the negative of the LP relaxation's objective value. The man that matters disagrees and is more interested in copying CLPEX. My

Re: [Help-glpk] Problem has no feasible solution.

2015-11-18 Thread Michael Hennebry
On Wed, 18 Nov 2015, Fernando Garcia wrote: Hello everyone, I am having some problems when solving a problem because it is not feasible. I have checked the code hundreds times and I still dont know where can be the unfeasibility. Is there any routine in the glpk packet in c++ to show in which

Re: [Help-glpk] Non linear constraint

2015-11-09 Thread Michael Hennebry
On Sun, 8 Nov 2015, esma mehiaoui wrote: I just need to be sure that the no linear following constraint cannot be expressed in a MIP program or linearised. Prod{i in 1..4} sum {j in 1..5} V[i,j] * C[i] * R[i] Ps: V is a boolean variable C is a boolean parameter R is a real

Re: [Help-glpk] Non linear constraint

2015-11-09 Thread Michael Hennebry
Other constraints might be obtained from formulas for minimizing the difference between a product of variables and a linear combination of same. min PROD x[j] - SUM c[k]*x[k] j in 1..n k in 1..n set the derivative with respect to x[L] to 0: PROD x[j] - c[L] = 0for L in 1..n

Re: [Help-glpk] expressing a constraint depending on a boolean variable

2015-11-04 Thread Michael Hennebry
On Wed, 4 Nov 2015, Heinrich Schuchardt wrote: Hello Esma,   please, see https://en.wikibooks.org/wiki/GLPK/Modeling_tips#Big_M Be sure take the advice to use the smallest M that you know works. Done right, you will get the convex hull of allowed solutions. -- Michael

Re: [Help-glpk] glp_mip_col_val is returning negative zero

2015-05-04 Thread Michael Hennebry
On Fri, 1 May 2015, Andrew Makhorin wrote: On Fri, 2015-05-01 at 15:17 +, Agostina Kodelia wrote: Hi! I'm solving a very simple postman travelling problem with the glp_intopt method. When I retrieved the column value with glp_mip_col_val, it returns a negative zero. The zero is alright,

Re: [Help-glpk] [Fwd: GLPK enhancement]

2015-04-27 Thread Michael Hennebry
On Fri, 20 Mar 2015, Erik Quaeghebeur wrote: Heinrich Schuchardt: On Linux you can create a FIFO with mkfifo and pass the path to the GLPK. On Windows you can create a named pipe and use its path (CreateNamedPipe). Thanks for the idea. Sadly enough for my needs, Python does not provide a

Re: [Help-glpk] Modeling exclusive OR in Mathprog language

2015-04-02 Thread Michael Hennebry
I'm a bit fuzzy on what you want. If you want to express x=a XOR b, where a, b and x are binaries, you just need four constraints, the constraints that cut off 001, 010, 100 and 111. That will give you the convex hull, which is as good as can be done. n To express, x=XOR a[j] ,

Re: [Help-glpk] Modelling constaints

2015-03-30 Thread Michael Hennebry
On Thu, 26 Mar 2015, john tass wrote: Let U, K in {-6, .. , 6} integers Let A in {0, 1} binary Let D in {0, 1} binary What I want to do is to model the condition: D = 1, iff (U 0 OR K 0) AND A = 1 Otherwise, D should equal 0. I can not figure out how to model this situation. Can any one give

Re: [Help-glpk] Name assignments to a large number of variables

2015-03-23 Thread Michael Hennebry
On Sun, 22 Mar 2015, john tass wrote: I do not care whether the problem is going to be solved in a reasonable amount of time or not. I can wait for a long time. The only thing I do care is to get an answer to my question. So, if you can help me I would appreciate it. The unreasonable time

Re: [Help-glpk] csv_driver:unable to create ....csv - Permission denied

2015-01-06 Thread Michael Hennebry
On Tue, 6 Jan 2015, Martin Albrecht wrote: I am running a GLPK model that is sequentially started from a frame program in Java. In this contex, what is a frame program? What OS are you running? Unfortunately, I get sometime error when opening the .csv files. Here is an example: /

Re: [Help-glpk] Variable Assigned to itself

2014-09-14 Thread Michael Hennebry
On Fri, 12 Sep 2014, Nigel Galloway wrote: I think you will find that this error is being reported by Codan, a truncation of Code Analysis I presume. This is an Eclipse Tool and not part of the compiler tool chain. I think you'll find a separate output window in Eclipse with the output from the

Re: [Help-glpk] Variable Assigned to itself

2014-09-11 Thread Michael Hennebry
On Thu, 11 Sep 2014, Norman Jessup wrote: I'm trying to compile the glpk source using the Eclipse IDE (I'm not terribly familiar with either). One module, glpini01.c, is generating multiple errors of the form: Assignment to istelf 't = t' On looking at the code this does seem to be the

Re: [Help-glpk] Objective value issue

2014-07-11 Thread Michael Hennebry
On Fri, 11 Jul 2014, Mattia Buccarella wrote: When I use glpsol to solve my model (written in MathProg, with separate data input file), all the variables are configured properly as I expect (I am referring to a dummy input I use to verify the correctness of my model). Nevertheless, the value of

Re: [Help-glpk] Interior point method and MIPs

2014-07-02 Thread Michael Hennebry
On Tue, 1 Jul 2014, Andrew MacFie wrote: I understand that for MIPs, GLPK uses branch-and-bound and only offers the simplex method. I would be interested in knowing why the interior point method is only allowed for LPs, not MIPs. Branching is rather hard to do with interior point methods. --

Re: [Help-glpk] Linking errors when using cfg.h in a MacOs X

2014-06-19 Thread Michael Hennebry
On Wed, 18 Jun 2014, Jose L Walteros wrote: In the Linux machine I don't have access to root so, when I installed GLPK, I configured it as: ./configure --disable-shared --prefix=/home/jwalteros/GLPK/GLPK-4.54-ins/ That why it linked. Exported symbols are a dynamic library thing. With your

Re: [Help-glpk] Linking errors when using cfg.h in a MacOs X

2014-06-18 Thread Michael Hennebry
On Wed, 18 Jun 2014, Heinrich Schuchardt wrote: So I wonder how you made you program compile on your Linux machine. Did you manipulate the list of exported symbols? I think that exporting non-local symbols is the default on Linux. Occasionally I see threads about making dynamic libraries work

Re: [Help-glpk] Solving linear/nonlinear systems of equations via glpk

2014-04-28 Thread Michael Hennebry
On Tue, 29 Apr 2014, Fatih Gürdal wrote: In an academic paper it is claimed finding all solutions to non linear systems of equations by using glpk.There, dual simplex method is said to use. For the general case, color me dubious. Some problem classes are inherently unsolvable. My question

Re: [Help-glpk] Applying a threshold to the solution using GMPL?

2013-11-11 Thread Michael Hennebry
On Sun, 10 Nov 2013, Meketon, Marc wrote: Instead of Awk, there is another way of doing this which I often find is easier because all the calculations stay within GMPL: I expect that your GMP will work as advertised, but that what OP wants is a bit more compilcated than that. What I expect

Re: [Help-glpk] Applying a threshold to the solution using GMPL?

2013-11-11 Thread Michael Hennebry
On Mon, 11 Nov 2013, Reginald Beardsley wrote: Marc's suggestion fits very nicely with what I'm trying to do at the moment. I sometimes get terms which constitute much less than 1% of the total result. Those are what I want to drop. Doing so requires recalculating the other terms to

Re: [Help-glpk] Applying a threshold to the solution using GMPL?

2013-11-10 Thread Michael Hennebry
On Sat, 9 Nov 2013, Reginald Beardsley wrote: I've been hoping it can be done with binary variables in GMPL as I'm still trying to refine the problem statement. I'd like to be confident it's a good choice before coding it. I'd also like to improve my grasp of expressing problems in GMPL.

Re: [Help-glpk] Applying a threshold to the solution using GMPL?

2013-11-09 Thread Michael Hennebry
On Sat, 9 Nov 2013, Reginald Beardsley wrote: I'm solving Ax=b using an L1 norm. In some cases I get a number of relatively small values in x that I would like to suppress based on the fraction of the result that they contribute so as to make the solution more sparse. From this

Re: [Help-glpk] [Fwd: I: Modelling binary variable]

2013-10-08 Thread Michael Hennebry
On Tue, 8 Oct 2013, Meketon, Marc wrote: Are you sure that Z = Q[2]-Q[1]? For the case where x[1]=1, x[2]=0, x[3]=0, we have Q[1]=0, Q[2]=0, Q[3]=1, and then Q[3]-Q[2] = 1 which is the correct answer. Z = Q[1]-Q[2] he has Q sorted in non-ascending order. 00 no ones 0-0=0 10 one one 1-0=1

  1   2   3   >