[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-glpk] Odd/even variable constraint?

**From**: |
Axel Simon |

**Subject**: |
Re: [Help-glpk] Odd/even variable constraint? |

**Date**: |
Wed, 02 Apr 2008 16:05:55 +0200 |

On Wed, 2008-04-02 at 18:01 +0400, Rory Winston wrote:
>* Hi*
>* *
>* Does anyone know how I can express a constraint that a variable must be odd*
>* or even, i.e. in the form 2*n-1 or 2*n + 1? I am trying to write a mathprog*
>* script to find pythagorean triples subject to certain constraints, and i*
>* would like to express some conditions on my variables, namely, that one must*
>* be an odd integer, and the other must be an even integer.*
I suppose the simplest way is to add 2*y=n to the constraint system (if
n is supposed to be even) and solve the problem as integer problem.
Axel.