小编Nya*_*ope的帖子

求解器的约束满足问题VS系统搜索

我们必须解决一个难题,我们需要从系统中检查来自多个源的许多复杂规则,以确定系统是否满足这些规则或如何更改以满足它们.

我们最初开始使用Constraint Satisfaction Problems算法(使用Choco)来尝试解决它,但由于规则和变量的数量会比预期的要小,我们希望在数据库上构建所有可能配置的列表并使用多个请求关于过滤此列表的规则并以这种方式找到解决方案.

与将CSP求解器算法用于合理数量的规则和变量相比,进行系统搜索有限制或缺点吗?它会显着影响性能吗?它会减少我们可以实施的约束吗?

例如:

你必须想象它有更多的变量,更大的定义域(但总是离散的)和更多的规则(和一些更复杂的)但不是将问题描述为:

x in (1,6,9)
y in (2,7)
z in (1,6)
y = x + 1
z = x if x < 5 OR z = y if x > 5
Run Code Online (Sandbox Code Playgroud)

把它交给求解器我们会建一个表:

X | Y | Z
1   2   1
6   2   1
9   2   1
1   7   1
6   7   1
9   7   1
1   2   6
6   2   6
9   2   6
1   7   6
6   7   6
9   7 …
Run Code Online (Sandbox Code Playgroud)

algorithm complexity-theory search constraint-programming

8
推荐指数
1
解决办法
175
查看次数

Spring Boot @Configuration bean 名称冲突

我有一个项目,其中包含许多使用 @Configuration 类(Spring Integration 和 Spring Batch 的东西)定义 bean 的小库,我经常遇到问题,因为这两个库都有一个同名的 bean。

可以:

  • 对配置类的所有 bean 应用前缀
  • 如果存在两个同名的 bean,则强制应用程序在启动时崩溃
  • 使用另一种无需重新设计应用程序即可修复它的解决方案

spring spring-boot spring-java-config

5
推荐指数
1
解决办法
1339
查看次数

使用Apache CXF发送FastInfoset请求时,我可以在日志中使用XML吗?

我需要在应用程序的日志中提供请求和响应,但Apache CXF发送的请求在FastInfoset(Content-Type:application/fastinfoset)中,这导致请求和响应的日志不可读(因为它是二进制的) ).有没有办法解决这个问题,以便我保留FastInfoset消息(出于性能原因)但是我在日志中得到了正确的XML?

这是我现在拥有的CXF配置,如果有帮助的话:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/core"
    xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />

    <cxf:bus>
        <cxf:inInterceptors>
            <ref bean="logInbound" />
        </cxf:inInterceptors>
        <cxf:outInterceptors>
            <ref bean="logOutbound" />
        </cxf:outInterceptors>
        <cxf:outFaultInterceptors>
            <ref bean="logOutbound" />
        </cxf:outFaultInterceptors>
        <cxf:inFaultInterceptors>
            <ref bean="logInbound" />
        </cxf:inFaultInterceptors>
    </cxf:bus>
</beans>
Run Code Online (Sandbox Code Playgroud)

预先感谢您的任何帮助.

java web-services cxf jax-ws fastinfoset

5
推荐指数
1
解决办法
187
查看次数