This guide has three parts:
このガイドは3つのパートからなります。
BehaviorSpace is a software tool integrated with NetLogo that allows you to perform experiments with models.
ビヘイビア・スペースは、モデルを使って実験を実行するNetLogoのソフトウェア統合ツールです。
BehaviorSpace runs a model many times, systematically varying the model's settings and recording the results of each model run. This process is sometimes called "parameter sweeping". It lets you explore the model's "space" of possible behaviors and determine which combinations of settings cause the behaviors of interest.
ビヘイビア・スペースは何度もモデルを実行し、計画的にモデル設定を様々に変化させ、それぞれのモデル実行の結果を記録します。 この過程は、時折パラメータスイーピングと呼ばれます。モデルの可能な行動空間を探索し、興味のある行動をもたらす設定の組み合わせを決定します。
If your computer has multiple processor cores, then by default, model runs will happen in parallel, one per core.
コンピュータがマルチ・コアを実装しているなら、モデルは1コア毎に並列実行します。
The need for this type of experiment is revealed by the following observations. Models often have many settings, each of which can take a range of values. Together they form what in mathematics is called a parameter space for the model, whose dimensions are the number of settings, and in which every point is a particular combination of values. Running a model with different settings (and sometimes even the same ones) can lead to drastically different behavior in the system being modeled. So, how are you to know which particular configuration of values, or types of configurations, will yield the kind of behavior you are interested in? This amounts to the question of where in its huge, multi-dimension parameter space does your model perform best?
以下の観察で、このタイプの実験の必要性が明らかにされます。多くの場合モデルは多数の設定があり、 それぞれは値の範囲を持っているかもしれません。それらはまとめて数学的にモデルのパラメータ空間と呼ばれ、 その次元は設定の数であり、各点は値の特定の組み合わせとなります。異なる設定でのモデルの実行は (たとえ同じ設定であっても)モデル化されたシステムで、根本的に異なる行動を導くかもしれません。 どのようにして、特定の値の設定、あるいは設定の種類が興味のある行動を引き起こすのかを知るのでしょうか。 これが、非常に大きな多次元パラメータ空間のどこで、モデルが最良の実行をするかの問題になります。
For example, suppose you want speedy synchronization from the agents in the Fireflies model. The model has four sliders -- number, cycle-length, flash-length and number-flashes -- that have approximately 2000, 100, 10 and 3 possible values, respectively. That means there are 2000 * 100 * 10 * 3 = 600,000 possible combinations of slider values! Trying combinations one at a time is hardly an efficient way to learn which one will evoke the speediest synchronization.
例えば、ホタルのモデルでエージェントからのすみやかな同期を得たいとします。モデルは4つのスライダー -- 数、サイクル長、発光長、発光数 -- を持ち、これらはそれぞれ 2000, 100, 10, 3 の可能な値を持っています。 つまり、2000 * 100 * 10 * 3 = 600,000 の可能なスライダー値の組み合わせがあるということです。 1回にひとつの組み合わせを実行することは、どの組み合わせが最速で同期を引き起こすかを学習するのに、 効果的な方法とは言えません。
BehaviorSpace offers you a much better way to solve this problem. If you specify a subset of values from the ranges of each slider, it will run the model with each possible combination of those values and, during each model run, record the results. In doing so, it samples the model's parameter space -- not exhaustively, but enough so that you will be able to see relationships form between different sliders and the behavior of the system. After all the runs are over, a dataset is generated which you can open in a different tool, such as a spreadsheet, database, or scientific visualization application, and explore.
ビヘイビア・スペースは、この問題を解決するもっと良い方法を提供します。 もし、それぞれのスライダーの範囲から値のサブセットを指定するなら、 それらの値の可能なそれぞれの組み合わせを実行し、記録します。 その実行中に、ビヘイビア・スペースはスライダーと行動の関係を見るために、 全てではありませんが十分なだけのモデルのパラメータ空間を抽出します。 すべての実行が終了した後、データセットが生成されます。これらは、表計算シートやデータベース、 可視化アプリケーション、エクスプローラなどで開くことができます。
By enabling you to explore the entire "space" of behaviors a model can exhibit, BehaviorSpace can be a powerful assistant to the modeler.
モデルが表す全ての行動空間を探索することができることで、ビヘイビア・スペースはモデル設計者への 強力なアシスタントになります。
To begin using BehaviorSpace, open your model, then choose the BehaviorSpace item on NetLogo's Tools menu.
ビヘイビア・スペースを使い始めるためには、自分のモデルを開いて、NetLogoのToolsメニューから BehaviorSpaceを選んでください。
The dialog that opens lets you create, edit, duplicate, delete, and run experiment setups. Experiments are listed by name and how by model runs the experiment will consist of.
開いたダイアログは、実験設定の作成、編集、複製、削除、実行を行います。
Experiment setups are considered part of a NetLogo model and are saved as part of the model.
実験設定は、NetLogoモデルの一部と考えられ、モデルの一部として保存されます。
To create a new experiment setup, press the "New" button.
新しい実験設定を作成するために、"New" ボタンを押してください.
In the new dialog that appears, you can specify the following information. Note that you don't always need to specify everything; some parts can be left blank, or left with their default values, depending on your needs.
新しいダイアログが現れ、以下の情報を指定できます。常に全部を指定する必要がないことに注意してください。 必要に応じて、いくつかはブランクのままでいいか、初期値のままで構いません。
Experiment name: If you have multiple experiments, giving them different names will help you keep them straight.
Experiment name: 複数の実験をするのであれば、異なる名前をつけることが整理をするのに役立ちます。
Vary variables as follows: This is where you specify which settings you want varied, and what values you want them to take. Variables can include sliders, switches, choosers, and any global variables in your model.
Vary variables as follows: ここで、どの設定が変化し、どの値になって欲しいのかを指定します。 変数には、モデルのスライダー、スイッチ、チューザ、任意のグローバル変数を含みます。
Variables can also include max-pxcor, min-pxcor, max-pycor and min-pycor, world-width, world-height and random-seed. These are not, strictly speaking, variables, but BehaviorSpace lets you vary them as if they were. Varying the world dimensions lets you explore the effect of world size upon your model. Since setting world-width and world-height does not necessarily define the bounds of the world how they are varied depends on the location of the origin. If the origin is centered, BehaviorSpace will keep it centered so the values world-width or world-height must be odd. If one of the bounds is at zero that bound will be kept at zero and the other bound will move, for example if you start with a world with min-pxcor = 0 max-pxcor = 10 and you vary world-width like this:
["world-width" [11 1 14]]
また、変数は、max-pxcor, min-pxcor, max-pycor と min-pycor, world-width, world-height と random-seedを含みます。 これらは、厳密には変数ではありませんが、ビヘイビア・スペースはそれらを変数かのように変化させます。 ワールドの大きさの変更は、 モデルにおけるワールドサイズの効果を探索します。 world-width と world-height の設定はワールドの境界を 定義する必要はないので、それらがどのように変化するのかは起点の位置によります。 起点の位置が中央にあるなら、ビヘイビア・スペースはそれが中央にあるように保ち、world-width あるいは world-height の値は奇数にしなければなりません。 境界のひとつがゼロなら、その境界はゼロを保ち、もう一方が移動します。 例えば、min-pxcor = 0 max-pxcor = 10 でワールドを開始するなら、 world-width をこのように変化させます。
["world-width" [11 1 14]]
min-pxcor will stay at zero and max-pxcor will set to 11, 12, and 13 for each of the runs. If neither of these conditions are true, the origin is not centered, nor at the edge of the world you cannot vary world-height or world-width directly but you should vary max-pxcor, max-pycor, min-pxcor and min-pycor instead.
min-pxcor をゼロにして、 max-pxcor を各実行ごとに11, 12, 13に設定します。これらの状態がどれも真でなければ、起点が中央ではなく、またワールドの端で world-height か world-width を変化させることができません。代わりに、 max-pxcor、 max-pycor、 min-pxcor、 min-pycor を変化させるべきです。
Varying random-seed lets you repeat runs by using a known seed for the NetLogo random number generator. Note that you're also free to use the random-seed command in your experiment's setup commands. For more information on random seeds, see the Random Numbers section of the Programmer's Guide.
random-seed の変化は、 NetLogo乱数生成器の既知のシードを使うことで、繰り返し実行をさせます。 実験の設定コマンドで、 random-seed コマンドを使うこともできます。プログラミングガイドのRandom Numbers の章を見てください。
You may specify values either by listing the values you want used, or by specifying that you want to try every value within a given range. For example, to give a slider named number every value from 100 to 1000 in increments of 50, you would enter:
["number" [100 50 1000]]
使用したい値をリストにすることや、所与の範囲内でのすべての値の試行を指定することによって、 値を指定してもかまいません。 例えば、スライダー名 number で100から1000まで50ずつ増加する値を与えるには、 このように入力します。
["number" [100 50 1000]]
Or, to give it only the values of 100, 200, 400, and 800, you would enter:
["number" 100 200 400 800]
あるいは、100、200、400、800の値だけを与えたい場合は、このように入力します。
["number" 100 200 400 800]
Be careful with the brackets here. Note that there are fewer square brackets in the second example. Including or not including this extra set of brackets is how you tell BehaviorSpace whether you are listing individual values, or specifying a range.
ここに括弧があることに注意してください。2つ目の事例では、括弧が少なくなっています。 この追加の括弧の組を含むか含まないかは、ビヘイビア・スペースに個別の値をリストにするか、 範囲指定をするかを示します。
Also note that the double quotes around the variable names are required.
また、変数名には二重引用符が要求されることも注意してください。
You can vary as many settings as you want, including just one, or none at all. Any settings that you do not vary will retain their current values. Not varying any settings is useful if you just want to do many runs with the current settings.
1から全部まで、求めたい設定数で変化させることができます。 変化させない設定は現在値に保ち続けます。 変化させない設定は、現在の設定を数多く実行したいときに役立ちます。
What order you list the variables in determines what order the runs will be done in. All values for a later variable will be tried before moving to the next value for an earlier variable. So for example if you vary both x and y from 1 to 3, and x is listed first, then the order of model runs will be: x=1 y=1, x=1 y=2, x=1 y=3, x=2 y=1, and so on.
どの順番で変数をリストにするのかは、どの順番で実行がされるかを決定します。 後にある変数のすべての値が、先にある変数の次の値へ移行する前に実行されます。 例えば、xとyのどちらも1から3に変化させ、xがリストの先にあるなら、モデルの実行順序は次のようになります。 x=1 y=1, x=1 y=2, x=1 y=3, x=2 y=1,...。
Repetitions: Sometimes the behavior of a model can vary a lot from run to run even if the settings don't change, if the model uses random numbers. If you want to run the model more than once at each combination of settings, enter a higher number.
Repetitions(反復): モデルが乱数を使用している時、モデルの行動は設定が変わらなくても、それぞれの実行で大きく変化することがあります。それぞれの設定の組み合わせで、1回より多くモデルを実行したい時は、より大きい数を入力してください。
Measure runs using these reporters: This is where you specify what data you want to collect from each run. For example, if you wanted to record how the population of turtles rose and fell during each run, you would enter:
count turtles
Measure runs using these reporters(レポータを使った実行の測定): これは、各実行で収集したいデータを指定するものです。 例えば、実行中にどのようにタートルの数が増加や減少するのかを求めたい時に、このように入力します。
count turtles
You can enter one reporter, or several, or none at all. If you enter several, each reporter must be on a line by itself, for example:
count frogs
count mice
count birds
1個、数個、あるいは0個のレポータを入力できます。数個を入力する時、例えば次のように各レポータは1列にしなければいけません。
count frogs
count mice
count birds
If you don't enter any reporters, the runs will still take place. This is useful if you want to record the results yourself your own way, such as with the export-world command.
レポータを入力しない時でも、実行は発生します。これは、export-world コマンド使う時のように、 自分自身の方法で結果を記録したい時に役立ちます。
Measure runs at every step: Normally NetLogo will measure model runs at every step, using the reporters you entered in the previous box. If you're doing very long model runs, you might not want all that data. Uncheck this box if you only want to measure each run after it ends.
Measure runs at every step(各ステップで実行を測定): 通常、NetLogoは各ステップでモデル実行を測定します。 もし非常に長時間モデル実行をする時は、すべてのデータを欲しくはないかもしれません。 各実行の最後だけ測定したい時にこのボックスのチェックを外してください。
Setup commands: These commands will be used to begin each model run. Typically, you will enter the name of a procedure that sets up the model, typically setup. But it is also possible to include other commands as well.
Setup commands: これらのコマンドは、各モデル実行の開始のために使われます。 一般的には、モデルをセットアップするプロシージャの名前 setup を入力します。 しかし、同様に他のコマンド含む可能性もあります。
Go commands: These commands will be run over and over again to advance to the model to the next "step". Typically, this will be the name of a procedure, such as go, but you may include any commands you like.
Go commands: このコマンドは、モデルを次の"ステップ"に進めるために繰り返し実行されます。一般的には、このコマンドは go のようなプロシージャ名になりますが、どのようなコマンドを含んでいても構いません。
Stop condition: This lets you do model runs of varying length, ending each run when a certain condition becomes true. For example, suppose you wanted each run to last until there were no more turtles. Then you would enter:
not any? turtles
Stop condition: これは、様々な長さでモデルを実行させ、指定した条件が真になると各実行を終了させます。例えば、タートルがいなくなるまで実行したいしたとすると、次のように入力します。
not any? turtles
If you want the length of runs to all be of a fixed length, just leave this blank.
実行がすべて固定長になるようにしたいなら、これは空白のままにしてください。
The run may also stop because the go commands use the stop command, in the same way that stop can be used to stop a forever button. The stop command may be used directly in the go commands, or in a procedure called directly by the go commands. (The intent is that the same go procedure should work both in a button and in a BehaviorSpace experiment.) Note that the step in which stop is used is considered to have been aborted, so no results will be recorded for that step. Therefore, the stopping test should be at the beginning of the go commands or procedure, not at the end.
stopコマンドが、 foreverボタンを停止するために使われるのと同じ方法で、 goコマンドは stop コマンドを使用するので、 実行が停止するかもしれません。 stop コマンドは、goコマンドの中、 あるいはgoコマンドで呼ばれるプロシージャで使用できます。(その意図は、同じ go プロシージャは、ボタンとビヘイビア・スペース実験の両方の中で作動するべきだということです。) stopが使われるステップは中断されていることに注意してください。このステップの結果は記録されません。従って、停止するテストは、goコマンドやプロシージャの最後ではなく始めに置かれるべきです。
Final commands: These are any extra commands that you want run once, when the run ends. Usually this is left blank, but you might use it to call the export-world command or record the results of the run in some other way.
Final commands: これらは、実行の最後に1回だけ実行をしたい時のコマンドです。 通常はブランクにしておきますが、export-world コマンドを呼ぶためや、何か他の方法で実行結果を記録したい時に使用してもよいです。
Time limit: This lets you set a fixed maximum length for each run. If you don't want to set any maximum, but want the length of the runs to be controlled by the stop condition instead, enter 0.
Time limit: これは、それぞれの実行の最大固定長を設定します。 最大値を設定したくなく、代わりに停止条件で制御される実行の長さを設定したいなら、0を入力してください。
Currently there is only one, behaviorspace-run-number. The run number reported by this primitive matches the run number used in the results files generated by BehaviorSpace.
現在はbehaviorspace-run-numberの一つだけがあります。 このプリミティブで記録される実行回数は、ビヘイビア・スペースで生成される結果ファイルの中で使われる実行回数と一致します。
When you're done setting up your experiment, press the "OK" button, followed by the "Run" button. A dialog titled "Run options" will appear.
実験のセットアップがされた時に、"OK" ボタンに続いて "Run" ボタンを押してください。 "Run options" という名前のダイアログが現れます。
The run options dialog lets you select the formats you would like the data from your experiment saved in. Data is collected for each run or step, according to the setting of Measure runs at every step option. In either case, the initial state of the system is recorded, after the setup commands run but before the go commands run for the first time.
実行オプションダイアログで、保存される実験のデータのフォーマットを選択します。 Measure runs at every stepオプションの設定に従って、データは各実行やステップから収集されます。
Table format lists each interval in a row, with each metric in a separate column. Table data is written to the output file as each run completes. Table format is suitable for automated processing of the data, such as importing into a database or a statistics package.
表のフォーマットは、個々の列の測定基準で、行の間隔を決めて表にします。 表のデータは実行が終了した時に出力ファイルへ書き込まれます。 表のフォーマットは、データベースや統計パッケージにインポートするようなデータの自動処理のために、 適切なものになります。
Spreadsheet format calculates the min, mean, max, and final values for each metric, and then lists each interval in a row, with each metric in a separate column. Spreadsheet data is more human-readable than Table data, especially if imported into a spreadsheet application.
表計算フォーマットは最小、平均、最大、最終値を計算し、個々の列の測定基準で、行の間隔を決めて表にします。 表計算アプリケーションにインポートする時に、表計算データは表データよりも人が読みやすくなっています。
(Note however that spreadsheet data is not written to the results file until the experiment finishes. Since spreadsheet data is stored in memory until the experiment is done, very large experiments could run out of memory. So you should disable spreadsheet output unless you really want it. If you do want spreadsheet output, note that if anything interrupts the experiment, such as a runtime error, running out of memory, or a crash or power outage, no spreadsheet results will be written. For long experiments, you may want to also enable table format as a precaution so that if something happens and you get no spreadsheet output you'll at least get partial table output.)
(しかし、表計算データは実験が終了するまで結果ファイルに書き込まれないことに注意してください。 表計算データは実験が終わるまでメモリに保存されないので、長時間の実験ではメモリ不足になるかもしれません。 ですので、本当に必要でなければ表計算シートへの出力は好ましくありません。 表計算シートへの出力をしたいときは、ランタイムエラー、メモリ不足、クラッシュ、停電など、 実験の邪魔が入ると表計算シートに記録されないことを注意してください。 長時間の実験では、もし何かが起きて表計算シートに出力されない時に、少なくとも不完全でも表には出力されるよう、 備えとして表フォーマットも可能にしても構いません。)
After selecting your output formats, BehaviorSpace will prompt you for the name of a file to save the results to. The default name ends in ".csv". You can change it to any name you want, but don't leave off the ".csv" part; that indicates the file is a Comma Separated Values (CSV) file. This is a plain-text data format that is readable by any text editor as well as by most popular spreadsheet and database programs.
出力フォーマットを選択した後、ビヘイビア・スペースは結果を保存するファイル名を促します。 デフォルトの名前は、".csv"が付きます。任意の名前に変更できますが、".csv"部分は 取らずに残してください。これはカンマ区切りファイルのことで、プレイン・テキストデータ・フォーマットです。 よく使われる表計算やデータベースプログラムと同じく、任意のテキストエディタで読むことができます。
The run options dialog also lets you select whether you want multiple model runs to happen in parallel, and if so, how many are allowed to be simultaneously active. This number will default to the number of processor cores in your computer.
実行オプションダイアログは、並列で複数のモデルを実行したいかどうかを選択します。 もししたいなら、同時にアクティブになる数を許可します。 この数は、初期値として、使用している計算機のプロセッサーコア数になっています。
There are a few cautions associated with parallel runs.
並列実行に関連するいくつかの注意があります。
First, if multiple runs are active, only one of them will be in the "foreground" and cause the view and plots to update. The other runs will happen invisibly in the background.
第1に、並列実行をアクティブにすると、そのうちの一つだけが"foreground" になり、 ビューとプロットの更新をします。他の実行はbackgroundで非表示になります。
Second, invisible background runs can't use primitives that only work in the GUI. For example, a background run can't make a movie.
第2に、非表示のbackground実行は、GUIでのみ動くプリミティブを使用できません。 例えば、background実行はムービーを作動できません。
Third, since parallel runs progress independently of each other, table format output may contain interleaved, out-of-order results. When you analyze your table data, you may wish to sort it by run number first. (Spreadsheet format output is not affected by this issue, since it is not written until the experiment completes or is aborted.)
第3に、並列実行はそれぞれ独立に進行するので、表フォーマットの出力は交互配置で、 順序がばらばらになるかもしれません。この表データを分析する時は、 最初に実行番号でソートすることを望むことになるかもしれません。 (表計算シート出力はこの問題に影響されません。なぜなら実験が完了あるいは中断するまで書き込まれないからです。)
Fourth, using all available processor cores may make your computer slow to use for other tasks while the experiment is running.
第4に、すべての有効なプロセッサーコアの使用は、実験が実行している間、他のタスクを使用するために、 計算機を遅くさせるかもしれません。
Fifth, doing runs in parallel will multiply the experiment's memory requirements accordingly. You may need to increase NetLogo's memory ceiling (see this FAQ entry).
第5に、並列実行をしていると、そのことで実験のメモリ要求が多重になります。 NetLogoのメモリ上限を増加する必要があるかもしれません(これはこのFAQを見てください)。
After you complete the run options dialog, another dialog will appear, titled "Running Experiment". In this dialog, you'll see a progress report of how many runs have been completed so far and how much time has passed. If you entered any reporters for measuring the runs, and if you left the "Measure runs at every step" box checked, then you'll see a plot of how they vary over the course of each run.
実行オプションダイアログが完了した後、"Running Experiment"というもう一つのダイアログが現れます。このダイアログでは、いままで何回実行を完了したのかと、時間経過の進行記録を見ることができます。 実行の測定のために何かレポータを入力しており、"Measure runs at every step" ボックスをチェックしていれば、各実行の進行でレポータがどのように変化したかのプロットを見ることができます。
You can also watch the runs in the main NetLogo window. (If the "Running Experiment" dialog is in the way, just move it to a different place on the screen.) The view and plots will update as the model runs. If you don't need to see them update, then use the checkboxes in the "Running Experiment" dialog to turn the updating off. This will make the experiment go faster.
メインNetLogoウィンドウで実行を見ることもできます。("Running Experiment" ダイアログが邪魔になっているなら、スクリーンの他の場所へ動かしてください。) ビューとプロットはモデル実行時に更新されます。更新する必要がなれけば、"Running Experiment" ダイアログのチェックボックスを更新オフにします。これは、より早く実験を実行させます。
If you want to stop your experiment before it's finished, press the "Abort" button. Any results generated so far will still be saved.
終了する前に実験を停止したいなら、"Abort" ボタンを押してください。 それでも、それまでに生成された結果が保存されます。
When all the runs have finished, the experiment is complete.
すべての実行が終了した時、実験は完了です。
It is possible to run BehaviorSpace experiments "headless", that is, from the command line, without any graphical user interface (GUI). This is useful for automating runs on a single machine or a cluster of machines.
コマンドラインからグラフィカル・ユーザ・インターフェイス(GUI)なしで、ビヘイビア・スペース実験の"headless"の実行が可能です。
No Java programming is required. Experiment setups can be created in the GUI and then run later from the command line, or, if you prefer, you can create or edit experiment setups directly using XML.
Javaプログラミングは不要です。実験のセットアップはGUIで作成でき、それからコマンドラインで実行します。 あるいは、好みで、XMLを使って直接に実験セットアップを作成、編集することができます。
Run Java with the org.nlogo.headless.Main class. The Main.main() method supports these arguments:
org.nlogo.headless.Main classを使ってJavaを実行してください。 このMain.main()メソッドはこれらの引数をサポートします。
--model is required. If you don't specify --experiment, you must specify --setup-file. By default no results are generated, so you'll usually want to specify either --table or --spreadsheet, or both. If you specify any of the world dimensions, you must specify all four.
--model は必須です。 --experiment を指定しないなら、--setup-file を指定しなければなりません。 デフォルトでは結果は生成されないので、通常は、--table あるいは --spreadsheet または両方を指定します。ワールドの大きさを指定するなら、4つ全てを指定しないといけません。
It is easiest if you create your experiment setup ahead of time in the GUI, so it is saved as part of the model. To run an experiment setup saved in a model, here is an example command line:
java -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire.nlogo \ --experiment experiment1 \ --table -
GUIで前もって実験設定を作成するが最も簡単です。モデルの一部として保存されます。 モデルに保存された実験設定を実行するためのコマンドラインの例です。
java -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire.nlogo \ --experiment experiment1 \ --table -
(For this to work, NetLogo.jar must be present along with the lib subdirectory containing necessary libraries. Both NetLogo.jar and lib are included with NetLogo.)
(この実行のために、NetLogo.jar が、必要なライブラリを含んだlib サブディレクトリと一緒に存在する必要があります。NetLogo.jar と lib は、 NetLogoに含まれています。)
After the named experiment has run, the results are sent to standard output in table format, as CSV. ("-" is how you specify standard output instead of output to a file.)
指名された実験を実行した後、結果はCSVのような表フォーマットで標準出力に送られます。 ("-" は、ファイルへの出力の代わりに、標準出力を指定する方法です。)
When running the headless.Main class as an application, it forces the system property java.awt.headless to be true. This tells Java to run in headless mode, allowing NetLogo to run on machines when a graphical display is not available.
アプリケーションとしてheadless.Main classを実行するとき、 それは強制的にシステムプロパティ java.awt.headless をtrueにします。 これは、Javaにheadlesモードで実行していることを伝え、NetLogoがGUIが有効でない時にマシン上で実行することを許します。
Note the use of -Xmx to specify a maximum heap size of one gigabyte. If you don't specify a maximum heap size, you will get your VM's default size, which may be unusably small. (One gigabyte is an arbitrary size which should be more than large enough for most models; you can specify a different limit if you want.)
-Xmx の使用は、最大1ギガバイトのヒープサイズを指定することに注意してください。 最大ヒープサイズを指定しないと、VMの初期サイズになり、使用に適さない小ささになるかもしれません。 (1ギガバイトは、多くのモデルにとって十分な大きさ以上になる恣意的なサイズです。 望むなら異なるサイズにすることもできます。)
Note the use of -Dfile.encoding=UTF-8. This forces all file I/O to use UTF-8 encoding. Doing so ensures that NetLogo can load all models consistently, and that file-* primitives work consistently on all platforms, including models containing Unicode characters.
-Dfile.encoding=UTF-8 の使用に注意してください。 これは、ファイルI/Oを UTF-8エンコーディングにします。 そうすることは、NetLogoがすべてのモデルを矛盾なくロードできることを保証します。 file-* プリミティブは、Unicode記号を持つモデルを含む、すべてのプラットフォームで動作します。
The required --model argument is used to specify the model file you want to open.
必須の--model 引数は、開きたいモデルファイルの指定に使われます。
The --experiment argument is used to specify the name of the experiment you want to run. (At the time you create an experiment setup in the GUI, you assign it a name.)
--experiment 引数は、実行したい実験の名前を指定するのに使われます。 (実験の設定を作成する時に、これに名前を設定します。)
Here's another example that shows some additional, optional arguments:
java -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire.nlogo \ --experiment experiment2 \ --max-pxcor 100 \ --min-pxcor -100 \ --max-pycor 100 \ --min-pycor -100
これは、いくつかの追加的でオプションの引数の例です。
java -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire.nlogo \ --experiment experiment2 \ --max-pxcor 100 \ --min-pxcor -100 \ --max-pycor 100 \ --min-pycor -100
Note the use of the optional --max-pxcor, --max-pycor, etc. arguments to specify a different world size than that saved in the model. (It's also possible for the experiment setup to specify values for the world dimensions; if they are specified by the experiment setup, then there is no need to specify them on the command line.)
モデルに保存されたサイズ以外の異なるワールドサイズを指定するオプションの --max-pxcor、--max-pycor 等の引数使用を覚えておいてください。 (ワールドの大きさを指定する実験設定のために可能です。コマンドラインでこれらを指定する必要はありません。)
Since neither --table nor --spreadsheet is specified, no results will be generated. This is useful if the experiment setup generates all the output you need by some other means, such as exporting world files or writing to a text file.
--table や --spreadsheet のどちらも指定しないと、結果は生成されません。 これは実験設定で、ワールドファイル出力やテキストファイル書き込みのような、他の方法によるすべての出力を生成する時に役立ちます。
Yet another example:
java -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire.nlogo \ --experiment experiment2 \ --table table-output.csv \ --spreadsheet spreadsheet-output.csv
さらに他の例:
java -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire.nlogo \ --experiment experiment2 \ --table table-output.csv \ --spreadsheet spreadsheet-output.csv
The optional --table <filename> argument specifies that output should be generated in a table format and written to the given file as CSV data. If - is specified as the filename, than the output is sent to the standard system output stream. Table data is written as it is generated, with each complete run.
オプションの--table <filename> 引数は、出力が表フォーマットで出力され、 CSVデータとしてファイルに書き込まれることを指定します。 ファイル名として - が指定されていると、出力は標準のシステム出力ストリームに送られます。 表データは、実行が完了し、結果が生成される時に書き込まれます。
The optional --spreadsheet <filename> argument specified that spreadsheet output should be generated and written to the given file as CSV data. If - is specified as the filename, than the output is sent to the standard system output stream. Spreadsheet data is not written out until all runs in the experiment are finished.
オプションの --spreadsheet <filename> 引数は、表計算シート出力が生成され、 CSVデータとしてファイルに書き込まれることを指定します。 ファイル名として - が指定されていると、出力は標準のシステム出力ストリームに送られます。 表計算シートデータは、実験のすべての実行が完了するまで、書き込まれません。
Note that it is legal to specify both --table and --spreadsheet, and if you do, both kinds of output file will be generated.
--table と --spreadsheetの両方の指定が可能であることに注意してください。 そのように指定すると、両方の出力ファイルが生成されます。
Here is one final example that shows how to run an experiment setup which is stored in a separate XML file, instead of in the model file:
java -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire.nlogo \ --setup-file fire-setups.xml \ --experiment experiment3
これは、モデルファイルの代わりに、XMLファイルに保存された実験設定がどのように実行するかを示す1つの最終的な例です。
java -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire.nlogo \ --setup-file fire-setups.xml \ --experiment experiment3
If the XML file contains more than one experiment setup, it is necessary to use the --experiment argument to specify the name of the setup to use.
XMLファイルが複数の実験設定を持つ時、セットアップの名前を指定するために、 --experiment を使用する必要があります。
In order to run any of these experiments in 3D add -Dorg.nlogo.is3d=true to any of these startup commands, for example:
java -Dorg.nlogo.is3d=true -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire3D.nlogo \ --experiment experiment1 \ --table -
3Dでこれらの実験を実行するためには、-Dorg.nlogo.is3d=true をスタートアップコマンドに追加してください。以下が例です。
java -Dorg.nlogo.is3d=true -Xmx1024m -Dfile.encoding=UTF-8 -cp NetLogo.jar \ org.nlogo.headless.Main \ --model Fire3D.nlogo \ --experiment experiment1 \ --table -
Note that you should supply a 3D model and there are also 3D arguments --max-pzcor <number> and --min-pzcor <number>.
3Dモデルの提供と3D引数 --max-pzcor <number>、--min-pzcor<number> もあることを覚えておいてください。
The next section has information on how to create standalone experiment setup files using XML.
次の章は、どのようにスタンドアローンの実験設定ファイルをXMLで作成するかの情報です。
We don't yet have detailed documentation on authoring experiment setups in XML, but if you already have some familiarity with XML, then the following pointers may be enough to get you started.
XMLで実験設定を記述する詳細なドキュメントはまだありません。 しかし、すでにXMLに精通しているなら、以下の指針はスタートするのに十分かもしれません。
The structure of BehaviorSpace experiment setups in XML is determined by a Document Type Definition (DTD) file. The DTD is stored in NetLogo.jar, as system/behaviorspace.dtd. (JAR files are also zip files, so you can extract the DTD from the JAR using Java's "jar" utility or with any program that understands zip format.)
XMLでのビヘイビア・スペース実験設定の構造は、Document Type Definition (DTD)ファイルによって 決められます。このDTDは、system/behaviorspace.dtd としてNetLogo.jarに保管されています。 (JARファイルはzipファイルでもあり、Javaの"jar" ユーティリティを使うか、 任意のzipフォーマットがわかるプログラムを使ってJARからDTDを解凍できます。
The easiest way to learn what setups look like in XML, though, is to author a few of them in BehaviorSpace's GUI, save the model, and then examine the resulting .nlogo file in a text editor. The experiment setups are stored towards the end of the .nlogo file, in a section that begins and ends with a experiments tag. Example:
<experiments> <experiment name="experiment" repetitions="10" runMetricsEveryStep="true"> <setup>setup</setup> <go>go</go> <exitCondition>not any? fires</exitCondition> <metric>burned-trees</metric> <enumeratedValueSet variable="density"> <value value="40"/> <value value="0.1"/> <value value="70"/> </enumeratedValueSet> </experiment> </experiments>
XMLの中で設定がどうなっているかを学ぶ最も簡単な方法は、ビヘイビア・スペースのGUIで、 それらの幾つかを書き、モデルを保存し、.nlogoファイルをテキストエディタで調べてみることです。 実験設定は、.nlogoファイルの最後の方に保存されます。 experiments タグで開始終了するセクションの中です。 例は以下です。
<experiments> <experiment name="experiment" repetitions="10" runMetricsEveryStep="true"> <setup>setup</setup> <go>go</go> <exitCondition>not any? fires</exitCondition> <metric>burned-trees</metric> <enumeratedValueSet variable="density"> <value value="40"/> <value value="0.1"/> <value value="70"/> </enumeratedValueSet> </experiment> </experiments>
In this example, only one experiment setup is given, but you can put as many as you want between the beginning and ending experiments tags.
この例では、一つ実験設定だけが与えられていますが、experiments タグの開始と終了の間に望むだけの数を置くことができます。
Between looking at the DTD, and looking at examples you create in the GUI, it will hopefully be apparent how to use the tags to specify different kind of experiments. The DTD specifies which tags are required and which are optional, which may be repeated and which may not, and so forth.
DTDとGUIで自分で作った例を見比べることで、実験の異なる種類を指定するタグの使い方が、うまくいくと明らかになるでしょう。
When XML for experiment setups is included in a model file, it does not begin with any XML headers, because not the whole file is XML, only part of it. If you keep experiment setups in their own file, separate from the model file, then the extension on the file should be .xml not .nlogo, and you'll need to begin the file with proper XML headers, as follows:
<?xml version="1.0" encoding="us-ascii"?> <!DOCTYPE experiments SYSTEM "behaviorspace.dtd">
実験設定のためのXMLがモデルファイルに含まれている時、それはXMLヘッダーで始まっていません。 なぜなら、すべてファイルがXMLなのではなく、ほんの一部だけだからです。 実験設定を自分のファイルに保存したいなら、モデルファイルを分けて、 ファイルの拡張子を.nlogoではなく.xmlにします。以下のような適切なXMLヘッダを使って、 そのファイルを開始する必要があります。
<?xml version="1.0" encoding="us-ascii"?> <!DOCTYPE experiments SYSTEM "behaviorspace.dtd">
The second line must be included exactly as shown. In the first line, you may specify a different encoding than us-ascii, such as UTF-8.
2行目が確実に含まれていなければなりません。 1行目の中に、UTF-8 のような、us-ascii とは異なるエンコーディングを指定しても構いません。
If BehaviorSpace is not sufficient for your needs, a possible alternative is to use our Controlling API, which lets you write Java code that controls NetLogo. The API lets you run BehaviorSpace experiments from Java code, or, you can write custom code that controls NetLogo more directly to do BehaviorSpace-like things. See the Controlling section of the User Manual for further details on both possibilities.
ビヘイビア・スペースが十分でないなら、可能な代替案としてAPI制御の使用があります。 これはNetLogoを制御するJavaコードを書くことになります。 APIは、ビヘイビア・スペース実験をJavaコードから実行させます。 あるいは、ビヘイビア・スペースのような事を行うために、より直接的にNetLogoを制御するカスタムコードを書くこともできます。 両者の可能性についてのさらなる詳細は、ユーザマニュアルのControlling セクションを見てください。