charles-river-analytics / figaro

Figaro Programming Language and Core Libraries
Other
757 stars 153 forks source link

Dealing with VariableElimination.probability #742

Open pouriadodido opened 6 years ago

pouriadodido commented 6 years ago

I'm a beginer in figaro and my IDE is Intellij. when I run a simple code without println(VariableElimination.probability()), I dont have any error. but when I use it ....... this is my program for testing:

import com.cra.figaro.language._ import com.cra.figaro.algorithm.factored.VariableElimination

object testFigaro { def main(args: Array[String]){ val sunnyToday = Flip(0.2) println(VariableElimination.probability(sunnyToday, true)) } }

And this is error:

Exception in thread "main" java.lang.NoClassDefFoundError: scala/reflect/runtime/package$ at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.makeResultFactor(VariableElimination.scala:238) at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.finish(VariableElimination.scala:242) at com.cra.figaro.algorithm.factored.VariableElimination.$anonfun$doElimination$5(VariableElimination.scala:175) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) at com.cra.figaro.algorithm.factored.VariableElimination.optionallyShowTiming(VariableElimination.scala:63) at com.cra.figaro.algorithm.factored.VariableElimination.doElimination(VariableElimination.scala:175) at com.cra.figaro.algorithm.factored.VariableElimination.doElimination$(VariableElimination.scala:163) at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.doElimination(VariableElimination.scala:213) at com.cra.figaro.algorithm.factored.VariableElimination.ve(VariableElimination.scala:160) at com.cra.figaro.algorithm.factored.VariableElimination.ve$(VariableElimination.scala:155) at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.ve(VariableElimination.scala:213) at com.cra.figaro.algorithm.factored.VariableElimination.run(VariableElimination.scala:186) at com.cra.figaro.algorithm.factored.VariableElimination.run$(VariableElimination.scala:186) at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.run(VariableElimination.scala:213) at com.cra.figaro.algorithm.OneTime.doStart(OneTime.scala:28) at com.cra.figaro.algorithm.OneTime.doStart$(OneTime.scala:26) at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.doStart(VariableElimination.scala:213) at com.cra.figaro.algorithm.Algorithm.start(Algorithm.scala:83) at com.cra.figaro.algorithm.Algorithm.start$(Algorithm.scala:80) at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.start(VariableElimination.scala:213) at com.cra.figaro.algorithm.factored.VariableElimination$.probability(VariableElimination.scala:359) at com.cra.figaro.algorithm.factored.VariableElimination$.probability(VariableElimination.scala:369) at testFigaro$.main(testFigaro.scala:7) at testFigaro.main(testFigaro.scala) Caused by: java.lang.ClassNotFoundException: scala.reflect.runtime.package$ at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 24 more

Please help me What should I do to deal with?

mreposa commented 6 years ago

Do you have Scala installed and on your execution path?

pouriadodido commented 6 years ago

I'm not sure.

mreposa commented 6 years ago

That's OK.... I can help you figure that out. Are you using Windows for your operating system?

pouriadodido commented 6 years ago

Thanks. yes my OS is Win.

mreposa commented 6 years ago

My apologies for the delay..... to verify Scala is installed, open a Windows command prompt and type:

scala -version

You should see output similar to this (depending on your Scala version):

Scala code runner version 2.12.4 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.

If you don't get this response, you should go to the Scala Web site and download the version of Scala for Windows that matches the version of Figaro you're working with (for instance, Figaro 5.0 requires Scala 2.12.2 or higher).

verrchu commented 6 years ago

got the same issue on macOS with Scala 12.2.6