PyConstraints.°£´ÜÇÑ Á¦¾à ¸¸Á·µµ ¼Ö¹ö | |
Áö±Ý ´Ù¿î·Îµå |
PyConstraints. ¼øÀ§ ¹× ¿ä¾à
±¤°í
PyConstraints. ű×
PyConstraints. ¼³¸í
PyConstraints´Â ´Ü¼øÇÏ°í Á¦¾à Á¶°Ç ¸¸Á·µµ ¹®Á¦ ÇØ°á»çÀÔ´Ï´Ù. yacs °úÁ¤ ½ºÄÉÁÙ·¯ project.usagethe ¹®Á¦´Â ±âº» ÀÎÅÍÆäÀ̽ºÀÔ´Ï´Ù. >>> pyconstraints °¡Á® ¿À±â ¹®Á¦°¡ ÇØ°á µÈ ´ÙÀ½ ´Ù¾çÇÑ Á¦¾à Á¶°ÇÀ¸·Î ÇØ°áÇÒ ¼öÀÖ´Â ¹®Á¦¸¦ ÁöÁ¤ÇϽʽÿÀ. >>> p = problem ()> >> P.ADD_Variable ( 'x', ¹üÀ§ (4)) # º¯¼ö À̸§, µµ¸ÞÀÎ >>> p.add_variable ( 'y', ¹üÀ§ (4)) # Á¦¾à Á¶°Ç ±â´ÉÀ» Á¦°øÇÏ°í »ç¿ëµÇ´Â º¯¼ö ¸ñ·Ï >>> p .add_constraint (lambda x, y : x! = y, >>> p.add_constraint (¶÷´Ù x : x % 2 == 0) ±×·± ´ÙÀ½ ÇØ°áÃ¥À» ¾òÀ¸½Ê½Ã¿À : >>> p. get_solutions () # => ({ 'y': 0, 'x': 2}, # { 'y': 1, 'x': 0}, # { 'y': 1, 'x': 2} , # {y ': 2,'x ': 0}, # {y': 3, 'x': 0}, # { 'y': 3, 'x': 2}) ¶Ç´Â ¹Ýº¹ÀûÀ¸·Î :> >> p.iter_solutions (). next () # => {y ': 0,'x ': 2}! ´Ù¸¥ Solversimply¸¦ »ç¿ëÇÏ¿© ¼Ö¹ö¸¦ ¹®Á¦ »ý¼ºÀÚ·Î Àü´ÞÇϽʽÿÀ : >>> pyconstraints °¡Á® ¿À±â Bruteforcesolver, BacktrackingSolver >>> P = ¹®Á¦Á¡ (BackTrackingSolver ()) # BruteForcesolver´Â BruteForcesolverÀÇ defaultbecausÀÔ´Ï´Ù. iTertools¸¦ »ç¿ëÇϸé BacktrackingSolver.writing ÀÚ½ÅÀÇ SolverforÀÇ °æ¿ìº¸´Ù ºü¸¥ °æ¿ì°¡ÀÖÀ» ¼ö ÀÖÀ¸¸ç, @AbstractProperty DEF Solutions_seen (ÀÚ¾Æ) ) : "¼Ö¹ö°¡ º» ¼Ö·ç¼Ç ¼ö¸¦ ¹ÝȯÇÕ´Ï´Ù." @ABStractProperty DEF ¼Ö·ç¼Ç _AT_POINTS (ÀÚü) : ""@ABSTRACTMETHOD DEF SET_CONDITIONS (ÀÚü, º¯¼ö, Á¦¾à Á¶°Ç) : "" "" "@ABSTRACTMETHOD DEF SET_CONDITERS (" ""¶ó´Â {ITERATION_INDEX : ¼Ö·ç¼Ç}ÀÇ »çÀüÀ» ¹ÝȯÇÕ´Ï´Ù. º¯¼ö¿Í Á¦¾à Á¶°ÇÀ» ÇÒ´çÇÕ´Ï´Ù. Variables = {variable-name : domain-values list-values} ±¸¼Ó Á¶°Ç = "" "@abstractmethod def restore_point ( self, starting_point = none) : "¹Ýº¹ »óŸ¦ ÁÖ¾îÁø ½ÃÀÛÁ¡À¸·Î º¹¿øÇÕ´Ï´Ù." @AbstractMethod DEF SAVE_POINT (ÀÚü) : "" "µ¥ÀÌÅ͸¦ ¹ÝȯÇÏ¿© ÇöÀç ¹Ýº¹Á¡À¸·Î º¹¿ø ÇÒ ¼öÀÖ´Â ¹æ¹ýÀ» ³ªÅ¸³À´Ï´Ù." "@ABSTRACTMETHOD DEF __ (ÀÚü) :"¼Ö·ç¼ÇÀ» »êÃâÇÕ´Ï´Ù. "±×·¯³ª COVINENCE¸¦ À§Çؼ´Â »ó¼Ó¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù. ``__iter__`` ¹×``set_conditions``.productÀÇ È¨ÆäÀÌÁö¸¦ Á¦¿ÜÇÑ ¸ðµç ÀÎÅÍÆäÀ̽º ¹æ¹ý¿¡ ´ëÇÑ ±âº» ±¸ÇöÀ» Á¦°øÇÏ´Â``pyconstraints.solverbase``
PyConstraints. °ü·Ã ¼ÒÇÁÆ®¿þ¾î