help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Even integer numbers


From: ANTONIO MORETTI
Subject: Re: [Help-glpk] Even integer numbers
Date: Wed, 01 Oct 2014 11:18:37 -0300
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Zvonko,
you may use binary variables to solve this problem, but, x must have a upper bound.
For example, suppose x <= 10 and x \in \{2,4,6,8,10 \}, then define a binary variable

Y_j = 1 , if x = 2*j  or 0,  otherwise for j = 1,2,3,4,5

Therefore, x = 2*y_1 + 4*y_2 + 6*y_3 + 8*y_4 + 10*y_5
                  y_1 + y_2 + y_3 + y_4 + y_5 = 1

I hope this helps.

Antonio

Em 01/10/2014 08:31, Zvonko Bregar escreveu:

Hi everybody,

Does there exist an _expression_

That forces

An integer variable X \in { 1, 2, 3, …}

To take the values only from even numbers

X \in {2, 4, 6, …}

Regards,

--Zvonko


OPOZORILO: To elektronsko sporočilo in vse njegove morebitne priloge lahko vsebujejo zaupne in/ali privilegirane informacije, ki so last Elektroinštituta Milan Vidmar in so namenjene izključno naslovniku. Če ste sporočilo prejeli pomotoma zaradi napake v naslovu ali pri prenosu sporočila, Vas prosimo, da nas o tem obvestite s povratno pošto. V tem primeru vsebine prejetega sporočila ne smete uporabiti, kopirati, tiskati, objaviti ali distribuirati, ampak ga morate takoj uničiti.

DISCLAIMER: This e-mail is for the intended recipient only. It contains proprietary information some or all of which may be legally privileged. If you received this e-mail by mistake please notify us by replying to this e-mail. Consequently, the contents of this e-mail must be deleted and not be used, copied, printed, disclosed or distributed.
 



_______________________________________________
Help-glpk mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-glpk




Este email está limpo de vírus e malwares porque a proteção do avast! Antivírus está ativa.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]