0
$\begingroup$

I have $6$ decision variables $(x_1, x_2, x_3, x_4, x_5, x_6)$ in my problem. All of them are integer and $\ge 0$ and they represent a sequnce. I want to put constraints on them that if a variable is populated then the next $2$ immediate variables should be populated with the same value too.

How could I define that constraints mathematically?

For example
0,1,1,1,0,0 is okay
1,0,1,0,1,0 is not okay
2,2,2,0,0,0 is okay 
1,1,2,1,1,0 is okay because it is addition of 1,1,1,0,0,0 and 0,0,1,1,1,0
1,1,2,1,0,0 is not okay
0,0,0,1,1,1 is okay
1,1,1,1,1,0 is not okay

I realized that sum of my numbers has to be multiple of $3$.

I also thought about creating a new series where $y_1=x_1+x_2+x_3$, $y_2=x_2+x_3+x_4$ , $y_3=x_3+x_4+x_5$ , $y_4=x_4+x_5+x_6$ . But How could I use $\,y_1, y_2, y_3\,$ and $\,y_4$ .

$\endgroup$
  • $\begingroup$ Since $(1,0,1,0,1,0) = (1,1,1,0,0,0)+(0,0,1,1,1,0)-(0,1,1,1,0,0)$. what in your rules precludes it from being OK? $\endgroup$ – Henry Oct 13 '15 at 22:56
  • $\begingroup$ You cannot subtract. $\endgroup$ – user2543622 Oct 13 '15 at 23:00
1
+50
$\begingroup$

It seems that you want linear combinations of the following vectors:

$v_1=(1,1,1,0,0,0), v_2=(0,1,1,1,0,0), v_3=(0,0,1,1,1,0), v_4=(0,0,0,1,1,1)$

A linear combination will take the form $a_1 v_1 + a_2 v_2 + a_3 v_3 +a_4 v_4$.

From your response to https://math.stackexchange.com/users/6460/henry's comment it appears that $a_1 \ge 0, a_2 \ge 0,a_3 \ge 0,a_4 \ge 0$.

Translating this back to your original variables gives these:

$x_1=a_1$

$x_2=a_1+a_2$

$x_3=a_1+a_2+a_3$

$x_4=a_2+a_3+a_4$

$x_5=a_3+a_4$

$x_6=a_4$

These equations come from setting $(x_1,x_2,x_3,x_4,x_5,x_6)=a_1(1,1,1,0,0,0)+ a_2(0,1,1,1,0,0)+a_3(0,0,1,1,1,0)+a_4(0,0,0,1,1,1)$

$(x_1,x_2,x_3,x_4,x_5,x_6)=(a_1,a_1,a_1,0,0,0)+ (0,a_2,a_2,a_2,0,0)+(0,0,a_3,a_3,a_3,0)+(0,0,0,a_4,a_4,a_4)$

$(x_1,x_2,x_3,x_4,x_5,x_6)=(a_1,a_1+a_2,a_1+a_2+a3,a_2+a_3+a_4,a_3+a_4,a_4)$

More generally, if there are $n$ decision variables then:

$x_1=a_1$

$x_2=a_1+a_2$

$x_3=a_1+a_2+a_3$

$x_4=a_2+a_3+a_4$

.

.

.

$x_i=a_{i-2}+a_{i-1}+a_i$

.

.

.

$x_{n-2}=a_{n-4}+a_{n-3}+a_{n-2}$

$x_{n-1}=a_{n-3}+a_{n-2}$

$x_n=a_{n-2}$

$\endgroup$
  • $\begingroup$ i feel that your idea of v1...v4 and a1...a4 could work. But I got confused by the last 6 equality that you have mentioned. Would it be possible to explain more? Moreover instead of 6 decision variables (x1.....x6), if i have 100 decision variables is there a faster way to put the sequentiality/continuity constraint? $\endgroup$ – user2543622 Oct 13 '15 at 23:31
  • $\begingroup$ Your updated comment "These equations come from setting " onwards is helpful. What can I do if I have 100 decision variables (x1, x2....x100)? Do i need to repeat the same process? $\endgroup$ – user2543622 Oct 13 '15 at 23:45
  • $\begingroup$ Your inputs and comments are helping me. Let me think more and formulate the problem. Let me know how it goes $\endgroup$ – user2543622 Oct 14 '15 at 0:08
  • $\begingroup$ Do i have to still check if "sum of my numbers has to be multiple of 3"? I feel that I dont have to check that any more as x=a will take care of that. Any inputs? $\endgroup$ – user2543622 Oct 14 '15 at 1:06
  • $\begingroup$ multiple of three is no longer necessary $\endgroup$ – tomi Oct 14 '15 at 1:08
0
$\begingroup$

You might check whether: $$x_4-x_5=x_2-x_1$$ $$x_5-x_6=x_3-x_2$$ and requiring these differences (and $x_1$ and $x_6$) to be non-negative to deal with my comment.

This will imply $x_1+x_2+x_3+x_4+x_5+x_6 = 3(x_2+x_5)$ and so the multiple of $3$ you found.

In @tomi's terms, $a_2$ is equal to the first equality, and $a_3$ to the second, while $a_1=x_1$ and $a_4=x_6$.

$\endgroup$
  • $\begingroup$ I understood x1+x2+x3+x4+x5+x6=3(x2+x5) part. How could i generalize when i have 100 variables? $\endgroup$ – user2543622 Oct 14 '15 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.