0

When I try to run the example in Choco's website:

    Solver solver = new Solver();
    double PREC = 0.01d; // precision
    RealVar x = VariableFactory.real("x", -1.0d, 1.0d, PREC, solver);
    RealVar y = VariableFactory.real("y", -1.0d, 1.0d, PREC, solver);
    RealConstraint rc = new RealConstraint(
            "my fct",
            "({0}*{1})+sin({0})=1.0;ln({0}+[-0.1,0.1])>=2.6",
            Ibex.HC4,
            x, y);
    solver.post(rc);
    solver.findSolution();

I get the following output:

00:04:12,592 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
00:04:12,592 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
00:04:12,593 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/C:/Users/Onur/Desktop/workspace/coverbylines/choco-solver-3.3.1-sources.jar!/logback.xml]
00:04:12,594 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
00:04:12,594 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/C:/Users/Onur/Desktop/workspace/coverbylines/choco-solver-3.3.1-with-dependencies.jar!/logback.xml]
00:04:12,594 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/C:/Users/Onur/Desktop/workspace/coverbylines/choco-solver-3.3.1-sources.jar!/logback.xml]
00:04:12,617 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@59a6e353 - URL [jar:file:/C:/Users/Onur/Desktop/workspace/coverbylines/choco-solver-3.3.1-sources.jar!/logback.xml] is not of type file
00:04:12,674 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
00:04:12,694 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
00:04:12,698 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
00:04:12,722 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
00:04:12,778 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Using current interpretation time, i.e. now, as time reference.
00:04:12,796 |-INFO in ch.qos.logback.core.joran.action.TimestampAction - Adding property to the context with key="bySecond" and value="20150627_000412" to the LOCAL scope
00:04:12,797 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [solver] to OFF
00:04:12,797 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to OFF
00:04:12,797 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
00:04:12,798 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
00:04:12,799 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@7a0ac6e3 - Registering current configuration as safe fallback point

Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.chocosolver.solver.Solver.getIbex(Solver.java:1088)
    at org.chocosolver.solver.constraints.real.RealPropagator.<init>(RealPropagator.java:83)
    at org.chocosolver.solver.constraints.real.RealConstraint.createPropagator(RealConstraint.java:151)
    at org.chocosolver.solver.constraints.real.RealConstraint.<init>(RealConstraint.java:78)
    at coverbylines.Test.main(Test.java:40)
Caused by: org.chocosolver.solver.exception.SolverException
    at org.chocosolver.solver.constraints.real.Ibex.<clinit>(Ibex.java:106)
    ... 5 more

What would be my mistake? When I run it with IntVars. I get no errors. When I try RealVars, I always get errors.

Dan
  • 7,286
  • 6
  • 49
  • 114
padawan
  • 1,295
  • 1
  • 17
  • 45
  • Well, have you looked at line 106 of `Ibex.java`? It would help if the `SolverException` had a message, admittedly... – Jon Skeet Jun 26 '15 at 21:12
  • @JonSkeet I cannot access Ibex.java, unfortunately. – padawan Jun 26 '15 at 21:14
  • 1
    Why not? It's open source. It looks like [this](https://github.com/chocoteam/choco3/blob/master/choco-solver/src/main/java/org/chocosolver/solver/constraints/real/Ibex.java) is the file, and it also looks like the message should be "Ibex is not correctly installed (see http://www.emn.fr/z-info/ibex/)." – Jon Skeet Jun 26 '15 at 21:19
  • @JonSkeet Is there any way that I can understand which part of the installation is not correct? I have followed all the steps carefully. Terminal says `'install' finished successfully (3m0.778s)` – padawan Jun 28 '15 at 17:22
  • It looks like it can't load the native library, but that's all I know. – Jon Skeet Jun 28 '15 at 17:47

1 Answers1

0

You have to declare the following JVM option:

-Djava.library.path=/path/to/Ibex/lib

The path /path/to/Ibex/lib points to the lib directory of your Ibex installation directory.

cprudhom
  • 111
  • 4