当我尝试在 Choco 的网站上运行示例时:
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();
我得到以下输出:
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
我的错误是什么?当我用IntVar
s 运行它时。我没有错误。当我尝试RealVar
s 时,我总是会出错。