 Yeah, so good morning everyone. Today's tutorial speaker with us what we have we have Daniel who is faculty member at University of Ardua. He has been working in this field for more than 20 years now. His PhD was also in this domain and he is passionate about applying the techniques for constraint solving and optimization to solve industrial problem is well known as an author of set 4j one of the most impactful solvers that is used in the industry is also the editor of general of satisfiability a bullion modeling and computation so yeah without further ado I'll request Daniel to take over. Thank you for the kind introduction so thank you for the organizer for inviting me to that set SMT school this is my first time in India and this has been very nice to now so I would like to introduce you so we would have three slots in the set SMT school so this morning it will be sort of theoretical and this afternoon we will play a bit with with the solvers and we will see what it means to model problems and and you will see that SAT or Sodomoleon or Maxat these are just like assembly language for modeling problems so they are not really useful per se by the end user you need to have another layer on top of it but still we were just to give you an idea of what's going on so I will try to show you an example so is it possible to sit M researchers on M-1 seats so you see that here there are much more seats than we have researchers there's no problem but and it looks quite stupid like and theoretical question what do we care about that problem right what what I what it has to do with real applications well suppose you want to optimize the number of seats okay what you are going to so it's obvious for us because the number of researchers and sees it completely related but in a big problem industrial problem some variables might be doesn't seem related at all at the first glance in the problem but for the subject doesn't matter what you ask is give me a solution that it will give you a solution with M researchers on M seats and then you will have to prove to prove that it's optimal that it's not possible to assign M researcher to M-1 seats okay so and we heard on during the first day that optimization problems are the real problems in the industry in the world and this is exactly why if you cannot solve that very simple problem you are not going to solve optimization problems with a set solver okay and so what does it mean exactly when we when we want to solve that problem it means that at least each researcher should have a seat and each seat cannot host more than one researcher and those are actually constraints that we have seen yesterday with Maté those are cardinality constraints okay so how do you represent the first one the first one you could just use a specific of cardinality constraints where the threshold is one which means that it's just a close a simple close that we we have seen during the two previous days and then you have the fact that each seat cannot host more than one researcher if you have if you only have closes you probably will replace that by another constraint saying it's not possible to have two person on the same seat okay and this is exactly what it means here I cannot have both so here X denote that we have the researcher I is on the set seat J and we cannot have two different researcher on the same seat okay so this is a the classical way to express a CAD at most one but suppose you have ten thousand one million variables this is n square it won't work okay so there are ways to do that better than this textbooks approach and typically the funny thing is you can take crypto minister whatever solver or no not crypto militant non-lingeling because they have specific processing for that but if you take the best that solver without tricks for counting it will not be able to answer for m written on 20 and that looks quite stupid right but this is the state of the art the theory tell us you cannot ask a set solver to count it doesn't work so what we can do then you have another class of solvers that has been designed in the years so those are absolutely constraint solvers in that case you are allowed to use the slightly more powerful constraints so you we keep the first one okay so this is just a way to rewrite the clause okay we just tell the sum so here instead of true false we have zero one we are going to sum the Boolean values and we we just know that at least one of these guys should be one and which is the clause and so it just means the sums that be should be greater than one and here we what we have is we can each seat cannot ask more than a researcher and it means simply that we are going to express directly with this sediment constraint the fact that we can the sum of the of all the assigned value given a J is less or equal to one and this is one constraints before we add n squared and if you use a solver that is based on resolution so it can be two things it can be you have a representation internal representation of the constraint that are clearly so WN constraints or cadenity constraints but you do not change the conflict analysis procedure it won't find it won't be able to do better much than a classical set solver okay however if you use another proof system typically the one you will find in ILP solvers then you will be able to prove immediately that it doesn't work okay and why can we and I mean immediately at some point you just have to read the problem and so you until you are able to generate the problem the solver will be able to do it so do you have an idea how to how to do this so I added the constraints here so I have so this is for m equals 3 so we have the researchers three researchers two seats and so here we know that each researchers should be on one seat and here for each seat you cannot have more than one researcher okay so if we want to find that this is not possible using the cutting-proof proof system what you have to do first is sort of normalize all the constraints so that they are all greater or equal to something and to do this we are going to replace here we have x bar equals 1 minus x okay so what does it mean it means that we add x 11 and we replace that by 1 minus x bar 11 and we move the one here okay so what do and we just negated also so at the end what we got is this formula typically we replace the literal presentation and here we do the number of literals minus the former threshold so it was one three minus one here we have two so we we get those two cadenetic constraints all right we will see all this afterwards so now that we have through those three clothes these and those two cadenetic constraints do you have one idea how you can proceed so you need to find something similar to resolution so you need to add constraints that have opposite literals so we can see that here we have those three clauses and here we have opposite literals okay we we can add them so what we are going to do we are going to add one two three and four okay so what does it what what is the consequence of that we are going to so those opposite literals are going to disappear okay and we will keep only those three literals here so those are the three literals that we have here each time we one pair of literals disappear it will be one okay so we have three in that on the left hand side and we have to sum up the three here plus the two which is five so we have three here five we move the three here we get to two so it means we have a new cadenetic constraint okay and now if you sum up this one and this one what we are going to get is to have three written on for why because here we sum up those three elements with this one so I tell you that it gives you three because you eliminate three elements and here we had two on four and three written on four this is not possible so this is a proof with the cutting per line proof system okay so this yes so x11 bar is like minus x11 no no no it's one minus so this is the tricky in settlement constraints you if you you have x equals one minus x bar so if you have x plus x bar it gives you one that you have to remove from the threshold at the end so here when when I when I add those three and that one each time I will be clashing here I will I will replace each of these element by one so it means I will okay so typically what I have is okay the first step I can do it what do we have with one plus four we are going to clash those ones okay so it will be okay so this will be one which is quite strange okay you have to be used to but so you replace each time by one and this one can sell that one and at the end and you do that for each typically each time you add a clause that is conflicting it just remove the one you have here so you keep the same the same threshold and so this is how you can prove for once for all that it's not possible okay and there is no backtrack if you do the right things okay so this is that looks nice and so typically this is why we're interested in that kind of more expressive things the program is you have theory and practice okay so in practice what people want if you do I'm coming from also constraint programming where we you have a very sophisticated constraints and you have algorithm dedicated to propagate those constraints and so the idea is you should express your problem with the highest possible level to keep the structure to provide the more info the as much information as possible and then you use that high-level description to try to solve your problem with whatever tool you want this is the idea so if you are not aware if I show you the model this model which is very similar to to the mathematical notation it looks easy to understand if you if I show you that one it's unlikely that from the beginning you spot that this will give you a less or equal to one okay unless you know what is the that constraints okay so you have a one to one relationship between your problems and your model if you use higher level constraints which is important so we have seen that we have much less constraints if you use the right thing and this is important for kinetic constraints sometimes it will just blow up one million literals this is possible in the cadency constraints you cannot afford to have n-square and so the thing is you you would like to be able to use or do this constraint the program is typically if you discuss with people from theoretical complex science they tell you well your system has to work on cnf why because if you want to compare proof systems you have to have exactly the same input for both okay so it means if you cannot have something that works as also well on cnf then it's not a good proof system and that had been something that is typically that is a bit problematic and especially because in real life if you want to code efficiently those huge kinetic constraints we are going to add variables okay this is something if you are not used to if you look the textbooks if you look at the textbook they do not tell you well you should add many variables why because the search phrase is supposed to be two to the power of the number of variables and so if you add you know what I do inside for J I add me in many cases one new viable pair close pair constraints okay which means millions which looks how would you add millions of variables while the search phrase it's two to the power of the number of variables it doesn't matter because these are not exactly so might they told you it's the complexity of the problem is not necessarily on the number of variables because if you have variables that only appear at one place they are not it's not the same thing as if you have the original variables who are embedded in the whole problem okay and then what it means it means that if you look at the proof from theoretical science then there is a way but a very specific way to retrieve the kinetic constraint from the CNF and I want to show you that because this is something you want to understand to understand why it's complicated also to design solvers because we it if something exists if you are able to do it by hand it doesn't mean you are going to write exactly that as an algorithm for a solver because you may not want to you want to be generic and this is a very specific so how do you retrieve cadena 80 constraints using from clauses so typically you start with binary clauses and so that binary clauses is exactly that cadena 80 constraints okay we because we keep the literals this is just another way to represent the same thing but it's more convenient because we will put coefficients so I prefer to have over line so this is just a notation trick and so the threshold is I should have at least one of those two guys satisfied this is just a close and so what you want to do then you want to sum them up for a specific seat J and then we are going to obtain something like this with those coefficients then you want to divide it by two so you will remove those coefficients become one and this one will be one that up to three divided by two will be will give you two because that will be the nearest integer and you are going to repeat that for each constraints that you are going to produce here is an example you start with so this is for three persons so we are we are trying to recover this constraint okay so from ear to ear is just the the representation from clauses to cadena 80 constraints and so now we are going to sum them up so we see that the first one appear twice the second one appear twice and the third one appear twice so it gives you this and here you sum up the threshold so it's three and so you divide this by two you get this one and which exactly means the same thing okay and then yes no so this this is if only if here you imply okay so so this and this are exactly the same thing okay so this one you can reply you can replace exactly when you are finished when you have applied older so you can remove those clauses and use only that one it will be if only because it represent exactly the same thing you have to finish your you have to do all the the simplification and you can replace and this is what we do in that project we recover them and we replace the clauses by the cadena 80 constraints and if so this is the simple case now suppose I want to have a bit bigger constraint yes from step 2 to step 3 yes this is only one way implication right so you sum up all of them yeah but yeah it is just an application yes because then you what the the power comes by the fact that you divide and you get that one which is not one or not but which is two and this is how you recover the cadena 80 constraint yeah but then how can you replace the new recovered with all the CNF constraints with the new recovered cardinality constraint because the step 2 to 3 was only one way implication yes but you recovered everything by the division that we got here so this is a tricky part but this is how it works and yes yes so the non-trivial things happening here is that so this is the the fact that you divide so here you divide by the same exact exact same coefficient and here you are going to get rid of some solutions because you are not having 1.5 but we are getting 2 and this is the crucial part the crucial part is here it works because it is integers yes so Daniel I am getting confused from 2 so I agree with the division but yes from the you know cardinality constraint over 2 variables to getting to the 1 over 3 variables that is not both way implication right I mean yes yes yes not both way implication right no because this is just an implication yes so then how can you replace the something you derived with the original set of because the all those the three ones if you take the set of the three then you what you get is the set of the three so you need to do exactly those if you do exactly the steps at the end what you get is exactly something so so if you miss one it doesn't work so you are not applying preserving equivalence preserving transformation at each step but the whole steps the three steps if you apply them they are equivalent preserving so which is sort of tricky right and if you want to do that for a bigger constraints typically what you have to do is to you so you start with greater or equal to one then you generate all the one greeted to equal to two you sum them up and then you can retrieve the greater and equals to three and and so on and so on and so on and you see this is a very specific way and you have to apply that if you want to recover the cardinality constraints from the CNF if the encoding is the trivial encoding with binary pairs with pairs of negative little okay it only works in that case so you see so this is the why people are excited about cutting planes about the fact that you can retrieve all this and it gives you very short proof for the researchers on seats problem okay so the yes yeah so are you saying that I have to go I have to first combine these so you do things into three variable things and so you have that you have first to to to take the clauses to this gives you just by rewriting greater than one if you sum them up you can depending of the way you sum them up you you are going to retrieve those four cardinality constraints so typically you are you are summing up three by three all those those clauses to retrieve this yes what I'm wondering is I mean there are six of there are six two variable constraints yes so you have to add those ones those ones so you have six choose two ways so maybe I missed some of them let me check because they only appear so here we are in we are recovering for the seats no I think because you have you have one you have one two three four it's because we have we are four years so it should be it should it's for it's necessarily that one okay maybe I should so for example the yes first three variable constraint here the three variable constraint the first yes so how was that obtained by adding which two one so one one two one so this one this one and three so so there should be there should be another one no I probably missed some some clauses because one two one three yes so those are the three yes yes those are the three so yeah so two x one one two x two one two x three one greater or equals three greater equals three but but then you divide yes yes so it's that's because you know the problem and you you do it by by seats or by or by researcher so that the reason why I tell you you do not do it you you you are driven by the fact that you know exactly what you want to achieve you want to retrieve exactly those cardinality constraints so you are you you know because you know the the variables you know which one you sum up so typically if I want to retrieve that I am summing up all the the previous constraints with those guys and I will get them so typically here I just so typically here I have all the four variables but four here I have all the those guys but three all the guys but two all the guys but one so that the reason why I created that way my example but it's sort of systematic way of applying the rules to get growing cardinalities okay but this is the way yes yeah well this is the if you do not do that you it doesn't work so typically this is those are cuts this is the way you get rid of some part of the search space and this is one of the very important part and the the problem that you you need to be able to use it to use it you need to have the the case where on the left hand side you have a common divisor and you want only to use the rounding on the threshold and this is sort of complicated to find in real life when you have your constraints okay all the power comes by the fact that you are if you just divide by your number it doesn't change at all your your constraint you are completely equivalent you do not gain anything but if you if you're able to round up the threshold then you are removing some part of the solution and then you are getting better so this is so cuts the the fact is each time you add those constraints you sort of remove some part of the search space until you fit exactly what you want so this is how it works but is it not possible that the optimal solution lies within the space which is greater than 1.5 but no no no no no we we are in in the Boolean domain so these are all integers we so this this is not a mixed integer programming this is we are in a complete discrete space else it doesn't work we are not allowed to do it you can only do it for integers for Booleans okay so this was the motivation just to show you okay this exists okay you there are researchers they know what is the power of that and so the thing is if you look at cdcl so just when i did my phd nobody cared about that solvers okay nobody because in the 90s you would use local search to solve problems and the solvers were much less efficient than now and so when 2001 we got uh two of those of magnitude speed up on some problems i mean it completely changed the world okay then people couldn't believe it they had to provide the binary of the solvers to check if it was really not a problem with the table and then think that you would just dream of you would write the algorithm on papers you could implement them that has been a huge a huge improvement then people said okay if we can do a SAT we can do a much better right and then try can we use something better than just resolution which is the smallest proof system simplest proof system from theoretical computer science and it took so in 2001 the solver was designed shaft but it took eight years to be to agree on the proof system it was using because to map what was doing the solver with the theory it took some time so the previous solvers called called dpll were based on tree resolution and this new kind of solvers there was one theoretical explanation when it was better it's correspond to general resolution okay with this uh conflict analysis procedure so the idea is just okay so if the super powerful cdcl solvers based on resolution work so well can we just change the proof system they have in that conflict analysis procedure by something more powerful and that candidate is cutting planes to be able to do exactly what i showed you before okay and so and and so the idea i will show you that actually it's it's uh the message is there are things you can do there are things you cannot do yet um and i will so the reason why you have an exclamation mark you you have a question mark here is uh there are several definition of cutting planes some of are implemented of solvers or others are not and we will see uh if time permits how we can recover in practice just carry any constraints but in a way this is compatible with uh with solvers okay so uh let's do some definitions now because i gave you all the the examples just to try to give you an idea of okay what is the mind of people when they try to work on this um so now we have that generic definition so we only saw cardinality constraints uh in the previous site there was no weight uh in front of the literals on the left hand side but the general way to write a sort of constraint is you have Boolean variables here you have an integer might be positive or negative you can rewrite things afterwards and then you have here k which is called the threshold usually um you so you have that very strange definition of x bar okay x bar plus x equals one so this is uh it takes time to uh have this and to use this but this is the the way it works uh and then you can use different way to compare things and because we're in the integer domain you can always rewrite with less or equal or greater or equal okay so it's uh it's not a big deal and so typically here you we have a a set of pseudo Boolean constraints actually if you look at those two uh so we have here two different constraints you see that here you have the negation of the literals here so if you had if I do five on three uh eight and uh so we have five so this is 13 and uh if you do 13 minus eight you will get five actually those two constraints are exactly the first one with inequality here so it's just an equality that has been divided uh into two constraints and here you recognize what we have seen earlier which means academic constraints we have no weight and we have just a threshold okay so actually if you just give so in theory this is no more complicated than using clauses okay this is just NP complete uh so the the nice thing is so those are Boolean formulae so there is a normal form so we know that we can translate them into cnf or into dnf or into nnf or whatever normal form this is just a Boolean function okay now the size they will take uh might not be uh interesting but the point is we know that we can translate any Boolean formula into a normal form so uh we have seen that clauses are just a specific case of uh of kinetic constraints so the easiest way to see it is just to take the literals and to sum them up greater or equal to one but you can also represent them less or equal to the number of literals minus one and here you negate them it's just some way to uh represent things and so uh you so you can have x1 or x2 or x3 which is typically represented at x1 plus x2 plus x3 greater or equal to one but this is also x1 bar plus x2 bar plus x3 bar less or equal to two these those represent exactly the same thing so here we have the same thing for uh so uh so picking two literals out of three is expressed that way and you have the other things and what is really uh important is if you have a knapsack constraint if you need to uh uh if you have a limit on the weight of the element you have to select this can be represented by one single pseudobline constraint or if you know the subset sum problem this this is exactly one or two depending of if you allow or not equality but this is only one single constraints in the pb formulaism so uh now we can take any cardinality pseudobline constraints and rewrite it in a way that is normalized if you want to use it in a solver typically it will be positive integers positive coefficients and greater or equal to something so i take this arbitrary pseudobline constraints so now i'm going to negate it to get rid of this less or equal to by a greater or equal to okay so i just negate here all the signs as usual and now i need to get rid of this coefficient so i'm going to replace x2 by one my x x2 bar so and same thing for x4 that way i'm getting here four x2 bar here x bar but now i got four and the one here that i need to add and i get this pseudobline constraint so it means that i can always when i read pseudobline constraints reach a form where all the coefficients are positive integers and where here i'm greater or equal to okay and so one thing that is useful if we have if we look at the previous example is if you have a this is a very important cardinality constraint the sum of literals is less or equal to one this is exactly the same thing as the sum of the negative literals is greater or equal to the number of literals minus one so here we have five literals so greater or equal to four and so this is the kind of gymnastic you need to have when you look at the constraint so it's a bit complicated but after after a while you you you see it so yes are you saying that on the right hand side we should always have a positive constraint not necessarily this might not be there are some cases you will see where it can be negative so you because sometimes we will have so at at some point once you are normalized it will be greater or equal to zero because so typically when you are so we will model this afternoon some problems and we will enter a non-normalized form so we we and we use non-normalized form when we model problems but in the solver it since all the coefficients here are positive it's necessarily a greater or equal to zero here else you it's a tautology okay because everything falsified would be a greater than minus one so this that would be tautology what you're saying is that if you do get a negative number you can make it greater than equal to zero yes yeah so typically what we read when we read the problems we read an unnormalized form that we normalized and if we using a normalized form we we get a negative number it means that it's a tautology yeah okay so there are a few things so when you look at those constraints they are they they make you think about what are clauses and you will see that they are very particular so if you think about it if you take a clause or a continuity constraints all literals play the same role what what I mean in equivalent I mean falsifying x1 or x2 or x3 or any two of them there is no difference they are all symmetric to satisfy the constraints correct if I take a clause I can satisfy any of the literal it will satisfy the clause now look at a pb constraints actually x1 I just if I just satisfy x1 I satisfy the constraint if I only satisfy x2 I satisfy the constraint now if I want to satisfy with x3 and 4 I to satisfy both so it means that here x1 and x2 are symmetric are equivalent equivalent they play the same role in the satisfiability of the constraint and so the same thing for x3 or x4 what does it mean in me that the coefficient is a way to partition literals into equivalent meaning and it's more complicated than that because then yeah there are some subtle cases even if you have a different weight you you are playing actually the same roles depending because of compensation effects and so on so those are so this is the first difference in a clause you can watch for instance whatever literal they are all the same you can do that also for kinetic constraints this is no longer the case with pseudo brand constraints they are not all equivalent another thing that is funny how do you propagate a truce value in a clause when all but one literals are falsified which is actually when you have a unit clause when you simplify okay and you can only satisfy one you can only propagate one value okay if you take a cadenity constraint typically what you are going to propagate it's k literals where you're all the if you have so it would be x1 plus x2 plus x4 greater or equal to k so here you have no more no other chance to satisfy the the cadenity constraint to propagate all of them okay this happens when you falsified n minus k literal in in your cadenity constraint but so you satisfy you propagate once but k literals now if you are in the case of a pseudo brand constraints here for instance you need to satisfy your constraints with nine in that case you know that you are going to propagate those two why because if you if you if you falsify x1 you only have seven remaining no way to satisfy your threshold so those two x1 and x2 have to be propagated and here you still have one of them to satisfy that will you will satisfy in the future when two of them will be falsified so it means that you are going to satisfy to propagate between one and several values with the same pseudo brand constraint and several times in your search space when you explore your search space so this is completely different from a clause so and this is similar to what we have seen in the previous slide if you look at this pseudo brand constraint so here you have 10 if you falsify it you have only 11 remaining so you know that you require x1 to be true if this one is true how do how can you achieve five yes and i think actually this is the i should have removed that one because this is the this is not well this is not completely correct because this what is correct is x1 and this because you can satisfy x2 and x3 and you satisfy 15 so it's not as simple as that but actually the 10 x1 the fact that x1 has to be propagated to satisfy this constraint is the same thing as x1 and 4x2 plus 4x3 plus x4 plus x5 plus x6 greater or equal to 5 yes i need to to fix it and for the the last thing and in that case it should be it should be okay yes so we have here greater or equal to 14 so same thing if we falsify this one we have only 11 so we cannot satisfy this has to be propagated now how can we get 14 we can get 14 by satisfying that one or by satisfying that one but if i falsify both there is a no chance to satisfy the constraint with any of those literals so you can actually completely remove those three literals so this formula is equivalent to that one okay but so this is very tricky because we will see currently one of the reason uh the solvers are not working well is because they are producing constraints with those we renovate literals and it's not possible to produce them with cardinality constraints or with clauses this is this is something completely specific to Pseudoblian constraints so okay so now can what can you do with those Pseudoblian constraints so we have seen that we you can just add them so you just sum up the coefficient for each literal and you sum the threshold you can do some linear combination where you are going to multiply the sums elements each of them and you can do so this is the classical division okay we just take any number and we do the division here the same each side here you preserve completely equivalency you do not gain anything uh yes so here i just divide by your number but we will see you this is just classical maths you do not do anything it won't help you no but if that turns out to be non integer then do we always take the ceiling or because it's yeah yeah yeah but for the moment those are the the rules you apply in general you are allowed to use those rules okay but so now we we will see what what do we do so we have this we have two rules specific when we have integers so one is theoretical computer science division so this is what i okay because we i got a good huge argument with Jacob Notrom about i i thought in my community they were using cutting planes for something which is not the cutting planes of the theoretical computer science which is not the cutting planes of the operation research community okay so i give different names just to make sure okay so i have three different cutting planes so theoretical computer science division is the one where you always divide by a factor that you have so this is what we have seen you you have a common factor on the left hand side and you just use the ceiling here on the right hand side and this is how you do the proof for the pigeon hole principle and this is what they consider at the cutting plane proof system you need to use that and it's really if you do not have this ceiling you are not going to improve you are not cutting removing any part of the search space when you add your new constraint so this is really mandatory to have that and this is the example so typically that we have seen you you have here two as a common factor you divide by two and here three over two ceiling gives you two so the what they have typically what you you have in cplex when you do a bunch and cut is typically that you divide and you have the ceiling everywhere okay and this is how you are going to add your new cuts and you are cutting you have new some part of your polyhedron until you you reach your solution and so what does it mean it means that you can just divide by the highest coefficient and at the end you get a close okay so it means that you can always derive a close from a sort of yarn constraint then I will call that a clashing addition okay clashing addition it's sort of like resolution okay so you try to make sure you are going to sum up two sort of yarn constraints where they have opposite literals okay and so this was done pretty early okay occur 88 and so this has been known for really a while especially in the constraint community in the operation research community and this so this is an example and this is typically where we have a lot of problems because now we are going to apply coefficient of alpha alpha prime okay and so if I take the first one and I multiply it by two okay and I take the second one so what I have is exactly this so I take this one by two okay I add this one so I have two times three here and I have three and so now what I want to to do is to I'm going to eliminate those guys okay so to eliminate those guys I have to replace them by two times one minus x one okay so two minus two x one two minus two x two and so I can get rid of those two but then I have two remaining so I have to get rid of four out of nine so at the end what I get is six x three and three x four greater or equal to five so now what is the difference between resolution the thing is I remove two literals you can only remove one with the resolution so the problem is so this is the tricky part you are not used to because you have that coefficient produced by the fact that you resolve on x okay and now if you look at the coefficient at the beginning and the coefficient at the end you see that typically the coefficient because you apply a factor and because you sum them up the coefficient are going to grow okay and that will be that will be a problem so the so if you apply these two clauses okay you have exactly the resolution so this was the paper from hooker this is what you call it general resolution if you take clauses it's just result the paper from hooker 88 so the he called it generate resolution because if you take clauses it's just resolution but then you can do more if you do use it for pseudo gradient constraints and so what happens if you have common literal this is different from resolution because now instead of merging if you have x x2 or x2 it's just x2 now it's 2x2 okay so now you have coefficients appearing and if you have more than one variable okay this is where you get greater or equal to zero and this will be a totology okay just like even the current resolution so typically if you have this normal form where everything is positive greater or equal to zero or a negative number that will be a totology all right so now the the the last important rule that we can use so again it's just you just derive okay this is your this is not if and leave this is just something that you can imply if you have here a threshold and you have one coefficient that is greeted on the threshold you can just replace it by the threshold okay so here we have an example if I have a 6x3 plus 3x4 greater or equal to 5 it is I can just get rid of that 6 and put a 5 here because it doesn't matter if I just need to satisfy that one and it will be the same and what does it mean it means that if you if you have a one here on the right hand side then actually you have a close because the point here is and this is what we we add previously okay two and two because we have a one here at the end we get x2 plus x3 plus x4 which is the expected thing with resolution so we come back so but you you see there are a number of rules you have to know and you have to check all this each time you do the the computation of cutting planes and there is also one so we will see that we will lose a lot of invariance in when we do the conflict analysis and another rule that will be that we will need the weakening which means that we can just take any literal from the constraints and satisfy it and just remove its coefficient from the threshold so typically here I consider that x5 is satisfied so I get rid of I remove it and I'm going to remove its its coefficient from here and I'm getting a new constraint why is it important because we will see that sometimes when we do the conflict analysis so one of the invariant of the conflict analysis on SAT solvers is that each time you do a resolution between a conflict a conflicting constraint and a reason the result is conflicting this is how it works this is no longer the case if you apply conflict analysis with those rules and the weakening will be the only way to reduce the reason until you get a conflict when you apply the rules so those are specific things too okay and so this is not really so this is how you can translate yes so the new constraint that you derive has fewer solutions than the earlier constraint right because you've fixed some variable to a value the earlier constraint could have had a solution with yes so why is it called weakening it is looks like it's strengthening yeah well you know we have the same problem it depends of it's a you're restricting the set of solutions right so we all solutions of these ones are so every solution of the bottom constraint along with x1 is one is a solution of the top constraint solution of the top constraint which doesn't have x1 is I just wanted to make sure I'm getting it right the terminology is okay no but okay so the so this is this is a logical consequence this is the logic the so you this is you what you get is so no no so you from that formula you can produce many of those so so is that logical consequence yes for this one yes okay so so so suppose instead of 5x1 yes I had so so so so you mean whenever the top one is satisfied the bottom one is also satisfied yes okay and so the the last thing is if you do not want to use swn constraint okay and you want just to use kinetic constraint that case to do that there is a way to translate any swn constraint to a weaker constraint and you you just look at how many literals you you need to reach the threshold okay here if you take the first two you get eight which is sufficient to reach the threshold and you can rewrite from that constraint you can produce x1 plus x2 plus x3 plus x4 plus x5 greater or equal to from two okay so here here you have that complicated formula and you can you can sort of tell well if you pick just two of those guys it's okay so it's a it's a way to from a celebrant constraint to generate a kinetic constraint so you have all the same literals now you have no more coefficients and here you have just a degree and so the solvers have been using that we will see because it's very costly to maintain in the solvers celebrant constraints and so they they were computing everything and at the end just adding the element so here you so you need to do it by decreasing order right so you have to take all the so you you need to have that condition that all the coefficients are in decreasing order and you just pick how many coefficients do you need and that will give you the right hand side okay okay so we have seen that there are actually different cutting planes so it can be linear combination plus the division from ilp we can have the addition and the theoretical computer science division where you have on the left hand side a common factor and you only use the sailing on the right hand side and what we are going so typically what i use is clashing addition plus the saturation rule okay and so this is uh hooker generalized resolution and this is what is exactly works exactly like resolution on cnf and is better when you use constraints and so the idea is people willing to integrate cutting planes will just use some of those rules and put them in in the solver and this is quite different from so there there have been a huge amount of research on translating pseudoblion constraints or kinetic constraints into a cnf but this is a completely different business okay because it means i reuse directly the set solvers and the latest winner of the set competition and i work on the encodings this is another story here we are working on using a different proof system using a different representation because we have those pseudoblion constraints okay okay so what are the yes so what about the power of these different systems so they they are the only the only one for which we have uh so uh yacob not from as a paper last year about the proof so typically you so we would need to use different things so they are incomparable so typically clashing addition plus saturation and addition and tc division are not comparable you need to use then you have the theoretical uh cutting plane which is uh where you can use everything that works well but then as soon as you use uh the division or saturation you you have some benefits or the others but none of them is as powerful as general uh cutting planes if if you do division and saturation then you would get the full power of cutting plane and no no no so because because the they i mean it's complicated to um uh when you use saturation so clashing combination is restricts the way of the application of the addition okay because you only allow the addition when you have clashing and and this is not what we have seen okay so when we have so the the prime is what do you use what are the rules to guide the fact that you combine together constraints and uh in the in the sat solver you guide it when you have a conflict by doing reverse resolutions okay and uh how do you decide how to combine so typically the the issue is that we try to combine in some ways uh the constraints it's unlimited there is no constraints in the general case but as soon as you try to uh sort of derive things uh guide things you you have problems okay um so typically uh what you have seen with the exercise of maté yesterday uh with the kinetic constraint is what do you need to detect uh in the sat solver when you have a constraint you need to detect if it's falsified you need to detect if it propagates and you need to detect what is the reason so when you when it's falsified you have to provide a reason why it's falsified okay so whatever the you can build any constraints you want very sophisticated one in the solver and typically uh cd clt is uh typically provide each theory solvers is providing for a theory that kind of information to the to the uh solver this is the the important so any uh interaction with the solver requires you that okay how can we do that in uh if we think about clauses uh a clause is falsified when all the literals are falsified okay and it propagates when all but one literals are falsified and that the reason why uh typically you only need to check the value of two literals to be able to know whether you are falsified or you are propagating and this is the two what two literals per clause so uh typically this so the reason why shaft was so powerful in 2001 was for three reasons one was the efficient data structure because this was nothing to do when you backtrack and this is a very important feature the second one was was the heuristic that was cheap and that was uh adapting to the problem and the third one was the conflict analysis procedure that was very efficient and it all those things are important together because you to be able to learn you need to have those very efficient data structure that doesn't whether you do not pay a huge cost when you learn long clauses which was the case before if you do not use those lazy data structure so it's very important if you want to learn continuously new constraints to have something efficient like those uh watch literals so can we do that so if you think about cardinality constraints then you so if you have n literals k uh a threshold of k then if you falsify n minus k plus one literals then you falsify your constraints here you see that you have an assigned literals okay so if you propagate you need to have exactly n minus k literals that are falsified and you are going to propagate k literals okay so here you need to watch k plus one literals for cardinality constraints so the greater the k the more literals you are going to watch when it means the more impact it will have in your propagation okay the more literals you watch the slower will be the propagation the whole propagation because each time you assign a value in the set solver it will propagate through the watch literals in each clause so if you have a super long clause of one million literals you just watch two literals so that's fine but if you have greater or equal to 10 000 it means you are going to propagate it to 10 000 uh potentially uh to uh with uh so it's likely that uh when you assign something it will be on those 2000 plus one literals so you will have to manage it so this is one first thing so things are going to get worse when we are talking about pb constraints so now um when do we uh know that we falsify that constraint so we need to compute typically uh a will be the sum of all the coefficients okay and so if we compute something called the slack so in the sum of all the coefficient minus the threshold minus all the weight that you cannot have because you the literals are falsified and typically when that value is less than zero then you are going to propagate so for instance here i falsified l one and l two so the remaining are two plus one plus one this is five five cannot satisfy six uh so this is uh this is on a falsified pb constraint and you are going to propagate when that value is exactly zero so for instance in that case uh l one is uh zero l three is zero and we have exactly three plus one plus one plus one which is six so in if l one and s three are falsified then i can propagate all the other one okay and so uh the thing is uh i show you this is a simple case because all the literals are satisfied assigned the problem that it may be the case that you are going to propagate the first time very early in the search tree and then later and later so we need to we will have them several times and typically here we if we want to do what literals we have to take into account the coefficients so early in these two papers there was a description on how you can extend watch literals for pb constraints so typically you take the maximal coefficient and what you need to watch is the minimal number of literals so that the sum of the watch literals is greater equal to the threshold plus m the idea if you get rid of them uh the then you you cannot satisfy uh the uh the constraints so if you look at the that formula in you in the case of calamity constraints the maximum value for m because all the coefficients are equal to one is one so the number of watch literals is k plus one okay if you take the case of the close k equals one so m plus one we have to which is the the optimal case okay so in closes you are in the optimal situation where you just need to watch two literals if you are in the case of uh uh can put in constraints you may have to watch a lot of them and it will depend of the value of the coefficient so this is uh an issue so typically uh the number of watch literals will typically uh move if you want to watch just what you really you need but or you watch much more if you want do not want to make it varying because the the maximum coefficient will vary when you assign the the values okay uh so uh that's a bigger a big issue and typically for calamity constraints you have the problem that the the bigger uh the degree the threshold the the bigger the number of watch literals also so that uh really something and it makes a big difference for lpb uh learning so if you want if you derive an lpb you know that you are going to slow down your slow solver to give you an idea inside for j is three of those of magnitude slower okay can you do some sort of preprocessing so that you get constraints where you have to watch less number of because if i start with a calamity constraint and i do a bad encoding and then i use it too much later then okay i i i will show you something terrible okay when you do real problems typically you you are doing optimization problems and you have and uh this value of k is decreasing okay i show you that what is the normal form you we use in the sat solver okay this is decreasing so this is just increasing so when we do the optimization process while the value of k is decreasing what we have exactly in the solvers is increasing and it's getting harder and harder to maintain okay so with there are real issues because so should we have a representation that would be less than the problems that closes are just a greater than right so it's not so i told you that you can replace them we could use different representation but yeah so we have different there are many issues with this but yes for instance when you do translation into from calamity constraints to cnf typically depending of the value of k it's less than or greater than just to reduce the so typically you you go n over two and you use one of the other representation okay so now the so this is one first problem now we want to have we need to propagate to have something similar to unit propagation okay how do we decide that so typically here i cannot use the definition typically of unit cause because in unit cause is very specific you have no other choice and it will not be used later okay here i'm going to call it implicative constraints in means of strength which propagate at least one truth value to be satisfiable okay so typically here if we look at uh we we will detect that the constraints is implicative if there is a literal so that if you get rid of this literal you can no longer uh satisfy the constraint so here we have uh the example we have to satisfy eight if i falsify x1 okay here i only have five remaining no way i can satisfy eight so i will need to propagate uh x1 if i propagate x1 now i can i can get rid of it i have only four here but if i falsify x2 there is no way with those two guys that i can satisfy four so i need to propagate it so here typically we have x1 and x2 that must be falsified and we still have no idea what happens for uh x3 or x4 okay so typically in that case we could have uh rewrite that constraint because this is a propagation at top level okay each time as soon as you read it you know that you are going to propagate x1 you know that you are going to propagate x2 okay so we could just write it x1 and x2 and so this is a closed x3 or x4 so i'm a bit confused isn't every constraint implicative by definition or can you have constraints that are not implicative uh well usually you you you are so it so you always have the problem of uh so this is the definition uh when you consider that you you are getting rid of the um falsified literals and you and you falsify the constraints okay else you have to take care so here if this is the reduced form there is no assigned literal or anything okay uh let's try to do some uh to see how it works and then we will have the coffee break so uh typically uh what are the if we want to derive PB constraints in our solvers we have to uh there must be logical consequence of the uh of the original constraints there must be falsified at current decision level and this is this is by default what do you get when you do the conflict analysis for for sad but we won't get that and you it must be assertive at backtrack level and yeah but this is typically not the case in LPB and typically you you may have to it may be assertive at several points and you have to go back to the first point where it becomes assertive so this is a huge headache to to do this so how do you compute the backtrack level so typically if you do that in uh in a closed so uh i'm coming from AI from much more from logic for me the conflict analysis procedure is just you do the resolution on the propagation okay and you stop when you have a syntactic criteria being that you have only one literal remaining at the decision at the current decision level and so this is a procedure that is easy to implement you just loop you do the resolution between the current conflict clause on the reason clause and you you see you just count how many literals are in the current decision level when that number becomes one you stop this is first uip and you know that there is in the worst case the decision uh literal that satisfies this so you know that you this is bounded yeah there is no problem this is quite easy to implement now um the problem is uh here we have this case where we have x1 not x2 and not x3 okay so uh if we look at this this is satisfied so i need to also satisfied uh so it means we need we need two here uh this one are falsified i only have one liter left this is falsified so now uh so i took those decisions in this order if i look at uh this element okay x1 so i can backtrack to this level because uh but here in in that constraint i should have never satisfied uh so uh x1 is satisfied so where should i uh backtrack should i backtrack here should i backtrack here uh the point is where x3 is necessary here okay because if i falsify it i have no way to satisfy i only have four here so here it's like x1 and 2x2 plus x3 plus x4 greater or equal to 2 so i have two possibilities to satisfy either here or those two and it's uh it's not clear if we have to backtrack here or if we have to backtrack here uh so we can backtrack to x y not x2 and in that case we are going to propagate x3 and x4 and uh so if this has been a decision actually we should have uh backtracked to the decision level zero and to propagate this as uh directly as uh a propagation okay and this so if if i have read that uh that lpb constraint directly in the file i would have done it okay but typically here i may learn something that allows that requires me to backtrack to the very first level which is not possible uh in the sad case because there is a decision you stop you know that there is at least a decision where you are you know so typically you you you change completely the way you are going to to backtrack so here you have two possibilities and actually the correct one is to backtrack to the very first time you you need to propagate else you break an important invariant which is you propagate things as soon as possible if something must be propagated then you have to propagate it so if something can be propagated you have to propagate if you have if you if there is a conflict you should stop as soon and detect the conflict this is an invariant that you have in the sad solver okay so uh well then it's a bit technical but typically uh computing the assertive uh uh close uh so this is the what i show you this is just in c-tactic uh test where you you do the resolution and you stop when you have only one literal at the decision level and uh if you want to do it for constraints then you it's a bit more complicated because you have the falsified constraints you pick the reason for the current uh literal and then you compute uh the value of alpha to be able to combine them and remove that literal and then this is something you do not have to do if uh when you combine them it's not uh falsified you need to weaken the reason until you find uh uh a combination that uh uh becomes falsified uh and actually it will only happen if you can apply uh saturation okay if you just weaken it won't change at all but you have to weaken some literals until saturation comes into play and allows you to reduce uh typically your slack and then you apply then you apply saturation on the uh resulting constraints and then you repeat until you are in a state where you know that you are going to uh propagate which is the slack is the slack is zero and the problem that you are playing with the numbers and typically uh you need to use arbitrary precision arithmetic is if you want to apply those words so many people didn't want to use arbitrary precision arithmetic so they sort of detect when the coefficient becomes too big I do something else I use kaniitis or whatever but inside for j we decided to use arbitrary to to be pure to just apply the rules as they exist but it means so this is another reason why it's slow because then you have to manage all those uh numbers and to use all those transformation or arbitrary precision arithmetic which are typically pretty slow uh in java okay uh I have I have so I don't know I have just one example to show how it works uh it's maybe we should take the coffee uh before to be able to understand it so just as you want so so one question that I have is that uh all of these constraints are having this greater or equals that side of the inequality right I mean there is another way is the lesser equals one can use so how does it impact one is easier to do than the other no but typically I told you all solvers from the 90s use the representation greater or equal because uh this is the natural way to express closes into in this formalism however I tell you in real in real life I mean when you do optimization typically uh you are the other way around you have less or equal to a bound and so this is painful uh but the problem is all the rules that we have seen here uh exist or greater or equal to and so if you have to you have to rethink about everything and maybe not all the so it should be possible to to to to re re recreate new rules on the other way around but all the literature has always been uh mentioning greater or equal to yeah we but uh yes that that's a practical issue for solving real problems yes yeah so thank let's thank Daniel for the session