简体   繁体   中英

ExceptionInInitializerError in Choco 3

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 IntVar s. I get no errors. When I try RealVar s, I always get errors.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM