Re: [Fwd: constraint with two possible values]

Andrew Makhorin <[email protected]>
Newsgroups gmane.comp.gnu.glpk
Message-ID <1510321738.3626.2.camel@corvax>
> Hi, I am new with glpk and I am having trouble with a certain
> constraint. Basically I need certain sum to either be a precise number
> (given by a parameter) or equal to 0. Been trying different things for a
> while with no success, this was my last attempt.
> 
> s.t. tiempoProyecto {a in A}: ((sum{m in M,t in T} x[a,m,t]/personal[a])
> >= dedicacion[a]) or ((sum{m in M,t in T} x[a,m,t]/personal[a]) = 0);
> 
> 
> x declaration is:
> var x{a in A,m in M, t in T} binary >= 0;
> 
> 
> all sets and params are declared in a data file.
> 
> 
> That line gives me the error:
> parte2.glpk:30: operand preceding >= has invalid type
> Context: ...um { m in M , t in T } x [ a , m , t ] / personal [ a ] ) >=
> MathProg model processing error
> 
> 
> Any clue of how should I face this problem?
> thanks in advance
> 

You may model that condition as follows:

param p;
var z, binary;
s.t. ... sum ... = p * z;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.