WO2021161426A1 - プログラム生成装置、プログラム生成方法及びプログラム - Google Patents

プログラム生成装置、プログラム生成方法及びプログラム Download PDF

Info

Publication number
WO2021161426A1
WO2021161426A1 PCT/JP2020/005385 JP2020005385W WO2021161426A1 WO 2021161426 A1 WO2021161426 A1 WO 2021161426A1 JP 2020005385 W JP2020005385 W JP 2020005385W WO 2021161426 A1 WO2021161426 A1 WO 2021161426A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
value
unit
input
calculation
Prior art date
Application number
PCT/JP2020/005385
Other languages
English (en)
French (fr)
Inventor
利行 倉林
弘之 切貫
優 吉村
Original Assignee
日本電信電話株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電信電話株式会社 filed Critical 日本電信電話株式会社
Priority to PCT/JP2020/005385 priority Critical patent/WO2021161426A1/ja
Priority to US17/798,880 priority patent/US20230107200A1/en
Priority to JP2021577768A priority patent/JP7310943B2/ja
Publication of WO2021161426A1 publication Critical patent/WO2021161426A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models

Definitions

  • the present invention relates to a program generator, a program generation method, and a program.
  • Non-Patent Document 1 the relationship between an input / output example and a component of a program is learned, a component of a program having a high probability of being used for a given input / output example is estimated, and the component is programmed.
  • a technique for realizing efficient program synthesis by using it for the synthesis of is disclosed.
  • Non-Patent Document 2 discloses a technique for automatically synthesizing an Excel (registered trademark) function satisfying an input / output example of Excel (registered trademark).
  • the input / output example is only an example of the specifications that the program satisfies, and has the drawback that the amount of information is small. Therefore, a program that is overfitted to the input / output example may be generated, and there is a problem that the program desired by the user is not generated.
  • the present invention has been made in view of the above points, and an object of the present invention is to increase the possibility that a desired program is automatically generated.
  • the program generator is a program that inputs a value and a unit of the value, and executes a calculation related to the value and a calculation related to the unit corresponding to the calculation to obtain the value.
  • a generator that generates a calculation result and a program that outputs the calculation result of the unit by using a plurality of program components, and a set of one or more input values and units and an output value and a unit by changing the program. It has a modification part that generates a program to satisfy.
  • FIG. 10 It is a figure which shows the hardware configuration example of the program generation apparatus 10 in embodiment of this invention. It is a figure which shows the functional structure example of the program generation apparatus 10 in embodiment of this invention. It is a flowchart for demonstrating an example of the processing procedure executed by the program generation apparatus 10. It is a figure which shows an example of the program parts list. It is a figure which shows an example of an input / output example set. It is a figure which shows an example of the synthetic code generated by the change process of the synthetic code. It is a figure which shows an example of the removal of the description of the calculation part of a unit from a synthetic code.
  • FIG. 1 is a diagram showing a hardware configuration example of the program generation device 10 according to the embodiment of the present invention.
  • the program generation device 10 of FIG. 1 includes a drive device 100, an auxiliary storage device 102, a memory device 103, a CPU 104, an interface device 105, a display device 106, an input device 107, and the like, which are connected to each other by a bus B, respectively.
  • the program that realizes the processing in the program generation device 10 is provided by a recording medium 101 such as a CD-ROM.
  • a recording medium 101 such as a CD-ROM.
  • the program is installed in the auxiliary storage device 102 from the recording medium 101 via the drive device 100.
  • the program does not necessarily have to be installed from the recording medium 101, and may be downloaded from another computer via the network.
  • the auxiliary storage device 102 stores the installed program and also stores necessary files, data, and the like.
  • the memory device 103 reads and stores the program from the auxiliary storage device 102 when the program is instructed to start.
  • the CPU 104 realizes the function related to the program generation device 10 according to the program stored in the memory device 103.
  • the interface device 105 is used as an interface for connecting to a network.
  • the display device 106 displays a programmatic GUI (Graphical User Interface) or the like.
  • the input device 107 is composed of a keyboard, a mouse, and the like, and is used for inputting various operation instructions.
  • FIG. 2 is a diagram showing a functional configuration example of the program generation device 10 according to the embodiment of the present invention.
  • the program generation device 10 includes a program synthesis unit 11, a synthesis program execution unit 12, and an input / output result determination unit 13. Each of these parts is realized by a process of causing the CPU 104 to execute one or more programs installed in the program generation device 10.
  • FIG. 3 is a flowchart for explaining an example of a processing procedure executed by the program generation device 10.
  • step S101 the program synthesizing unit 11 synthesizes, for example, one or more program parts in the program parts list stored in the auxiliary storage device 102 by, for example, randomly combining them (N pieces). Generates the source code of the program (hereinafter referred to as "synthetic code").
  • FIG. 4 is a diagram showing an example of a program component list.
  • the data structure of the program parts list shown in FIG. 4 is described below in a format based on the BNF (Backus-Naur form) notation.
  • ⁇ Program parts list> :: Program parts + That is, the program parts list includes (source code) one or more program parts.
  • program components are classified into constants and methods.
  • one constant corresponds to one program component
  • one method corresponds to one program component. That is, the unit surrounded by the broken line in FIG. 4 corresponds to the unit of one program component.
  • the arguments of the uppermost method are [x_value, x_unit] and [y_value, y_unit].
  • the range enclosed in [] indicates one array.
  • the first element is a value (numerical value)
  • the second element is a character string indicating the unit of the value. That is, one argument is composed of a set of values and units.
  • x_value and y_value are the values of the arguments to be calculated originally.
  • x_unit is a character string indicating the unit of the value of x_value
  • y_unit is a character string indicating the unit of the value of y_value.
  • each method indicates the calculation method of the array. Specifically, in the calculation method of the array, the first element indicates a value calculation method, and the second element indicates a unit calculation method corresponding to the calculation method of the first element. That is, in the definition of each method, not only the calculation method related to the value (x_value, y_value) specified in the argument, but also the calculation method related to the unit (x_unit, y_unit) specified in the argument corresponding to the calculation method related to the value is also included. include. Therefore, each program component is defined to perform a calculation on an input unit and output a value calculation result and a unit calculation result in response to a calculation on the input value.
  • the unit calculation method corresponding to the value calculation basically follows the following rules. However, if there are exceptions, a separate rule may be provided. In the following rules, the calculation method of the unit of the value is shown when the calculation of the value is addition or subtraction, multiplication or division.
  • step S101 a process of randomly selecting a plurality of program parts and synthesizing the plurality of program parts to generate one synthetic code is repeated N times. As a result, N synthetic codes are generated.
  • the synthesis of program parts means that the calculations of a plurality of program parts are combined, and can be performed by using a known technique such as the technique described in Non-Patent Document 1.
  • each program part is represented by a tree structure in which the operator is the parent node and the variable, constant, or operator that is the operation target by the operator is the child node, and the node in the tree structure of any program part.
  • the composite code takes a set of values and units as input, executes the calculation related to the input unit corresponding to the calculation related to the input value, and executes the calculation related to the input unit, and the calculation result of the value and the calculation result of the unit. Includes a definition such as outputting.
  • the loop process L1 including steps S102 and S103 is executed for each composite code.
  • the synthetic code to be processed in the loop processing L1 is referred to as a “target code”.
  • step S102 the synthesis program execution unit 12 generates an execution-type program (hereinafter referred to as "synthesis program") by compiling and linking the target code.
  • synthesis program an execution-type program
  • the synthesis program execution unit 12 inputs each input / output example included in the input / output example set prepared in advance to the synthesis program (hereinafter referred to as “target synthesis program”) to input the target synthesis program. Execute and obtain an output for each input / output example (S103).
  • the input / output example set is information indicating conditions to be satisfied by the program to be generated (hereinafter referred to as “target program”) regarding input / output, and is stored in the auxiliary storage device 102, for example, by being preset.
  • FIG. 5 is a diagram showing an example of an input / output example set.
  • the data structure of the input / output example set shown in FIG. 5 is described below in a format based on the BNF notation.
  • One input / output example is a set of an input example and an output example.
  • An input example means one or more sets of input values (numerical values) and units of the input value
  • an output example means one or more sets of output values (numerical values) and units of the output value.
  • the synthesis program execution unit 12 executes the target synthesis program with the input values and units as inputs for each of the M input examples in step S103. Then, M output values and units are obtained.
  • the input / output result determination unit 13 When the loop processing L1 is completed, the input / output result determination unit 13 outputs an output example (output value and unit set) of the input / output example to which all the output value and unit sets belong to the input value corresponding to the output value and unit. It is determined whether or not there is a synthesis program that matches (S104). That is, it is determined whether or not there is a synthesis program in which all the output values and units obtained in step S103 are as expected (correct) in the synthesis program targeted for processing in the loop processing L1.
  • the program synthesis unit 11 executes the synthesis code change process (S105).
  • the synthetic code change process a part of the original synthetic code is changed to generate a plurality (N) synthetic codes.
  • N is the number of individuals (source code) in one generation of the genetic algorithm.
  • each synthetic code to which the genetic algorithm is applied is represented by, for example, a tree structure in which the operator is the parent node and the variable, constant, or operator that is the operation target by the operator is the child node. And the subtrees of the tree structure are subject to genetic manipulation.
  • the pass rate of output (the rate at which the output (output value and unit) was correct) may be used for the evaluation for selection of the individual to be targeted in N times of genetic manipulation.
  • a program component included in the program component list is used as a candidate to replace a part of the synthetic code of the previous generation in mutation.
  • FIG. 6 is a diagram showing an example of the synthetic code generated by the change process of the synthetic code. As shown in FIG. 6, N synthetic codes are generated by one synthetic process.
  • An existing library such as DEAP (https://deap.readthedocs.io/en/master/) may be used for the synthesis processing of the program using the genetic algorithm.
  • loop processing L1 and subsequent steps are executed for N synthetic codes. Therefore, in this case, steps S102 and S103 are executed N times.
  • step S104 if there is one or more synthesis programs satisfying the condition of step S104 (Yes in S104), the loop process L1 ends, and the process proceeds to step S106. That is, in the loop processing L1, a part of the synthetic code is repeatedly changed (the synthetic code is cumulatively changed part by part) until a program satisfying the input / output example generated in advance is generated, so that the input / output is input / output.
  • the target program that satisfies the example set is automatically generated.
  • step S106 the input / output result determination unit 13 removes (deletes) the description of the unit calculation part from the source code (synthesis code) of the synthesis program. If there are a plurality of synthesis programs that satisfy the conditions of step S104, the source code of each synthesis program may be the processing target of step S106.
  • FIG. 7 is a diagram showing an example of removing the description of the calculation part of the unit from the synthetic code.
  • the synthetic code c1 is an example of the synthetic code satisfying the condition of step S104.
  • the synthetic code c2 is an example of the synthetic code obtained by removing the description of the calculation part of the unit from the synthetic code c1. That is, in the synthetic code c2, the description related to the variables (x_unit, y_unit) corresponding to the unit in the synthetic code c1 is removed.
  • the input / output result determination unit 13 outputs a composite code from which the description of the unit calculation part has been removed (S107). That is, it is determined that the synthetic program related to the synthetic code is the target program.
  • a program (numerical calculation system) in which unit information is included in addition to a value for an input / output example and is expected to satisfy input / output for both the value and the unit.
  • Program is automatically generated. That is, when the input / output example is applied to the program obtained by synthesizing the program parts and the program obtained by changing a part of the program, not only the numerical calculation but also the unit calculation is performed. It is confirmed whether not only the output value but also the unit matches the unit of the output example given in advance.
  • a program for obtaining the area of a square is a desired program. It is assumed that the user gives an input value 2 and an output value 4 as an input / output example. In this case, the program x * x should be output, but the program x + x can also be output to satisfy the input / output example.
  • unit information such as an input value of 2 [m] and an output value of 4 [m * m] is added, and not only the numerical value at the time of calculation but also the calculation of the unit is executed. Then, since the value output by the program x + x is 4 [m], it can be determined that it is inappropriate. As a result, it is possible to play an inappropriate program and increase the possibility that a desired program is automatically generated.
  • the program synthesis unit 11 is an example of a generation unit and a modification unit.
  • Program generation device 11 Program synthesis unit 12 Synthesis program execution unit 13 Input / output result determination unit 100 Drive device 101 Recording medium 102 Auxiliary storage device 103 Memory device 104 CPU 105 Interface device 106 Display device 107 Input device B Bus

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Artificial Intelligence (AREA)
  • Genetics & Genomics (AREA)
  • Evolutionary Biology (AREA)
  • Mathematical Physics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Stored Programmes (AREA)

Abstract

プログラム生成装置は、値及び前記値の単位を入力とするプログラムであって、前記値に関する計算と前記計算に対応した前記単位に関する計算とを実行して前記値の計算結果及び前記単位の計算結果を出力するプログラムを、複数のプログラム部品を用いて生成する生成部と、前記プログラムを変更して、1以上の入力値及び単位と出力値及び単位との組を満たすプログラムを生成する変更部と、を有することで、所望のプログラムが自動生成される可能性を高める。

Description

プログラム生成装置、プログラム生成方法及びプログラム
 本発明は、プログラム生成装置、プログラム生成方法及びプログラムに関する。
 近年、社会全体のIT化が進む一方で、IT人材の不足が大きな問題となっている。経済産業省の試算によると、2025年には約36万人のIT人材が不足すると予測されている。特に専門的な知識を必要とする実装工程におけるIT人材の不足は喫緊の課題であり、自動でプログラミングを行う自動プログラミング技術の研究開発が求められている。
 従来、自動プログラミング技術としては、ユーザがプログラムの入出力例を与え、それを満たすようにプログラムの部品を合成する技術が有る。
 例えば、非特許文献1には、入出力例とプログラムの部品の関係性を学習し、与えられた入出力例に対して使用される確率の高いプログラムの部品を推定して、当該部品をプログラムの合成に用いることで、効率的なプログラム合成を実現する技術が開示されている。
 また、非特許文献2には、Excel(登録商標)の入出力例からそれを満たすExcel(登録商標)関数を自動合成する技術が開示されている。
Matej Balog, Alexander L. Gaunt, Marc Brockschmidt, Sebastian Nowozin, Daniel Tarlow、 " DeepCoder: Learning to Write Programs" Proceedings of ICLR'17、[online]、インターネット<URL:https://www.microsoft.com/en-us/research/publication/deepcoder-learning-write-programs/> Sumit Gulwani、"Automating String Processing in Spreadsheets Using Input-Output Examples" POPL '11 Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages Pages 317-330、[online]、インターネット<URL:https://dl.acm.org/citation.cfm?id=1926423>
 しかしながら、入出力例は、プログラムが満たす仕様の一例にすぎず、情報量が少ないといった欠点がある。そのため入出力例にオーバーフィッティングしたプログラムが生成されてしまうことがあり、ユーザの所望するプログラムが生成されないという課題が存在する。
 本発明は、上記の点に鑑みてなされたものであって、所望のプログラムが自動生成される可能性を高めることを目的とする。
 そこで上記課題を解決するため、プログラム生成装置は、値及び前記値の単位を入力とするプログラムであって、前記値に関する計算と前記計算に対応した前記単位に関する計算とを実行して前記値の計算結果及び前記単位の計算結果を出力するプログラムを、複数のプログラム部品を用いて生成する生成部と、前記プログラムを変更して、1以上の入力値及び単位と出力値及び単位との組を満たすプログラムを生成する変更部と、を有する。
 所望のプログラムが自動生成される可能性を高めることができる。
本発明の実施の形態におけるプログラム生成装置10のハードウェア構成例を示す図である。 本発明の実施の形態におけるプログラム生成装置10の機能構成例を示す図である。 プログラム生成装置10が実行する処理手順の一例を説明するためのフローチャートである。 プログラム部品リストの一例を示す図である。 入出力例セットの一例を示す図である。 合成コードの変更処理によって生成される合成コードの一例を示す図である。 合成コードからの単位の計算部分の記述の除去の一例を示す図である。
 以下、図面に基づいて本発明の実施の形態を説明する。図1は、本発明の実施の形態におけるプログラム生成装置10のハードウェア構成例を示す図である。図1のプログラム生成装置10は、それぞれバスBで相互に接続されているドライブ装置100、補助記憶装置102、メモリ装置103、CPU104、インタフェース装置105、表示装置106、及び入力装置107等を有する。
 プログラム生成装置10での処理を実現するプログラムは、CD-ROM等の記録媒体101によって提供される。プログラムを記憶した記録媒体101がドライブ装置100にセットされると、プログラムが記録媒体101からドライブ装置100を介して補助記憶装置102にインストールされる。但し、プログラムのインストールは必ずしも記録媒体101より行う必要はなく、ネットワークを介して他のコンピュータよりダウンロードするようにしてもよい。補助記憶装置102は、インストールされたプログラムを格納すると共に、必要なファイルやデータ等を格納する。
 メモリ装置103は、プログラムの起動指示があった場合に、補助記憶装置102からプログラムを読み出して格納する。CPU104は、メモリ装置103に格納されたプログラムに従ってプログラム生成装置10に係る機能を実現する。インタフェース装置105は、ネットワークに接続するためのインタフェースとして用いられる。表示装置106はプログラムによるGUI(Graphical User Interface)等を表示する。入力装置107はキーボード及びマウス等で構成され、様々な操作指示を入力させるために用いられる。
 図2は、本発明の実施の形態におけるプログラム生成装置10の機能構成例を示す図である。図2において、プログラム生成装置10は、プログラム合成部11、合成プログラム実行部12及び入出力結果判定部13を有する。これら各部は、プログラム生成装置10にインストールされた1以上のプログラムが、CPU104に実行させる処理により実現される。
 以下、プログラム生成装置10が実行する処理手順について説明する。図3は、プログラム生成装置10が実行する処理手順の一例を説明するためのフローチャートである。
 ステップS101において、プログラム合成部11は、例えば、補助記憶装置102に記憶されているプログラム部品リストの中の1以上のプログラム部品を、例えば、ランダムに組み合わせて合成することで、複数(N個)のプログラムのソースコード(以下、「合成コード」という。)を生成する。
 図4は、プログラム部品リストの一例を示す図である。図4に示されるプログラム部品リストのデータ構造をBNF(Backus-Naur form)記法に基づく形式によって記すと以下の通りである。
<プログラム部品リスト>::=プログラム部品+
 すなわち、プログラム部品リストは、1以上のプログラム部品(のソースコード)を含む。図4では、定数とメソッドとにプログラム部品が分類されている。ここで、1つの定数が1つのプログラム部品に相当し、1つのメソッドが1つのプログラム部品に相当する。すなわち、図4において破線で囲まれた単位が、1つのプログラム部品の単位に相当する。
 本実施の形態では、各メソッドの各引数について、値だけでなく当該値の単位も入力可能なように構成されている。例えば、図4において最上段のメソッドの引数は、[x_value,x_unit]、[y_value,y_unit]である。ここで、[]で囲まれた範囲は、1つの配列を示す。当該配列において、第1要素は値(数値)であり、第2要素は当該値の単位を示す文字列である。すなわち、1つの引数は、値及び単位の組によって構成される。具体的には、x_value及びy_valueは、本来の計算対象の引数の値である。一方、x_unitは、x_valueの値の単位を示す文字列であり、y_unitは、y_valueの値の単位を示す文字列である。
 また、各メソッドの定義は、当該配列の計算方法を示す。具体的には、当該配列の計算方法において、第1要素は値の計算方法を示し、第2要素は第1要素の計算方法に対応した単位の計算方法を示す。すなわち、各メソッドの定義には、引数に指定された値(x_value、y_value)に関する計算方法のみではなく、値に関する計算方法に対応した、引数に指定された単位(x_unit、y_unit)に関する計算方法も含まれている。したがって、各プログラム部品は、入力された値に関する計算に対応して、入力された単位に関する計算を行い、値の計算結果及び単位の計算結果を出力するように定義されている。
 値の計算に対応した単位の計算方法は、基本的に以下のルールに従う。但し、例外がある場合は、別途ルールが設けられてもよい。以下のルールでは、値の計算が、加算又は減算、乗算又は除算の場合について、当該値の単位の計算方法が示されている。
 [加算、減算の場合]
(1)単位が同一の値同士の加算、減算では、当該単位を加算結果又は減算結果の単位とする。
例:1[m]+2[m]=3[m]
(2)単位が異なる変数同士の加算又は減算がソースコード中に存在した場合、当該ソースコードは不適切なソースコードとする。
 [乗算、除算の場合]
 単位が同一、不同一に関わらず値の乗算、除算と同様に計算する。
例:1[m]*2[m]=2[m*m]
例:1[m]*2=2[m]
例:1[m]*2[g]=2[m*g]
例:1[m]/2[m]=1/2
 ステップS101では、ランダムに複数のプログラム部品を選択し、当該複数のプログラム部品を合成することで1つの合成コードを生成するといった処理がN回繰り返される。その結果、N個の合成コードが生成される。なお、プログラム部品の合成とは、複数のプログラム部品の計算が組み合わされることをいい、例えば、非特許文献1に記載された技術等、公知技術を用いて行うことができる。例えば、各プログラム部品を、演算子を親ノードとし、当該演算子による演算対象である変数、定数、又は演算子を子ノードとする木構造によって表現し、いずれかのプログラム部品の木構造のノードを、他のプログラム部品の木構造によって置換することで、これらのプログラム部品を合成することができる。なお、合成コードは、プログラム部品と同様に、値及び単位の組を入力とし、入力された値に関する計算に対応して入力された単位に関する計算を実行し、値の計算結果及び単位の計算結果を出力するといった定義を含む。
 続いて、合成コードごとにステップS102及びS103を含むループ処理L1が実行される。以下、ループ処理L1において処理対象とされている合成コードを「対象コード」という。
 ステップS102において、合成プログラム実行部12は、対象コードをコンパイル及びリンク等することで、実行形式のプログラム(以下「合成プログラム」という。)を生成する。
 続いて、合成プログラム実行部12は、当該合成プログラム(以下「対象合成プログラム」という。)に対し、予め用意されている入出力例セットに含まれる各入出力例を入力して対象合成プログラムを実行し、入出力例ごとに出力を得る(S103)。入出力例セットは、入出力に関して生成対象のプログラム(以下「対象プログラム」という。)が満たすべき条件を示す情報であり、例えば、予め設定されて補助記憶装置102に記憶されている。
 図5は、入出力例セットの一例を示す図である。図5に示される入出力例セットのデータ構造をBNF記法に基づく形式によって記すと以下の通りである。
<入出力例セット>::=<入出力例>+
<入出力例>::=<入力例><出力例>
<入力例>::=<入力値 単位>+
<出力例>::=<出力値 単位>+
 すなわち、入出力例セットは1以上の入出力例を含む。1つの入出力例は入力例及び出力例の組である。入力例とは入力値(数値)及び当該入力値の単位の1以上の組をいい、出力例とは出力値(数値)及び当該出力値の単位の1以上の組をいう。
 例えば、入出力例セットに含まれる入出力例がM個である場合、合成プログラム実行部12は、ステップS103において、M個の入力例ごとに当該入力値及び単位を入力として対象合成プログラムを実行し、M個の出力値及び単位を得る。
 ループ処理L1が終了すると、入出力結果判定部13は、全ての出力値及び単位の組が当該出力値及び単位に対応する入力値が属する入出力例の出力例(出力値及び単位の組)に一致する合成プログラムの有無を判定する(S104)。すなわち、ループ処理L1において処理対象とされた合成プログラムの中で、ステップS103において得られた全ての出力値及び単位が期待通りであった(正しかった)合成プログラムの有無が判定される。
 該当する合成プログラムが無い場合(S104でNo)、プログラム合成部11は、合成コードの変更処理を実行する(S105)。合成コードの変更処理では、元の合成コードの一部を変更して、複数(N個)の合成コードが生成される。合成コードの一部の変更には、例えば、遺伝的アルゴリズムが用いられてもよい。すなわち、前世代の合成コードに対してN回の遺伝的操作が行われて、N個の次世代の合成コードが生成されてもよい。ここで、Nは、遺伝的アルゴリズムの一世代における個体(ソースコード)の個数である。この際、遺伝的アルゴリズムの適用対象とされる各合成コードは、例えば、演算子を親ノードとし、当該演算子による演算対象である変数、定数、又は演算子を子ノードとする木構造によって表現され、木構造の部分木が遺伝的操作の対象とされる。N回の遺伝的操作において対象とされる個体の選択のための評価には、出力の合格率(出力(出力値及び単位)が正解だった割合)が用いられてもよい。
 また、突然変異において前世代の合成コードの一部に置き換わる候補として、例えば、プログラム部品リストに含まれるプログラム部品が用いられる。
 図6は、合成コードの変更処理によって生成される合成コードの一例を示す図である。図6に示されるように、1回の合成処理によってN個の合成コードが生成される。
 なお、遺伝的アルゴリズムを用いたプログラムの合成処理には、DEAP(https://deap.readthedocs.io/en/master/)等、既存のライブラリを用いられてもよい。
 続いて、N個の合成コードについてループ処理L1以降が実行される。したがって、この場合、ステップS102及びS103はN回実行される。
 一方、ステップS104の条件を満たす合成プログラムが1以上有る場合(S104でYes)、ループ処理L1が終了し、ステップS106へ進む。すなわち、ループ処理L1では、予め生成された入出力例を満たすプログラム生成されるまで合成コードの一部の変更が繰り返される(合成コードが一部ずつ累積的に変更される)ことで、入出力例セットを満たすような対象プログラムが自動生成される。
 ステップS106において、入出力結果判定部13は、当該合成プログラムのソースコード(合成コード)から、単位の計算部分の記述を除去(削除)する。なお、ステップS104の条件を合成プログラムが複数有る場合、それぞれの合成プログラムのソースコードがステップS106の処理対象とされればよい。
 図7は、合成コードからの単位の計算部分の記述の除去の一例を示す図である。図7において、合成コードc1は、ステップS104の条件を満たす合成コードの一例である。合成コードc2は、合成コードc1から単位の計算部分の記述を除去することで得られる合成コードの一例である。すなわち、合成コードc2では、合成コードc1において単位に対応する変数(x_unit,y_unit)に関連する記述が除去されている。
 続いて、入出力結果判定部13は、単位の計算部分の記述が除去された合成コードを出力する(S107)。すなわち、当該合成コードに係る合成プログラムが対象プログラムであると判定される。
 上述したように、本実施の形態によれば、入出力例に対して値に加えて単位の情報が含められ、値及び単位の双方について入出力を満たすことが期待されるプログラム(数値計算系のプログラム)が自動生成される。すなわち、プログラム部品を合成して得られたプログラム、及び当該プログラムの一部を変更することで得られるプログラムに対して入出力例を適用した計算時に、数値計算だけでなく単位の計算も行い、出力値だけでなく単位も予め与えられた出力例の単位と一致するかどうかが確認される。
 例えば、正方形の面積を求めるプログラムが所望のプログラムであるとする。ユーザが入出力例として、入力値2、出力値4を与えたとする。この場合、x*xというプログラムが出力されるべきだが、x+xというプログラムでも入出力例を満たすため出力されうる。一方、本実施の形態では、入力値2[m]、出力値4[m*m]のように単位の情報も追加され、計算時の数値だけでなく単位の計算も実行される。すると、x+xというプログラムの出力する値は4[m]となるため、不適切であると判定することができる。その結果、不適切なプログラムを弾くことができ、所望のプログラムが自動生成される可能性を高めることができる。
 なお、本実施の形態において、プログラム合成部11は、生成部及び変更部の一例である。
 以上、本発明の実施の形態について詳述したが、本発明は斯かる特定の実施形態に限定されるものではなく、請求の範囲に記載された本発明の要旨の範囲内において、種々の変形・変更が可能である。
10     プログラム生成装置
11     プログラム合成部
12     合成プログラム実行部
13     入出力結果判定部
100    ドライブ装置
101    記録媒体
102    補助記憶装置
103    メモリ装置
104    CPU
105    インタフェース装置
106    表示装置
107    入力装置
B      バス

Claims (5)

  1.  値及び前記値の単位を入力とするプログラムであって、前記値に関する計算と前記計算に対応した前記単位に関する計算とを実行して前記値の計算結果及び前記単位の計算結果を出力するプログラムを、複数のプログラム部品を用いて生成する生成部と、
     前記プログラムを変更して、1以上の入力値及び単位と出力値及び単位との組を満たすプログラムを生成する変更部と、
    を有することを特徴とするプログラム生成装置。
  2.  前記変更部は、前記1以上の入力値及び単位と出力値及び単位との組を満たすプログラムが生成されるまで、前記プログラムの一部の変更を累積的に繰り返す、
    ことを特徴とする請求項1記載のプログラム生成装置。
  3.  値及び前記値の単位を入力とするプログラムであって、前記値に関する計算と前記計算に対応した前記単位に関する計算とを実行して前記値の計算結果及び前記単位の計算結果を出力するプログラムを、複数のプログラム部品を用いて生成する生成手順と、
     前記プログラムを変更して、1以上の入力値及び単位と出力値及び単位との組を満たすプログラムを生成する変更手順と、
    をコンピュータが実行することを特徴とするプログラム生成方法。
  4.  前記変更手順は、前記1以上の入力値及び単位と出力値及び単位との組を満たすプログラムが生成されるまで、前記プログラムの一部の変更を累積的に繰り返す、
    ことを特徴とする請求項3記載のプログラム生成方法。
  5.  請求項3又は4記載のプログラム生成方法をコンピュータに実行させることを特徴とするプログラム。
PCT/JP2020/005385 2020-02-12 2020-02-12 プログラム生成装置、プログラム生成方法及びプログラム WO2021161426A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/JP2020/005385 WO2021161426A1 (ja) 2020-02-12 2020-02-12 プログラム生成装置、プログラム生成方法及びプログラム
US17/798,880 US20230107200A1 (en) 2020-02-12 2020-02-12 Program generation apparatus, program generation method and program
JP2021577768A JP7310943B2 (ja) 2020-02-12 2020-02-12 プログラム生成装置、プログラム生成方法及びプログラム

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2020/005385 WO2021161426A1 (ja) 2020-02-12 2020-02-12 プログラム生成装置、プログラム生成方法及びプログラム

Publications (1)

Publication Number Publication Date
WO2021161426A1 true WO2021161426A1 (ja) 2021-08-19

Family

ID=77292205

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2020/005385 WO2021161426A1 (ja) 2020-02-12 2020-02-12 プログラム生成装置、プログラム生成方法及びプログラム

Country Status (3)

Country Link
US (1) US20230107200A1 (ja)
JP (1) JP7310943B2 (ja)
WO (1) WO2021161426A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024075160A1 (ja) * 2022-10-03 2024-04-11 日本電信電話株式会社 データ変換装置、データ変換方法及びプログラム

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11934801B2 (en) * 2021-12-07 2024-03-19 Microsoft Technology Licensing, Llc Multi-modal program inference

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04135235A (ja) * 1990-09-27 1992-05-08 Shimadzu Corp プログラム部品合成システム
JP2003323413A (ja) * 2002-05-01 2003-11-14 Hiroshi Tsuchida 単位操作機能を持つ数式演算処理プログラム

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2828735B2 (ja) * 1990-05-24 1998-11-25 科学技術庁航空宇宙技術研究所長 複合プログラム用入出力データの物理単位系自動変換方式
JP4135235B2 (ja) 1998-11-17 2008-08-20 凸版印刷株式会社 積層体およびその製造方法
KR100435311B1 (ko) 2001-10-30 2004-06-10 에프이에이소프트(주) 공학용 해석시뮬레이션 소프트웨어의 단위환산장치
JP2004280714A (ja) 2003-03-18 2004-10-07 Hitachi Ltd 設計支援管理方法及び設計支援管理システム並びに設計支援管理のためのプログラム
JP4033018B2 (ja) 2003-03-31 2008-01-16 三菱電機株式会社 温度制御装置
US10289962B2 (en) * 2014-06-06 2019-05-14 Google Llc Training distilled machine learning models
US11307962B2 (en) * 2018-07-09 2022-04-19 United States Of America As Represented By The Secretary Of The Navy Method for semantic preserving transform mutation discovery and vetting
US11775352B1 (en) * 2022-11-28 2023-10-03 Fmr Llc Automated prediction of computing resource performance scaling using reinforcement learning

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04135235A (ja) * 1990-09-27 1992-05-08 Shimadzu Corp プログラム部品合成システム
JP2003323413A (ja) * 2002-05-01 2003-11-14 Hiroshi Tsuchida 単位操作機能を持つ数式演算処理プログラム

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
NAITO ATSUSHI, TANIMITSU KASHIWATO, HIGO HIGO, SHINJI SUGAMOTO, HIROYUKI HIROYUKI, KURASAYO GENGU, TANNO HANDY: "Automatic program correction technical application for corporate software development", SOFTWARE ENGINEERING SYMPOSIUM 2018; SEPTEMBER 5 - 7, 2018, 29 August 2018 (2018-08-29) - 7 September 2018 (2018-09-07), JP, pages 139 - 147, XP009530447 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024075160A1 (ja) * 2022-10-03 2024-04-11 日本電信電話株式会社 データ変換装置、データ変換方法及びプログラム

Also Published As

Publication number Publication date
JP7310943B2 (ja) 2023-07-19
US20230107200A1 (en) 2023-04-06
JPWO2021161426A1 (ja) 2021-08-19

Similar Documents

Publication Publication Date Title
WO2021161426A1 (ja) プログラム生成装置、プログラム生成方法及びプログラム
JP7351352B2 (ja) プログラム生成装置、プログラム生成方法及びプログラム
JP4886838B2 (ja) 並列化方法、システム、及びプログラム
WO2010113330A2 (en) Method and apparatus for design space exploration in high level synthesis
JP2009181446A (ja) プログラム生成装置およびブロック線図生成装置
JP5479942B2 (ja) 並列化方法、システム、及びプログラム
US10915302B2 (en) Identification and visualization of associations among code generated from a model and sources that affect code generation
JPWO2019189249A1 (ja) 学習装置、学習方法、及びプログラム
Mosaner et al. Using machine learning to predict the code size impact of duplication heuristics in a dynamic compiler
CN113128015B (zh) 预估单振幅模拟量子计算所需资源的方法和系统
WO2021161427A1 (ja) プログラム生成装置、プログラム生成方法及びプログラム
Paler SurfBraid: A concept tool for preparing and resource estimating quantum circuits protected by the surface code
JP7468209B2 (ja) プログラム生成装置、プログラム生成方法及びプログラム
WO2022249255A1 (ja) プログラム生成装置、プログラム生成方法及びプログラム
WO2021161428A1 (ja) プログラム生成装置、プログラム生成方法及びプログラム
JP2010204855A (ja) プログラム生成装置およびブロック線図生成装置
CN111126012A (zh) 定制生成表达式方法及装置
WO2022230190A1 (ja) プログラム生成装置、プログラム生成方法及びプログラム
JP2023003531A (ja) プログラム生成装置、プログラム生成方法及びプログラム
WO2011090032A1 (ja) 並列処理プログラム生成方法、並列処理プログラム生成プログラム、及び並列処理プログラム生成装置
WO2022239179A1 (ja) プログラム生成装置、プログラム生成方法及びプログラム
JP3246043B2 (ja) コンパイラ装置
Bernard et al. Inferring Temporal Parametric L-systems Using Cartesian Genetic Programming
JP2002312167A (ja) 変数の値をコンピュータに算出させるためのプログラム、コンパイルプログラム、変数値確定方法およびプログラム生成方法
JPH02236638A (ja) レジスタ割付け管理方式

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20918308

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021577768

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20918308

Country of ref document: EP

Kind code of ref document: A1