is there a way using "logical or  " between each constraint which are constructed by forall stament. for example:
x[1]=1 
x[2]=1 
x[3]=1 
x[4]=1 
how can i write these logical constraints by using forall?
forall(i in 1..4)x[i]==1 doesn't works...
Topic

Re: using "logical or  " between each constraint
20130114T09:56:29ZThis is the accepted answer. This is the accepted answer.You could use the sum operator to do specify that the sum of variables x in 1..4 that have value 1 should be at least one:
sum(i in 1..4) (x[i] == 1) >= 1
Since (x[i] == 1) is a boolean variable in 0..1 (0 meaning false, and 1 meaning true), this sum has an equivalent semantic to the disjunction of your example.
Regards,
StefanoUpdated on 20140326T05:51:18Z at 20140326T05:51:18Z by ironman 
Re: using "logical or  " between each constraint
20130116T13:31:02ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20130114T09:56:29Z
You could use the sum operator to do specify that the sum of variables x in 1..4 that have value 1 should be at least one:
<pre class="java dw" dataeditorlang="java" datapbcklang="java" dir="ltr">sum(i in 1..4) (x[i] == 1) >= 1 </pre>
Since (x[i] == 1) is a boolean variable in 0..1 (0 meaning false, and 1 meaning true), this sum has an equivalent semantic to the disjunction of your example.
Regards,
Stefano
using CP; ... or(i in 1..4) x[i]==1
And using CPLEX as the engine, the formulation of the previous post is valid. Note that if your variables are boolean, you have a native linear simplification :
sum(i in 1..4) x[i] >=1
DavidUpdated on 20140326T05:51:13Z at 20140326T05:51:13Z by ironman 
Re: using "logical or  " between each constraint
20130127T11:02:23ZThis is the accepted answer. This is the accepted answer. davidoff
 20130116T13:31:02Z
If you are in a CP context, it is valid to write
<pre class="java dw" dataeditorlang="java" datapbcklang="java" dir="ltr">using CP; ... or(i in 1..4) x[i]==1 </pre>
And using CPLEX as the engine, the formulation of the previous post is valid. Note that if your variables are boolean, you have a native linear simplification :
<pre class="java dw" dataeditorlang="java" datapbcklang="java" dir="ltr">sum(i in 1..4) x[i] >=1 </pre>
David
x[1][3][1]+x[3][2][1]=2
x[1][4][1]+x[4][2][1]=2
x[1][3][2]+x[3][2][2]=2
x[1][4][2]+x[4][2][2]=2
.
.
.
how can i make these logical constraints in closed form?