"Invalid random variable in index expression for constraint"

In reply to khaledismail:

Index expressions can include loop variables, constants, and state variables. Invalid or out-of-bounds array indices are not automatically eliminated; users must explicitly exclude these indices using predicates.

As the error message explains, random variables are not allowed as index expressions. You need a foreach loop.

constraint links { foreach(noc_member.router_grid[row,col])
   if ( row == router_row_idx && col == router_col_idx && 
        noc_member.router_grid[row][col].row_idx == 0) &&        
        noc_member.router_grid[row][col].col_idx == 0) && 
        (!noc_member.router_grid[row][col].isLinkActive(EAST) ||
        !noc_member.router_grid[row][col].isLinkActive(SOUTH) ) )
		router_links inside {NORTH, WEST};
	else
		router_links inside {NORTH, EAST , SOUTH, WEST};
}

Also, this. in your constraint is unnecessary and makes your code harder to read.