符号编程的例子有哪些?

发布于 2024-09-24 05:44:21 字数 107 浏览 2 评论 0原文

我必须在符号编程课上做一个学期项目。但我不太确定什么是好的/合法的项目。谁能给我一些符号编程的例子?只是任何通用的想法,因为现在我倾向于回合制格斗游戏(基本上是 jrpg 风格),但我真的不想做游戏。

I have to do a term project in my symbolic programming class. But I'm not really sure what a good/legitimate project would be. Can anyone give me examples of symbolic programming? Just any generic ideas because right now I'm leaning towards a turn based fight game (jrpg style basically), but I really don't want to do a game.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

荒路情人 2024-10-01 05:44:21

Peter Norvig 的人工智能编程范式,Common Lisp 案例研究一书在这方面非常有用。

本书详细描述了使用 Common Lisp 进行符号 AI 编程。

这些示例属于计算机代数、解决数学任务、玩游戏、编译器实现等领域。

很快就会有另一本有趣的书:Conrad Barski 的The Land of Lisp

一般来说,符号编程有很多可能的应用:

  • 自然语言问答
  • 自然语言故事生成
  • 物流规划
  • 计算机代数
  • 技术系统故障诊断
  • 事物目录描述和匹配
  • 游戏
  • 场景 理解
  • 技术事物的配置

The book Paradigms of Artificial Intelligence Programming, Case Studies in Common Lisp by Peter Norvig is useful in this context.

The book describes in detail symbolic AI programming with Common Lisp.

The examples are in the domain of Computer Algebra, solving mathematical tasks, game playing, compiler implementation and more.

Soon there will be another fun book: The Land of Lisp by Conrad Barski.

Generally there are a lot of possible applications of Symbolic Programming:

  • natural language question answering
  • natural language story generation
  • planning in logistics
  • computer algebra
  • fault diagnosis of technical systems
  • description of catalogs of things and matching
  • game playing
  • scene understaning
  • configuration of technical things
¢蛋碎的人ぎ生 2024-10-01 05:44:21

Scheme 中的一个简单算术解释器,将符号列表作为输入:

(define (symbolic-arith lst)
  (case (car lst)
    ((add) (+ (cadr lst) (caddr lst)))
    ((sub) (- (cadr lst) (caddr lst)))
    ((mult) (* (cadr lst) (caddr lst)))
    ((div) (/ (cadr lst) (caddr lst)))
    (else (error "unknown operator"))))

测试运行:

> (symbolic-arith '(add 2 43))
=> 45
> (symbolic-arith '(sub 10 43))
=> -33
> (symbolic-arith '(mu 50 43))
unknown operator
> (symbolic-arith '(mult 50 43))
=> 2150

这显示了元循环解释器背后的基本思想。 Lisp in Small Pieces 是了解此类解释器的最佳场所。

另一个简单的例子,其中符号列表用于实现键值数据存储:

> (define person (list (cons 'name 'mat) (cons 'age 20)))
> person
=> ((name . mat) (age . 20))    
> (assoc 'name person)
=> (name . mat)
> (assoc 'age person)
=> (age . 20)

如果您是 Lisp 新手,Common Lisp:符号计算简介 是一个很好的起点。

A simple arithmetic interpreter in Scheme that takes a list of symbols as input:

(define (symbolic-arith lst)
  (case (car lst)
    ((add) (+ (cadr lst) (caddr lst)))
    ((sub) (- (cadr lst) (caddr lst)))
    ((mult) (* (cadr lst) (caddr lst)))
    ((div) (/ (cadr lst) (caddr lst)))
    (else (error "unknown operator"))))

Test run:

> (symbolic-arith '(add 2 43))
=> 45
> (symbolic-arith '(sub 10 43))
=> -33
> (symbolic-arith '(mu 50 43))
unknown operator
> (symbolic-arith '(mult 50 43))
=> 2150

That shows the basic idea behind meta-circular interpreters. Lisp in Small Pieces is the best place to learn about such interpreters.

Another simple example where lists of symbols are used to implement a key-value data store:

> (define person (list (cons 'name 'mat) (cons 'age 20)))
> person
=> ((name . mat) (age . 20))    
> (assoc 'name person)
=> (name . mat)
> (assoc 'age person)
=> (age . 20)

If you are new to Lisp, Common Lisp: A Gentle Introduction to Symbolic Computation is a good place to start.

壹場煙雨 2024-10-01 05:44:21

这并不是(只是)赤裸裸地试图窃取@Ken 的代表权。我不记得麦卡锡创建 Lisp 的最初动机是什么。但它当然适合计算机代数,包括微分和积分。

不过,我发帖的原因是,自动微分用于表示微分符号表达式之外的其他含义。它用于表示编写一个计算另一个函数的导数的函数。例如,给定一个计算 f(x) 的 Fortran 程序,自动微分工具将编写一个计算 f'(x) 的 Fortran 函数。当然,一种技术是尝试将程序转换为符号表达式,然后使用符号微分,然后再次将所得表达式转换为程序。

第一个是符号计算的一个很好的练习,尽管它被广泛使用,以至于它可能不是学期论文的好选择。第二个是活跃的研究前沿,OP 必须小心,不要贪多嚼不烂。然而,即使是有限的实施也会很有趣且具有挑战性。

This isn't (just) a naked attempt to steal @Ken's rep. I don't recall what McCarthy's original motivation for creating Lisp might have been. But it is certainly suitable for computer algebra, including differentiation and integration.

The reason that I am posting, though, is that automatic differentiation is used to mean something other than differentiating symbolic expressions. It's used to mean writing a function which calculate the derivative of another function. For example, given a Fortran program which calculates f(x) an automatic differentiation tool would write a Fortran function which calculates f'(x). One technique, of course, is to try to transform the program into a symbolic expression, then use symbolic differentiation, then transform the resulting expression into a program again.

The first of these is a nice exercise in symbolic computation, though it is so well trodden that it might not be a good choice for a term paper. The second is an active research front and OP would have to be careful not to bite off more than (s)he can chew . However, even a limited implementation would be interesting and challenging.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文