Can A* be used to generate algorithm sourcecode?

0  

I thought of an idea to use a* algorithm to "walk" toward a solution that solves a programming problem. Each neighbour can be a weighted list of programming tasks such as if statement, for each, assignment, recursive call. How do you map example data structures transformations to code that fulfils the changes to the data structure? You need a cost function that decreases when the output gets nearer to the solution. What does the cost function for code solving a problem look similar to?

YAML 想法

If you project the desired code variables onto a multidimensional space and with a time dimension, where each variable has a assignment algebra you can imagine the input code causing movements to the output algebra for each variable

How do you measure that a solution gets nearer to the solution when you haven't planned what you could do

It should be a multidimensional walk toward a solution that solves the programming problem.

I want to generate the btree algorithm and other algorithms with this approach

I should provide example inputs to output mappings and join the Data between the input and output and try recalculate the processing steps to go from one to the other but I am having problems deciding what the cost function looks like.

chronological,


(別通知) (可選) 請,登錄

我有一個想法。如果您將輸出生成的代碼想象爲超集,那麼每一行代碼都是輸出代碼子集的一部分。

因此,您需要某種方式來生成輸出集的子集。

每個集合都是生成答案的有序指令集。我想避免暴力搜索,每次生成一行代碼的嘗試都應該更接近輸出。

我認爲我們必須提供代碼應該做什麼的啓發式方法。

I had a thought. If you imagine the output generated code as a superset then every line of code is part of a subset of the output code.

So you need some way of generating subsets of the output set.

Each set is an ordered set of instructions that generate the answer. I want to avoid brute force search, every attempt of generating a line of code should get nearer to the output.

I think we have to provide heuristics of approximately what the code should do.


我們可以掃描輸出結構並生成每個數據關係的事實。

我們可以根據源數據到目標數據的路徑遍歷來比較數據移動的位置。生成補丁。

這有一個指向這個對象的指針,指向這條數據。

輸入數據

Node1 是根

節點 1 子節點 2

節點 1 子節點 3

示例 1

插入一個節點node4

所需的輸出數據

Node1 是根

節點 1 子節點 2

節點 1 子節點 3

節點 1 子節點 4

修補

Node4 插入到 node1 子節點中

爲什麼是節點1?理論。

Node1 是根

針對 node1、node4 運行算子

Len(node1.children) <= Maxsize

示例 2

節點拆分 - 插入 node5

輸入數據

根節點是node1

節點 1 子節點 2

節點 1 子節點 3

節點 1 子節點 4

所需的目標數據

根節點是node3

節點 3 子節點 1

節點 3 子節點 2

節點 3 子節點 4

節點 4 子節點 5

這表示一個節點拆分,因爲每個節點裏面只能有 3 個項目。

我們如何學習一個節點只能有 3 個節點的規則?

在事實系統中插入一個常數

最大尺寸爲 3 在系統中插入運算符 Len(node.children) 最大尺寸 == 等於 >= 大於或等於 <= 小於或等於 > 大於 < 小於

運行每個運算符的每個排列以決定執行補丁命令步驟。

補丁說明 Node1 不再是根節點 Node3 是根節點 Node2 的子節點是 node1 從 node1 中刪除 node4 爲什麼從 node1 中刪除 node4 爲什麼node4被添加到node3

理論。什麼事實是真的。 將 node1 屬性與 node4 進行比較 最終.... Len(node1.children) == MaxSize 將node4添加到node3 爲什麼? 理論。什麼事實是真的 節點 4 >= 節點 3 真 >= 是否適用於所有示例?還是更復雜 扭動操作。一個下降,一個上升,下降連接一個下降。 根 = A 節點 1 是 A 新根 = B

扭曲操作是 - 根 = B B.兒童 = A

並查看數據移動到哪裏。我們需要生成確定性地在正確位置創建具有相同數據的相同結構的步驟。

應該有圖案。因此,對象中通常有一個屬性可以進行比較以進行 btree 拆分。

因此,在 btree 中最多有一個字段或一個比較來確定對象的目的地。

我認爲我們可以爲每個輸入對象隨機生成條件語句。

走補丁並插入條件對象。

這是一個圖形轉換問題

We can scan the output structure and generate facts of each relationship of data.

We can compare where the data moved through based on a path traversal of source data to destination data. Generate a patch.

This has a pointer to this object to this piece of data.

Input data

Node1 is root

Node1 children node2

Node1 children node3

Example 1

Insert a node node4

Desired Output data

Node1 is root

Node1 children node2

Node1 children node3

Node1 children node4

Patch

Node4 inserted into node1 children

Why node1? Theorise.

Node1 is root

Run operators against node1, node4

Len(node1.children) <= Maxsize

Example 2

Node split - insert node5

Input data

Root node is node1

Node1 children node2

Node1 children node3

Node1 children node4

Desired target data

Root node is node3

Node3 children node1

Node3 children node2

Node3 children node4

Node4 children node5

This represents a node split as each node can only have 3 items inside it.

How do we learn the rule that a node can only have 3 nodes?

Insert a constant into the system of facts

MaxSize is 3 Insert operators in system Len(node.children) MaxSize == Equal to

= Greater than or equal to <= Less than or equal to Greater than < Less than

Run every permutation of each operator to decide to do patch command steps.

Patch instructions Node1 is no longer root node Node3 is root node Node2 children is node1 Remove node4 from node1 Why was node4 removed from node1 Why was node4 added to node3

Theorise. What fact was true. Compare node1 properties to node4 Eventually.... Len(node1.children) == MaxSize Add node4 to node3 Why? Theorise. What fact is true Node4 >= Node3 true Does >= hold for all examples? Or is it more complicated Twist operation. One goes down, one goes up and going down joins one going down. Root = A Node1 is A New root = B

Twist operation is - Root = B B.children = A

And see where the data moves. We need to generate the steps that deterministically creates the same structure with the same data in the right places.

There shall be patterns. So there is usually a property in the object that is compared against to do a btree split.

So there is at most one field or a comparison that determines the destination of the object in the btree.

I thought we can randomly generate condition statements for each input object.

Walk the patch and insert condition objects.

It's a graph transformation problem