Why Plus operator does not work on integers in Alloy? -


below alloy code 8queens problem
not know why plus operator , minus operator not work correctly
after execution there queens in same diagonal
face error when use plus , minus operator between 2 #
example :
#q1.row+#q2.col-#q1.col != #q2.row

thanks response
best regards


here that's 8queens code:

sig queens{ row:int, col:int } {row>=0 , row <#queens , col>=0 , col<#queens}  pred nothreat(q1,q2 : queens) {    q1.row != q2.row     , q1.col != q2.col     , q1.row+q2.col-q1.col != q2.row    , q1.row-q2.col+q1.col != q2.row }  pred valid {  q1,q2 : queens |   q1 != q2 => nothreat[q1, q2]  } fact card {#queens =8} run valid 8 queens, 8 int 

use plus , minus functions instead (e.g., q1.row.plus[q2.col].minus[q1.col]), because + treated set union, , - set difference.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -