There are three projects. Binary variablesX1, X2, and X3are defined as follows:
Xi= 1 if project i is selected, and
Xi= 0 if project i is not selected, for i = 1, 2, 3.
5. Write a constraint to represent: “Project 2 and project 3 must go together. That is, it is not allowed to select one while deselect the other”.
6. Write a constraint to represent: “The three projects can not be all selected. There must be at least one that is not selected”.
7. Write a constraint to represent: “If project 2 is selected, then project 1 must be selected; but if project 2 is not selected, then there is no restriction on project 1”.
8. (Bonus question) Write a constraint to represent: “If project 1 is not selected, then project 2 must not be selected; but if project 1 is selected, then there is no restriction on project 2”.
5) A contraint to represent that projects 2 and 3 both need to be selected if any one of them is selected by :
(X2 - X3) = 0 i.e X2= X3
6) This also can be represented by a lot of constraints, we'll see two such contraints:
X1*X2*X3= 0 , hence with constraint we have rules out the possibility of X1=X2=X3=1 (i.e the case where all the projects are selected)
OR
X1+X2+X3 <3
7) X2 * (1 - X1) = 0 , Hence with this constraint we have successfully ruled out the case X2=1 but X1 = 0 (i.e project 2 was selected but project 1 wasn't)
8) (1 - X1) * X2 = 0 , Hence when X1 is 0 then X2 has to be equal to zero but if X1 =1 then X2 can take any value.
Thank You. Do leave a thumbs up if this helped. You can comment for further queries
Get Answers For Free
Most questions answered within 1 hours.