|
From: | Thomas Pfau |
Subject: | Re: [Help-glpk] Complex constraint definition |
Date: | Mon, 5 Dec 2016 06:45:58 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
Your formulation makes a multiplication of f and P. If both are variables, this would create a non linear constraint. Thus, if you want to optimize this you would need a non linear solver (in this instance a quadratic programming solver would do the job, if your constraints are not sticking to certain conditions), and glpk does not offer this functionality (for all I know). As for the binary variable: OR {j in T, i in B}: - B[k] * X <= sum{k in S} f[i,k]*P[j,k] <= B[k] * X Where X is a very large number (something that for your problem is almost the same as infinity). Now, if B[k] = 0, the lower constraint is equal to your second constraint, while the upper constraint is almost always true, due to the large X which is subtracted from the right hand side. If B[k] = 1, the lower constraint is almost certainly true because -inf <= something <= inf is certain to be true (if your X was big enough), and the upper constraint become the constraint you want. Thus you ensure, that either the one or the other (or both) constraints are respected. Hope this helps, Thomas
On 2016-12-04 18:33, Tiago Santos wrote:
The University of Aberdeen is a charity registered in Scotland, No SC013683. Tha Oilthigh Obar Dheathain na charthannas clàraichte ann an Alba, Àir. SC013683. |
[Prev in Thread] | Current Thread | [Next in Thread] |