Your formulation makes a multiplication of f and P.
Thus this is only a linear constraint if only one of f and P are variables.
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:
If I'm not mistaken, the idea would be to add a binary variable in a way that
you add it to both constraints.
{j in T, i in B}: sum{k in S} f[i,k]*P[j,k] >=Min[j] - (1-B[k]) * X
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:
Hello Heinrich,
Thank you for the answer.
But I'm new in using GLPK and I didn't get completely your point here.
How can I use a binary variable to help there?
And what do you mean by "only one of f, P can be a variable"?.
Thank you,
Tiago
On Sat, Dec 3, 2016 at 11:14 PM, Heinrich Schuchardt
<[email protected]<mailto:[email protected]>> wrote:
Hello Tiago,
you will need to add a binary variable.
Only one of f, P can be a variable.
Regards
Heinrich
Am 03.12.16, 22:42, Tiago Santos
<[email protected]<mailto:[email protected]>> schrieb:
Hello,
I'm trying to model a constraint and that is being so complex to me.
Is there any way to model a constraint like the follwing in GLPK?
I need to restrict that the sum must be equal or greater than Min[j] otherwise
0.
{j in T, i in B}: sum{k in S} f[i,k]*P[j,k] >=Min[j]
OR
{j in T, i in B}: sum{k in S} f[i,k]*P[j,k] =0
Thank you,
Tiago
_______________________________________________ Help-glpk mailing list
[email protected]<mailto:[email protected]>
https://lists.gnu.org/mailman/listinfo/help-glpk
_______________________________________________
Help-glpk mailing list
[email protected]<mailto:[email protected]>
https://lists.gnu.org/mailman/listinfo/help-glpk
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.
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk