Error in NQueensEasy1

14 views
Skip to first unread message

Maxime...@univ-lille1.fr

unread,
Mar 6, 2017, 9:33:31 AM3/6/17
to OscaR
Hi,

I try the the features of Oscar.cbls. I start with the examples here :
https://bitbucket.org/oscarlib/oscar/wiki/StartCBLS

I have the following compilattion errors :

NQueensEasy1.scala:34: type mismatch;
found   : scala.collection.immutable.Range.Inclusive
required: Int
val queens = Array.tabulate(N)(q => CBLSIntVar(0 to N-1,init(q),"queen" + q))

NQueensEasy1.scala:39: value + is not a member of Nothing
c.add(allDifferent(Array.tabulate(N)(q => (queens(q) + q).toIntVar)))

NQueensEasy1.scala:39: polymorphic expression cannot be instantiated to expected type;
found   : [T]Array[T]
required: Iterable[oscar.cbls.invariants.core.computation.IntValue]
c.add(allDifferent(Array.tabulate(N)(q => (queens(q) + q).toIntVar)))

NQueensEasy1.scala:40: ambiguous reference to overloaded definition,
both method - in class Int of type (x: Char)Int
and  method - in class Int of type (x: Byte)Int
match argument types (Nothing)
Error occurred in an application involving default arguments.
c.add(allDifferent(Array.tabulate(N)(q => (q - queens(q)).toIntVar)))

NQueensEasy1.scala:40: polymorphic expression cannot be instantiated to expected type;
found   : [T]Array[T]
required: Iterable[oscar.cbls.invariants.core.computation.IntValue]
c.add(allDifferent(Array.tabulate(N)(q => (q - queens(q)).toIntVar)))

NQueensEasy1.scala:57: value :=: is not a member of Nothing
queens(q1) :=: queens(q2)

NQueensEasy1.scala:67: value mkString is not a member of Array[Nothing]
println(queens.mkString(","))


Any idea ?


Thanks in advance for your help,


Maxime.

Renaud De Landtsheer

unread,
Mar 6, 2017, 9:38:17 AM3/6/17
to oscar...@googlegroups.com

Hi,

I'm afraid, this example on the web site is not up to date, and I will delete it.
You should instead start from the examples included in the release you have installed.

Sorry for the inconvenience
--
Renaud De Landtsheer


--

---
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.



--
Renaud De Landtsheer
Reply all
Reply to author
Forward
0 new messages