简单约束编程求解器 [英] Simple constraint programming solver

查看:208
本文介绍了简单约束编程求解器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图熟悉约束编程.

到目前为止,我看过的所有文档/视频仅包含基于CP库利用率(例如Choko,Gecode,JaCoP等)的顶级概念和代码示例的描述.

All documentation/videos I've seen so far just contain description of top-level concepts and code examples based on CP-libraries utilization (like Choko, Gecode, JaCoP etc).

我想至少用Java来实现一些简单的,没有任何库的东西.

I'd like to implement at least something simple in Java without any libraries.

是否有任何资源可以在Java/C#/C ++/Python中找到实现主要CP思想的工作代码? (至少是多花钱"的问题解决方案).

Are there any resources where I can find working code in Java/C#/C++/Python which implements main CP ideas? (at least "send more money" problem solution).

(或者,也许,如果有人可以在这里解释它,那就太好了).

(or, maybe, if somebody can explain it here, it would be great).

推荐答案

这取决于您要执行的操作.

It depends on what are you trying to do.

1-如果要开始使用约束编程(CP)工具,则需要首先了解这种方法的建模.为此,您可以将给定问题定义为一组约束,然后将模型发布到求解器(该求解器已经知道如何处理这些约束).

1- If you want to get started with Constraint Programming (CP) tools, you need first to understand modelling in this approach. For that, you have be able to define a given problem as a set of constraints then you post your model to a solver (that already knows how to deal with these constraints).

我个人觉得G12_MiniZinc_Distribution(可通过 http://www.minizinc.org/获得)非常好.开始的方式(最新的发行版附带了许多模型).如果您想查看CP模型的外观(wrt minizinc语法),也可以使用在线模型: http://www.hakank.org/微量锌.

I personally find the G12_MiniZinc_Distribution (available via http://www.minizinc.org/) and its latest tutorial a very good way to start (the latest distribution cames with a lot of models). There is also online models if you want to see how a CP model looks like (w.r.t minizinc syntax) : http://www.hakank.org/minizinc.

2-如果您对CP有较高的理论理解,您可能会直接从可用库中看到某些技术(例如,传播器)的实现,因为从头开始开发CP解算器(IMO)是一个愚蠢的主意. 这些是一些开源求解器/库:G12,Choco,Mistral或Or-Tools.

2- If you have an advanced theoretical understanding of CP, you may directly see the implementation of some techniques (e.g. propagators) from available libraries since developing a CP Solver from scratch is (IMO) a foolish idea. These are some open-source solvers/libraries : G12, Choco, Mistral, Or-Tools.

这篇关于简单约束编程求解器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆