"list=Tuples[Range[8],2]
I want to find the largest sublist in which the addition of the two entries for any two elements of the sublist will not be same and similarly the subtraction of the two entries for any two elements of the sublist will not be same. Ex:sublist ={{1,3},{2,5},{7,3}}
here 1−3≠2−5≠7−3 and 1+3≠2+5≠7+3."
A motivation is the compare such a model, with the one using 2D array.
Best regards,
Miran
Hi OscaR group,I have been modelling the bishops constraint problem, stating "maximum number of bishops on a n times n board, not attacking each other" (more info at: http://mathworld.wolfram.com/BishopsProblem.html), which is also close the N Queens problem.Currently I have created a model using a 2 D array for creating the board, and afterwards adding the constraints. This works fine, and it finds the solutions. Also it is seems the way done in other CP models to use a 2D array.However, I am wondering if it is possible to model in Oscar by representing the board as a 'set of tuples', e,g, {1..n}x{1..n}, and then say that the solution is a subset of the full set with constraints added?. This would allow to say fx 'solution in set board' or 'solution not in set board'.
An concrete example is described at http://mathematica.stackexchange.com/questions/134218/solving-chess-bishop-problem , that I coped in here:"list=Tuples[Range[8],2]
I want to find the largest sublist in which the addition of the two entries for any two elements of the sublist will not be same and similarly the subtraction of the two entries for any two elements of the sublist will not be same. Ex:
sublist ={{1,3},{2,5},{7,3}}here 1−3≠2−5≠7−3 and 1+3≠2+5≠7+3."
A motivation is the compare such a model, with the one using 2D array.
Best regards,
Miran
--
---
You received this message because you are subscribed to the Google Groups "OscaR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oscar-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Miran,
To unsubscribe from this group and stop receiving emails from it, send an email to oscar-user+...@googlegroups.com.
Hi Pierre,Thanks for the suggestion.Yes, the tabel constraint could be a good way to achieve this, before I was trying with two individual arrays which then refer to the respective indices in 2D fashion, which does not yet work.I have been trying your approach since last week, and looking at the table constraint as described in the "getting started with Oscar" online, but I have questions if you get time:I am a bit confused about the "In this model x1y1 is one CPIntVar that represents uniquely one (x,y) position as x*n+y for instance." modelling in Oscar/Scala. How does this correspond with the domain of a CPIntVar?.
To unsubscribe from this group and stop receiving emails from it, send an email to oscar-user+unsubscribe@googlegroups.com.