Dear Paolo, well, I don't know, what You exactly want, but to show the idea:
s.t. Constraint_a: x <= a + M * y; This says that (x > a) => (y = 1). (M is a big number) the same can go for b: s.t. Constraint_b: x >= b - M * y; So (x < b) => (y=1); Basically, we managed to do, that (a < x < b) => (y=1); What we haven't done yet is : !(a < x < b) => (y=0) And - somebody please correct me if I'm wrong - you can't not do that. (If You could, and add the constraint y=1, and the objective: maximize/minimize x, then there would be no solution, but the objective would still be bounded, which can not happen for an LP / MILP.) Best regards, Mate On 08/08/2012 05:53 PM, Paolo Tofoni wrote: > Hi, > I'm working on scheduling model which consider the day-off in the allocation. > I need your help because I need to model a constraint as the following: > > var x, y; > param a,b; > > if (x > param a) and (x < param b) then > y = 1; > else > y = 0; > end if; > > do you think is feasible? > Thanks in advance for your help. > > _______________________________________________ > Help-glpk mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-glpk >
<<attachment: hegyhati.vcf>>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
