class_docstr: Analogous to a gridspec, and contained in another LayoutGrid.
class_docstr_tok: ["Analogous","to","a","gridspec",",","and","contained","in","another","LayoutGrid","."]
docstr: These are the redundant constraints, plus ones that make the
  rest of the code easier.
docstr_tok: ["These","are","the","redundant","constraints",",","plus","ones","that","make","the","rest","of","the","code","easier","."]
code: def hard_constraints(self):
      """
      These are the redundant constraints, plus ones that make the
      rest of the code easier.
      """
      for i in range(self.ncols):
          hc = [
              self.rights[i] >= self.lefts[i],
              (
                  self.rights[i]
                  - self.margins["right"][i]
                  - self.margins["rightcb"][i]
                  >= self.lefts[i]
                  - self.margins["left"][i]
                  - self.margins["leftcb"][i]
              ),
          ]
          for c in hc:
              self.solver.addConstraint(c | "required")
  
      for i in range(self.nrows):
          hc = [
              self.tops[i] >= self.bottoms[i],
              (
                  self.tops[i]
                  - self.margins["top"][i]
                  - self.margins["topcb"][i]
                  >= self.bottoms[i]
                  - self.margins["bottom"][i]
                  - self.margins["bottomcb"][i]
              ),
          ]
          for c in hc:
              self.solver.addConstraint(c | "required")
  
imports: import itertools
  import kiwisolver
  import logging
  import numpy
  import matplotlib
  import matplotlib.patches
  from matplotlib.transforms import Bbox
label_desc: Use image node_id 5 for calling the LayoutGrid obj's underlying member method code with example usage: obj.hard_constraints() without return types