diff --git a/docs/en/_toc.yml b/docs/en/_toc.yml index 3739be0..76a160a 100644 --- a/docs/en/_toc.yml +++ b/docs/en/_toc.yml @@ -4,31 +4,32 @@ format: jb-book root: introduction parts: - - caption: Switch Language - chapters: - - url: https://jij-inc.github.io/JijModeling-Tutorials/ja/ - title: 日本語 - - caption: Quick Start - chapters: - - file: quickstart/scip - - file: quickstart/openjij - - caption: Tutorial - chapters: - - file: tutorials/creating_models - - file: tutorials/types_and_bounds - - file: tutorials/expressions - - file: tutorials/constraint_and_penalty - - caption: Reference - chapters: - - url: https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html - title: "jijmodeling API Reference" - - file: references/tips - - file: references/cheat_sheet - - caption: Release Note - chapters: - - file: releases/jijmodeling-1.12.0 - - file: releases/jijmodeling-1.11.0 - - file: releases/jijmodeling-1.10.1 - - file: releases/jijmodeling-1.10.0 - - file: releases/jijmodeling-1.9.0 - - file: releases/jijmodeling-1.8.0 +- caption: Switch Language + chapters: + - url: https://jij-inc.github.io/JijModeling-Tutorials/ja/ + title: 日本語 +- caption: Quick Start + chapters: + - file: quickstart/scip + - file: quickstart/openjij +- caption: Tutorial + chapters: + - file: tutorials/creating_models + - file: tutorials/types_and_bounds + - file: tutorials/expressions + - file: tutorials/constraint_and_penalty +- caption: Reference + chapters: + - url: https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html + title: jijmodeling API Reference + - file: references/tips + - file: references/cheat_sheet +- caption: Release Note + chapters: + - file: releases/jijmodeling-1.12.0 + - file: releases/jijmodeling-1.12.0 + - file: releases/jijmodeling-1.11.0 + - file: releases/jijmodeling-1.10.1 + - file: releases/jijmodeling-1.10.0 + - file: releases/jijmodeling-1.9.0 + - file: releases/jijmodeling-1.8.0 diff --git a/docs/en/releases/jijmodeling-1.10.0.ipynb b/docs/en/releases/jijmodeling-1.10.0.ipynb index bed8519..3f74a91 100644 --- a/docs/en/releases/jijmodeling-1.10.0.ipynb +++ b/docs/en/releases/jijmodeling-1.10.0.ipynb @@ -10,7 +10,7 @@ "\n", "## Feature Enhancements\n", "\n", - "### `Interpreter` 1-hot Constraint Detection\n", + "### 1-hot Constraint Detection in `Interpreter`\n", "\n", "The `Interpreter` now identifies 1-hot constraints during constraint evaluation in the following form:\n", "\n", diff --git a/docs/en/releases/jijmodeling-1.11.0.ipynb b/docs/en/releases/jijmodeling-1.11.0.ipynb index 2c0ee73..fc78416 100644 --- a/docs/en/releases/jijmodeling-1.11.0.ipynb +++ b/docs/en/releases/jijmodeling-1.11.0.ipynb @@ -20,7 +20,7 @@ "\n", "## Improvements in Hint Detection\n", "\n", - "- You can now `hints` optional argument to `eval_problem`, which specifies the list of constraint types to be detected. This should be useful when you use specific solvers that supports only a subset of constraint types are supported.\n", + "- You can now pass `hints` optional argument to `eval_problem`, which specifies the list of constraint types to be detected. This should be useful when you use specific solvers that supports only a subset of constraint types are supported.\n", " + `hints = None` (default): Detects the default set of constraint types (currently, `OneHot` only).\n", " + `hints = []`: Disables hint detection entirely.\n", "- Now hint detection mechanism can take into account some algebraic congruence (though not complete).\n", @@ -30,7 +30,7 @@ " \\sum_i 2 x_i + 1 = 3\n", " $$\n", "- Now `jm.eval_problem()` can derive additional constraints for duplicated variables. For example, if you have $\\sum_{i < 3} x_i = 1$ with $x_1 = x_2$, then it outputs new constraint $x_1 = 0$.\n", - "- `jm.eval_problem()` can now raise an exception when infeasible constraint is detected, e.g. $\\sum_{i < 0} x_i = 1$.\n", + "- `jm.eval_problem()` now raises an exception when infeasible constraint is detected, e.g. $\\sum_{i < 0} x_i = 1$.\n", "\n", "## Other Improvements\n", "\n", diff --git a/docs/en/releases/jijmodeling-1.12.1.ipynb b/docs/en/releases/jijmodeling-1.12.1.ipynb new file mode 100644 index 0000000..9282b5d --- /dev/null +++ b/docs/en/releases/jijmodeling-1.12.1.ipynb @@ -0,0 +1,146 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "source": [ + "# JijModeling 1.12.1 Release Notes\n", + "\n", + "## Feature Enhancements" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Human Readable Errors in Interpreters\n", + "\n", + "Now [`Interpreter`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Interpreter) fails with more human-readable error message. For example:" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{cccc}\\text{Problem:} & \\text{shift\\_optimization} & & \\\\& & \\min \\quad \\displaystyle \\sum_{d = 0}^{D - 1} \\sum_{t = 0}^{T - 1} \\sum_{i = 0}^{N - 1} x_{d, t, i} & \\\\\\text{{s.t.}} & & & \\\\ & \\text{night\\_shift} & \\displaystyle R_{d + 1, i} \\leq x_{d, T - 1, i} & \\forall d \\in \\left\\{0,\\ldots,D - 1\\right\\} \\forall i \\in \\left\\{0,\\ldots,N - 1\\right\\} \\\\\\text{{where}} & & & \\\\& x & 3\\text{-dim binary variable}\\\\\\end{array}$$" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import jijmodeling as jm\n", + "\n", + "D = jm.Placeholder(\"D\", dtype=jm.DataType.INTEGER)\n", + "T = jm.Placeholder(\"T\", dtype=jm.DataType.INTEGER)\n", + "N = jm.Placeholder(\"N\", dtype=jm.DataType.INTEGER)\n", + "H = jm.Placeholder(\"H\", shape=(D, T, N))\n", + "R = jm.Placeholder(\"R\", shape=(D, N))\n", + "\n", + "x = jm.BinaryVar(\"x\", shape=(D, T, N))\n", + "d = jm.Element(\"d\", belong_to=(0, D))\n", + "t = jm.Element(\"t\", belong_to=(0, T))\n", + "i = jm.Element(\"i\", belong_to=(0, N))\n", + "\n", + "problem = jm.Problem(name=\"shift_optimization\")\n", + "problem += jm.Constraint(\"night_shift\", R[d+1, i] <= x[d, T-1, i], forall=[d, i])\n", + "problem += jm.sum([d, t, i], x[d, t, i])\n", + "\n", + "problem" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Traceback (most recent last):\n", + " while evaluating Problem `shift_optimization',\n", + " while evaluating constraint: `night_shift',\n", + " while evaluating expression `R[d + 1, i] - x[d, T - 1, i]',\n", + " while evaluating expression `R[d + 1, i]',\n", + "\n", + "IndexError: Index [7, 0] is out of range for shape [7, 5]\n" + ] + } + ], + "source": [ + "num_days = 7\n", + "num_times = 3\n", + "num_people = 5\n", + "\n", + "data = problem.generate_random_dataset(\n", + " options={\n", + " \"D\": {\"value\": num_days},\n", + " \"T\": {\"value\": num_times},\n", + " \n", + " \"N\": {\"value\": num_people},\n", + " }\n", + ")\n", + "interp = jm.Interpreter(data)\n", + "\n", + "try:\n", + " interp.eval_problem(problem)\n", + "except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Bugfixes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Fixes the Performance Bug in `Interpreter.eval_*`.\n", + "\n", + "Previously, evaluating expressions with `Interpreter` takes much more times than intended.\n", + "This was due to the direct call to the arithmetic operations on OMMX `Function`s, which goes through conversion between intermediate expressions and re-allocates memory from the ground up. This results in quadratic performance degradation in some summation operations.\n", + "\n", + "Now JijModeling uses dedicated intermediate form of functions, so the overhead of conversion should be greatly tamed now." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.20" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/docs/ja/_toc.yml b/docs/ja/_toc.yml index e0a326d..3c5956d 100644 --- a/docs/ja/_toc.yml +++ b/docs/ja/_toc.yml @@ -4,31 +4,32 @@ format: jb-book root: introduction parts: - - caption: Switch Language - chapters: - - url: https://jij-inc.github.io/JijModeling-Tutorials/en/ - title: English - - caption: "クイックスタート" - chapters: - - file: quickstart/scip - - file: quickstart/openjij - - caption: "チュートリアル" - chapters: - - file: tutorials/creating_models - - file: tutorials/types_and_bounds - - file: tutorials/expressions - - file: tutorials/constraint_and_penalty - - caption: "リファレンス" - chapters: - - url: https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html - title: "jijmodeling API Reference" - - file: references/tips - - file: references/cheat_sheet - - caption: "リリースノート" - chapters: - - file: releases/jijmodeling-1.12.0 - - file: releases/jijmodeling-1.11.0 - - file: releases/jijmodeling-1.10.1 - - file: releases/jijmodeling-1.10.0 - - file: releases/jijmodeling-1.9.0 - - file: releases/jijmodeling-1.8.0 +- caption: Switch Language + chapters: + - url: https://jij-inc.github.io/JijModeling-Tutorials/en/ + title: English +- caption: クイックスタート + chapters: + - file: quickstart/scip + - file: quickstart/openjij +- caption: チュートリアル + chapters: + - file: tutorials/creating_models + - file: tutorials/types_and_bounds + - file: tutorials/expressions + - file: tutorials/constraint_and_penalty +- caption: リファレンス + chapters: + - url: https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html + title: jijmodeling API Reference + - file: references/tips + - file: references/cheat_sheet +- caption: リリースノート + chapters: + - file: releases/jijmodeling-1.12.0 + - file: releases/jijmodeling-1.12.0 + - file: releases/jijmodeling-1.11.0 + - file: releases/jijmodeling-1.10.1 + - file: releases/jijmodeling-1.10.0 + - file: releases/jijmodeling-1.9.0 + - file: releases/jijmodeling-1.8.0 diff --git a/docs/ja/releases/jijmodeling-1.10.0.ipynb b/docs/ja/releases/jijmodeling-1.10.0.ipynb index bed8519..4ea3f82 100644 --- a/docs/ja/releases/jijmodeling-1.10.0.ipynb +++ b/docs/ja/releases/jijmodeling-1.10.0.ipynb @@ -4,21 +4,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# JijModeling 1.10.0 Release Notes\n", + "# JijModeling 1.10.0 リリースノート\n", "\n", - "JijModeling 1.10.0 provides critical bug fixes and feature enhancements to improve the stability and functionality of the library.\n", + "JijModeling 1.10.0 は、ライブラリの安定性と利便性を向上させる重要なバグ修正と機能強化を含みます。\n", "\n", - "## Feature Enhancements\n", + "## 機能強化\n", "\n", - "### `Interpreter` 1-hot Constraint Detection\n", + "### `Interpreter` における one-hot 制約の検出\n", "\n", - "The `Interpreter` now identifies 1-hot constraints during constraint evaluation in the following form:\n", + "`Interpreter` は、制約評価の仮定で次の形式の one-hot 制約を検出するようになりました:\n", "\n", "$$\n", "\\sum_{i=1}^{n} x_i = 1, \\quad x_i \\in \\{0, 1\\}\n", "$$\n", "\n", - "This enhancement provides hints to improve solver performance for compatible solvers. Detected constraints can be accessed via the `constraint_hints` property in `ommx.v1.Instance`." + "この機能追加により、ソルバーのアダプタ実装時に利用可能な制約ヒントが提供されます。検出された制約ヒントは `ommx.v1.Instance` の `constraint_hints` プロパティからアクセスできます。" ] }, { @@ -34,13 +34,13 @@ "i = jm.Element(\"i\", belong_to=(0,n))\n", "\n", "problem = jm.Problem(\"problem\")\n", - "# Add 1-hot constraint\n", + "# one-hot 制約を追加\n", "problem += jm.Constraint(\"onehot\", jm.sum(i, x[i]) == 1)\n", "\n", "interpreter = jm.Interpreter({\"n\": 3})\n", "instance = interpreter.eval_problem(problem)\n", "\n", - "# Display detected constraint information\n", + "# 検出された制約ヒントの情報を表示\n", "print(instance.raw.constraint_hints)" ] }, @@ -48,25 +48,25 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Future updates will enable the detection of various constraints, including SOS1/SOS2 and n-hot constraints.\n", + "将来のアップデートでは、SOS1/SOS2 や n-hot 制約を含むさまざまな制約の検出が可能になる予定です。\n", "\n", - "### Further Improvements in Type Hints\n", + "### 型ヒントの更なる改善\n", "\n", - "Type hinting across submodules has been significantly improved to resolve Pyright errors that previously occurred. This improvement leverages advancements in `pyo3-stub-gen` ([see](https://github.com/Jij-Inc/pyo3-stub-gen/releases/tag/0.6.1)) to ensure seamless type checking in submodules.\n", + "Pythonサブモジュールを跨いだ型ヒントが大幅に改善され、これまで Pyright などで発生していた型エラーが解消されました。この改善は `pyo3-stub-gen` での機能改善([参考リンク](https://github.com/Jij-Inc/pyo3-stub-gen/releases/tag/0.6.1))に立脚しており、サブモジュールに対してもシームレスに型検査が行われるようになりました。\n", "\n", - "Prior to this release, type errors were common in submodules:\n", + "以前は、以下のようなサブモジュールへの呼び出しで型エラーが頻繁に発生していました:\n", "\n", "![image.png](./assets/jijmodeling-1.10.0_01.png)\n", "\n", - "These issues are now resolved, ensuring a more robust developer experience:\n", + "本リリースでこの問題は解消し、より快適な開発体験が得られるようになります:\n", "\n", "![image.png](./assets/jijmodeling-1.10.0_02.png)\n", "\n", - "## Bug Fixes\n", + "## バグ修正\n", "\n", - "### Fixed `ndim` Calculation for Jagged Arrays\n", + "### Jagged Array に対する `ndim` 計算の修正\n", "\n", - "This release resolves a logic error in calculating the ndim (number of dimensions) for jagged arrays. The bug caused errors during Interpreter initialization and prevented evaluation of instances loaded through the MIPLIB loader." + "このリリースでは、Jagged Arrayの次元 (`ndim`) 計算方法を修正しました。このバグは `Interpreter` の初期化中にエラーを引き起こし、MIPLIB から読み込まれたインスタンスの評価を妨げていました。" ] }, { @@ -77,12 +77,12 @@ "source": [ "import jijmodeling as jm\n", "\n", - "# Load MIPLIB instance \"air05\"\n", + "# MIPLIB インスタンス \"air05\" をロード\n", "dataset = jm.dataset.Miplib()\n", "problem, instance_data = dataset.load(\"air05\")\n", "\n", "try:\n", - " # In jijmodeling <= 1.9.0, either of these two lines would raise an InterpreterError\n", + " # jijmodeling <= 1.9.0 では、これらのいずれかの行が InterpreterError を引き起こします\n", " interpreter = jm.Interpreter(instance_data)\n", " interpreter.eval_problem(problem)\n", "except jm.InterpreterError as e:\n", @@ -93,9 +93,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Corrected Arithmetic Assignment Operator Behavior (`+=`) for Objective Functions\n", + "### 目的関数の算術代入演算子 (`+=`) の挙動を修正\n", "\n", - "A long-standing issue with the `+=` operator for objective functions has been fixed. Previously, adding to an existing objective would overwrite the original instead of appending to it." + "目的関数に対する `+=` 演算子に関する長期に渡ったバグを修正しました。これまで目的関数に対する `+=` は目的関数を置き換えてしまっていましたが、本バージョン以降は新たに項が加算されます。" ] }, { @@ -110,12 +110,12 @@ "y = jm.BinaryVar(\"y\")\n", "\n", "problem = jm.Problem(\"problem\")\n", - "# Add x to objective function\n", + "# x を目的関数に加算\n", "problem += x\n", - "# Add y to objective function\n", + "# y を目的関数に加算\n", "problem += y\n", "\n", - "# In jijmodeling <= 1.9.0, the objective function would be y instead of x + y\n", + "# jijmodeling <= 1.9.0 では x + y ではなく y になってしまっていた\n", "assert jm.is_same(problem.objective, x + y)" ] }, @@ -123,27 +123,24 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Changelog\n", + "## 変更履歴\n", "\n", - "### Bug Fixes\n", + "### バグ修正\n", "\n", - "- Fixed incorrect `ndim` calculation for jagged arrays, ensuring seamless `Interpreter` initialization and MIPLIB loader evaluation.\n", + "- Jagged Array の `ndim` 計算を修正し、Interpreter で MIPLIB 形式の評価をシームレスに行えるようになりました。\n", + "- 目的関数に対する `+=` 演算子が既存の目的関数に項を適切に追加するように修正しました。\n", "\n", - "- Resolved behavior of the `+=` operator to properly append terms to existing objective functions.\n", + "### 機能強化\n", "\n", - "### Feature Enhancements\n", - "\n", - "- 1-Hot Constraint Detection:\n", - " Supported constraints must adhere to the following form:\n", + "- One-Hot 制約検出:次の形式の制約を one-hot 制約として検出できるようになりました:\n", " $\n", " \\displaystyle \\sum_{i=1}^{n} x_i = 1, \\quad x_i \\in \\{0, 1\\}\n", " $\n", - " \n", - " - Left-hand side: exactly one summation symbol.\n", - " - Summation operand: a single binary variable with an index.\n", - " - Constraint type: equality.\n", - " - Right-hand side: a NumberLit with value of 1.\n", - "- Resolved Pyright errors in submodules by improving type hint support through `pyo3-stub-gen` enhancements." + " - 左辺: 正確に1つの総和記号。\n", + " - 総和の被演算子: インデックス付きの単一のバイナリ変数。\n", + " - 制約タイプ: 等式。\n", + " - 右辺: 定数 `1`。\n", + "- `pyo3-stub-gen` の改善を通じて型ヒントサポートを向上させ、サブモジュールに対する Pyright エラーを解消しました。" ] } ], diff --git a/docs/ja/releases/jijmodeling-1.10.1.ipynb b/docs/ja/releases/jijmodeling-1.10.1.ipynb index d60d554..cd9f88f 100644 --- a/docs/ja/releases/jijmodeling-1.10.1.ipynb +++ b/docs/ja/releases/jijmodeling-1.10.1.ipynb @@ -4,14 +4,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# JijModeling 1.10.1 Release Notes\n", + "# JijModeling 1.10.1 リリースノート\n", "\n", - "Fixed an issue where the interpreter would fail to evaluate summation and product expressions if they included conditional statements referencing another index variable within their indexing sets. In previous versions (<= 1.10.0), applying conditions to one index in a summation that depended on another index in the same summation scope would cause an `InterpreterError`. This has now been resolved, allowing conditions within complex multi-index summations to be evaluated correctly." + "他の添え字つき変数を参照する条件文を含む総和・総積の式の評価に失敗する問題を修正しました。以前のバージョン(<= 1.10.0)では、同一総和でスコープに導入された別の添え字に依存する条件を総和の1つのインデックスに適用すると、`InterpreterError` が発生していました。この問題は解決され、複雑な多インデックス総和内の条件が正しく評価されるようになりました。" ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -24,14 +24,14 @@ "j = jm.Element(\"j\", belong_to=(0, m))\n", "\n", "problem = jm.Problem(\"problem\")\n", - "# Previously, the following summation would fail because it includes a condition\n", - "# on j that depends on i, both defined within the same summation scope.\n", + "# 以前は、次の総和は失敗していました。なぜなら、同じ総和スコープ内で\n", + "# i に依存する j の条件を含んでいるからです。\n", "problem += jm.sum([i, (j, j != i)], x[i, j])\n", "\n", "interpreter = jm.Interpreter({\"n\": 3, \"m\": 2})\n", "try:\n", - " # Before 1.10.1, this would raise an InterpreterError.\n", - " # Now, it evaluates successfully.\n", + " # 1.10.1 より前は、これは InterpreterError を引き起こしていました。\n", + " # 現在は、正常に評価されます。\n", " interpreter.eval_problem(problem)\n", "except jm.InterpreterError as e:\n", " print(\"InterpreterError:\", e)" diff --git a/docs/ja/releases/jijmodeling-1.11.0.ipynb b/docs/ja/releases/jijmodeling-1.11.0.ipynb index 2c0ee73..976351c 100644 --- a/docs/ja/releases/jijmodeling-1.11.0.ipynb +++ b/docs/ja/releases/jijmodeling-1.11.0.ipynb @@ -2,39 +2,43 @@ "cells": [ { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "ini" + } + }, "source": [ - "# JijModeling 1.11.0 Release Notes\n", + "# JijModeling 1.11.0 リリースノート\n", "\n", - "## Bugfix: `Interpreter` is now more liberal on duplicated constraint name\n", + "## バグ修正: `Interpreter` が重複制約名に対してより寛容に\n", "\n", - "Since JijModeling v1.10.0, `Interpreter` cannot have more than one constraints with the same name, which is not the case with <= 1.9.\n", - "Now, `Interpreter` is more liberal on duplicated constraint names:\n", + "JijModeling v1.10.0以降、`Interpreter` は同じ名前の制約を複数持つことができませんでしたが、1.9以前のバージョンではそうではありませんでした。\n", + "今回、`Interpreter` は重複した制約名に対してより寛容になり、以下のような挙動をするようになりました:\n", "\n", - "- It now treats constraints seprately for each problem, so constraints from distinct problems won't cause any name collision.\n", - "- If the newly evaluated constraint has the same name as the previously evaluated constraints, it won't cause error if either:\n", - " 1. it has the same definition on the already-defined `forall` parameters, or\n", - " 2. the `forall` parameter is previously undefined.\n", + "- 問題ごとに制約を個別に扱うようになり、異なる問題の間で同名の制約が衝突しなくなりました。\n", + "- 新しく評価された制約と同名の評価済制約が存在する場合、以下のいずれかの条件を満たせばエラーを引き起こしません。\n", + " 1. 定義済の `forall` パラメータ上では定義が一致する場合\n", + " 2. 追加される `forall` パラメータが以前では未定義である場合\n", "\n", - "This change allows more intuitive treatment of problem relaxation or partition.\n", + "この変更により、問題の緩和や分割の直感的な取り扱いが可能になります。\n", "\n", - "## Improvements in Hint Detection\n", + "## 制約ヒント検出機能の改善\n", "\n", - "- You can now `hints` optional argument to `eval_problem`, which specifies the list of constraint types to be detected. This should be useful when you use specific solvers that supports only a subset of constraint types are supported.\n", - " + `hints = None` (default): Detects the default set of constraint types (currently, `OneHot` only).\n", - " + `hints = []`: Disables hint detection entirely.\n", - "- Now hint detection mechanism can take into account some algebraic congruence (though not complete).\n", - " + For example, it can now detects the following as the one-hot constraint:\n", - " $$\n", - " 0 = 1 - \\sum_i (2 - 1) x_i\\\\\n", - " \\sum_i 2 x_i + 1 = 3\n", - " $$\n", - "- Now `jm.eval_problem()` can derive additional constraints for duplicated variables. For example, if you have $\\sum_{i < 3} x_i = 1$ with $x_1 = x_2$, then it outputs new constraint $x_1 = 0$.\n", - "- `jm.eval_problem()` can now raise an exception when infeasible constraint is detected, e.g. $\\sum_{i < 0} x_i = 1$.\n", + "- `eval_problem` に `hints` オプション引数を渡すことができるようになりました。これにより、検出する制約タイプのリストを指定できます。特定の制約タイプのみをサポートするソルバーを使用する場合に便利です。\n", + " + `hints = None`(デフォルト):デフォルトの制約タイプセットを検出します(現在は `OneHot` のみ)。\n", + " + `hints = []`:ヒント検出を完全に無効にします。\n", + "- ヒント検出メカニズムは、代数的同値性をある程度考慮できるようになりました。\n", + " + 例えば、次のような制約を One-Hot 制約として検出できるようになりました:\n", + " $$\n", + " 0 = 1 - \\sum_i (2 - 1) x_i\\\\\n", + " \\sum_i 2 x_i + 1 = 3\n", + " $$\n", + "- `jm.eval_problem()` は、重複した変数に対して追加の制約を導き出すことができるようになりました。例えば、$\\sum_{i < 3} x_i = 1$ かつ $x_1 = x_2$ のような制約が与えられた場合、追加的な制約 $x_1 = 0$ を出力します。\n", + "- `jm.eval_problem()` は、実行不可能な制約が検出された場合、例外を発生させるようになりました。例えば、$\\sum_{i < 0} x_i = 1$ のような入力は実行時例外となります。\n", "\n", - "## Other Improvements\n", + "## その他の変更\n", "\n", - "- Now stub file has more functions with type hints!" + "- Stubファイルにより多くの型ヒントが追加されました!\n" ] } ], diff --git a/docs/ja/releases/jijmodeling-1.12.0.ipynb b/docs/ja/releases/jijmodeling-1.12.0.ipynb index 91ab4c0..cf73121 100644 --- a/docs/ja/releases/jijmodeling-1.12.0.ipynb +++ b/docs/ja/releases/jijmodeling-1.12.0.ipynb @@ -2,23 +2,27 @@ "cells": [ { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "ini" + } + }, "source": [ - "# JijModeling 1.12.0 Release Notes\n", + "# JijModeling 1.12.0 リリースノート\n", "\n", - "## Feature Enhancements\n", + "## 機能強化\n", "\n", - "### `Interpreter` now detects SOS1 constraints\n", + "### `Interpreter` の SOS1 制約を検出機能\n", "\n", - "The recent OMMX version (Python SDK 1.8.3+ and/or Rust SDK v2.0.0-rc1+) adds a field for Special-Ordered Set of Type 1 (SOS1) constraint hints.\n", - "SOS1 is a constraint on a list $x_1, \\ldots, x_n$ of non-negative variables which allows at most one of them to be non-zero.\n", - "`jm.Interpreter` now can detect this type of constraints for arbitrary non-negative variables. More precisely, it detects SOS1 constraints expressed in the following form (and their algebraic equivalents):\n", + "最近の OMMX バージョン (Python SDK 1.8.3以降/Rust SDK v2.0.0-rc1以降) では、1型の特殊順序集合制約 (SOS1) ヒントのフィールドが追加されました。\n", + "SOS1 は、非負の変数のリスト $x_1, \\ldots, x_n$ に対する制約で、最大で1つの変数のみが非零であることを要求するものです。\n", + "今回の変更で、`jm.Interpreter` が任意の非負変数に対しこの型の制約を検出できるようになりました。より正確には、以下の形式 (およびその代数的に同値な式)で表現された SOS1 制約を検出できます:\n", "\n", - "1. $\\sum_i \\delta_i \\leq 1$ for binary variables $\\delta_i$, or\n", - "2. $\\sum_i \\delta_i \\leq 1$ together with $x_i \\leq M_i \\delta_i \\ \\forall i$.\n", - " Here, $x_i$ s are arbitrary decision variables with bound $L_i \\leq x_i \\leq M_i$ specified at the declaration time, where $L_i \\geq 0$ is constant.\n", + "1. バイナリ変数 $\\delta_i$ に対して $\\sum_i \\delta_i \\leq 1$、または\n", + "2. $\\sum_i \\delta_i \\leq 1$ と $x_i \\leq M_i \\delta_i \\ \\forall i$ を合わせたもの。\n", + " ここで、$x_i$ は宣言時に指定された境界 $L_i \\leq x_i \\leq M_i$ を持つ任意の決定変数であり、$L_i \\geq 0$ は定数です。\n", "\n", - "With this feature, you can now take an advantage of SOS1 constraints if you are using OMMX adapters with SOS1 constraint support (e.g. `ommx-pyscipopt-adapter`). " + "この機能により、SOS1 制約をサポートする OMMX アダプター (例: `ommx-pyscipopt-adapter`) を使用している場合、ソルバーが提供している SOS1 制約向けの機構を利用できるようになりました。" ] } ], diff --git a/docs/ja/releases/jijmodeling-1.12.1.ipynb b/docs/ja/releases/jijmodeling-1.12.1.ipynb new file mode 100644 index 0000000..d37522e --- /dev/null +++ b/docs/ja/releases/jijmodeling-1.12.1.ipynb @@ -0,0 +1,142 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# JijModeling 1.12.1 リリースノート\n", + "\n", + "## 機能強化" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Interpreter エラーの可読性向上\n", + "\n", + "[`Interpreter`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Interpreter) で評価エラーが発生した場合、より可読性の高いエラーが表示されるようになりました。例:" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{cccc}\\text{Problem:} & \\text{shift\\_optimization} & & \\\\& & \\min \\quad \\displaystyle \\sum_{d = 0}^{D - 1} \\sum_{t = 0}^{T - 1} \\sum_{i = 0}^{N - 1} x_{d, t, i} & \\\\\\text{{s.t.}} & & & \\\\ & \\text{night\\_shift} & \\displaystyle R_{d + 1, i} \\leq x_{d, T - 1, i} & \\forall d \\in \\left\\{0,\\ldots,D - 1\\right\\} \\forall i \\in \\left\\{0,\\ldots,N - 1\\right\\} \\\\\\text{{where}} & & & \\\\& x & 3\\text{-dim binary variable}\\\\\\end{array}$$" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import jijmodeling as jm\n", + "\n", + "D = jm.Placeholder(\"D\", dtype=jm.DataType.INTEGER)\n", + "T = jm.Placeholder(\"T\", dtype=jm.DataType.INTEGER)\n", + "N = jm.Placeholder(\"N\", dtype=jm.DataType.INTEGER)\n", + "H = jm.Placeholder(\"H\", shape=(D, T, N))\n", + "R = jm.Placeholder(\"R\", shape=(D, N))\n", + "\n", + "x = jm.BinaryVar(\"x\", shape=(D, T, N))\n", + "d = jm.Element(\"d\", belong_to=(0, D))\n", + "t = jm.Element(\"t\", belong_to=(0, T))\n", + "i = jm.Element(\"i\", belong_to=(0, N))\n", + "\n", + "problem = jm.Problem(name=\"shift_optimization\")\n", + "problem += jm.Constraint(\"night_shift\", R[d+1, i] <= x[d, T-1, i], forall=[d, i])\n", + "problem += jm.sum([d, t, i], x[d, t, i])\n", + "\n", + "problem" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Traceback (most recent last):\n", + " while evaluating Problem `shift_optimization',\n", + " while evaluating constraint: `night_shift',\n", + " while evaluating expression `R[d + 1, i] - x[d, T - 1, i]',\n", + " while evaluating expression `R[d + 1, i]',\n", + "\n", + "IndexError: Index [7, 0] is out of range for shape [7, 5]\n" + ] + } + ], + "source": [ + "num_days = 7\n", + "num_times = 3\n", + "num_people = 5\n", + "\n", + "data = problem.generate_random_dataset(\n", + " options={\n", + " \"D\": {\"value\": num_days},\n", + " \"T\": {\"value\": num_times},\n", + " \n", + " \"N\": {\"value\": num_people},\n", + " }\n", + ")\n", + "interp = jm.Interpreter(data)\n", + "\n", + "try:\n", + " interp.eval_problem(problem)\n", + "except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## バグ修正" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### `Interpreter.eval_*` のパフォーマンスバグを修正\n", + "\n", + "以前は、`Interpreter` での式の評価に意図したよりも多くの時間がかかっていました。\n", + "これは、OMMX の `Function` に対する演算を繰り返し呼び出していたためで、中間形式との相互変換とメモリの再割り当てが行われていた結果、一部の総和演算で二次関数的にパフォーマンス低下が発生していました。\n", + "\n", + "今リリースから、JijModeling は専用の中間形式を使用するようになり、こうした評価時のオーバーヘッドが大幅に抑えられるようになりました。" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.20" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/docs/ja/releases/jijmodeling-1.8.0.ipynb b/docs/ja/releases/jijmodeling-1.8.0.ipynb index 242c268..4fdfe29 100644 --- a/docs/ja/releases/jijmodeling-1.8.0.ipynb +++ b/docs/ja/releases/jijmodeling-1.8.0.ipynb @@ -11,7 +11,7 @@ "tags": [] }, "source": [ - "# JijModeling 1.8.0 Release Note" + "# JijModeling 1.8.0 リリースノート" ] }, { @@ -53,8 +53,8 @@ "\n", "![image.png](./assets/jijmodeling-1.8.0_01.png)\n", "\n", - "- `jijmodeling` supports stand-alone compile\n", - " - [`jijmodeling_transpiler`](https://pypi.org/project/jijmodeling-transpiler/) or [JijZept](https://www.documentation.jijzept.com/) are no longer required now!" + "- `jijmodeling` 単体でモデルへのコンパイルが行えるようになりました\n", + " - [`jijmodeling_transpiler`](https://pypi.org/project/jijmodeling-transpiler/)や[JijZept](https://www.documentation.jijzept.com/)の利用は必須ではなくなりました!" ] }, { @@ -70,13 +70,13 @@ "source": [ "### `Interpreter.eval_scalar`\n", "\n", - "- `eval_scalar` evaluates JijModeling expression which does not contain decision variables into a `float`\n", - "- This method is useful for testing and debugging\n" + "- `eval_scalar` は決定変数を含まないJijModeling式を浮動小数点数値へと評価します。\n", + "- テストやデバッグ用途に便利です。" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "9e88861e-6dfc-42fb-af89-ecf32ffc5269", "metadata": { "execution": { @@ -88,17 +88,17 @@ }, "outputs": [], "source": [ - "# Initialize with instance data\n", + "# インスタンスデータによる初期化\n", "interpreter = jm.Interpreter({\"a\": [1, 2, 3]})\n", "\n", - "# Placeholder is evaluated with instance data\n", + "# プレースホルダはインスタンスデータにより評価される\n", "a = jm.Placeholder(\"a\", ndim=1)\n", "assert interpreter.eval_scalar(a[1]) == 2.0" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "bee355a4-80ec-4105-82cc-995fdda8768b", "metadata": { "execution": { @@ -124,7 +124,7 @@ } ], "source": [ - "# Summation is supported\n", + "# 総和記号もサポート済\n", "n = a.len_at(0, latex=\"n\")\n", "i = jm.Element(\"i\", belong_to=n)\n", "sum_a = jm.sum(i, a[i])\n", @@ -150,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "597bb9d7-3cdf-4780-9ca5-3c88ae329677", "metadata": { "execution": { @@ -162,7 +162,7 @@ }, "outputs": [], "source": [ - "# If it finds decision variable, raises error\n", + "# 式が決定変数を含む場合は実行時エラー\n", "v = jm.BinaryVar(\"v\")\n", "with pytest.raises(jm.InterpreterError):\n", " interpreter.eval_scalar(v)" @@ -175,12 +175,12 @@ "source": [ "### `Interpreter.eval_expr`\n", "\n", - "JijModeling expression containing decision variables are evaluated by `eval_expr` into `ommx.v1.Function`" + "決定変数を含む JijModeling 式は、`eval_expr` により `ommx.v1.Function` へと評価できます。" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "99b52b79-6c2b-4f55-973e-88fdb8d868b6", "metadata": { "execution": { @@ -206,10 +206,10 @@ } ], "source": [ - "# Decision variables\n", + "# 決定変数群\n", "x = jm.BinaryVar(\"x\", shape=(n,))\n", "\n", - "# Linear function\n", + "# 線型関数\n", "f = jm.sum(i, a[i] * x[i])\n", "f" ] @@ -249,15 +249,15 @@ "id": "894d4ac4", "metadata": {}, "source": [ - "- Decision variables are registered into the interpreter when it is evaluated.\n", - "- The decision variables get their ID when they are registered. `Interpreter` issues the ID sequentially from 0.\n", - " - Here `x[0]` has ID 0, `x[1]` has ID 1, and so on.\n", - "- Note that `__repr__` of `ommx.v1.Function` show the variables as `x0`, `x1`, ..., by their IDs since it does not contain the information of the original variable names." + "- 決定変数は評価時に Interpreter へと登録されます。\n", + "- 決定変数のIDは、`Interpreter` への登録時に 0 から連続的に付番されます。\n", + " - ここでは `x[0]` の ID は 0、`x[1]` は 1、……となります。\n", + "- `ommx.v1.Function` には元の変数名の情報が含まれていないため、Python の `__repr__` 関数により表示すると、変数はIDによって `x0`, `x_1`, ... と表示されることに注意してください。" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "6376a7da", "metadata": { "execution": { @@ -281,12 +281,12 @@ ], "source": [ "y = jm.BinaryVar(\"y\")\n", - "interpreter.eval_expr(y) # Shown by their ID `x3` instead of their name `y`" + "interpreter.eval_expr(y) # 変数名 `y` ではなく、ID により `x3` と表示される。" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "9fa85ab7-0ef1-4896-aca6-2e3bc8a8aecd", "metadata": { "editable": true, @@ -303,13 +303,13 @@ }, "outputs": [], "source": [ - "# Get corresponding decision variables in OMMX\n", + "# OMMX側の対応する決定変数を取得\n", "x0 = interpreter.get_decision_variable_by_name(\"x\", [0])\n", "x1 = interpreter.get_decision_variable_by_name(\"x\", [1])\n", "x2 = interpreter.get_decision_variable_by_name(\"x\", [2])\n", "assert type(x0) is ommx.v1.DecisionVariable\n", "\n", - "# Compare obtained ommx.v1.Function\n", + "# 取得した ommx.v1.Function を比較\n", "assert f_.almost_equal(ommx.v1.Function(x0 + 2*x1 + 3 * x2))" ] }, @@ -390,10 +390,10 @@ "tags": [] }, "source": [ - "### Limitations\n", + "### 制限\n", "\n", - "- `jijmodeling.CustomPenaltyTerm` is not supported yet.\n", - " - This will be supported in next version with OMMX update." + "- `jijmodeling.CustomPenaltyTerm` は未対応です。\n", + " - 次リリースでOMMXの更新と共にサポート予定です。" ] } ], diff --git a/docs/ja/releases/jijmodeling-1.9.0.ipynb b/docs/ja/releases/jijmodeling-1.9.0.ipynb index 482d942..ddd100b 100644 --- a/docs/ja/releases/jijmodeling-1.9.0.ipynb +++ b/docs/ja/releases/jijmodeling-1.9.0.ipynb @@ -11,7 +11,7 @@ "tags": [] }, "source": [ - "# JijModeling 1.9.0 Release Note" + "# JijModeling 1.9.0 リリースノート" ] }, { @@ -25,11 +25,11 @@ "tags": [] }, "source": [ - "## Random Generation for Instance Data\n", + "## インスタンスデータのランダム生成\n", "\n", - "- `jijmodeling` now supports random data generation for placeholders!\n", - " - It can be useful to distribute your model with dummy data and/or test the behaviour of models against small toy inputs.\n", - "- For more details see the API documentations of [`Problem.generate_random_dataset`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Problem.generate_random_dataset) and [`Problem.generate_random_instance`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Problem.generate_random_instance)." + "- `jijmodeling` はプレースホルダーのランダムデータ生成をサポートするようになりました!\n", + " - ダミーデータを使用してモデルを配布したり、小さなトイ入力に対するモデルの動作をテストするのに役立ちます。\n", + "- 詳細は、[`Problem.generate_random_dataset`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Problem.generate_random_dataset) および [`Problem.generate_random_instance`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Problem.generate_random_instance) のAPIドキュメントを参照してください。" ] }, { @@ -43,10 +43,10 @@ "tags": [] }, "source": [ - "### [`Problem.generate_random_dataset`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Problem.generate_random_dataset) and [`Problem.generate_random_instance`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Problem.generate_random_instance)\n", + "### [`Problem.generate_random_dataset`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Problem.generate_random_dataset) および [`Problem.generate_random_instance`](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#Problem.generate_random_instance)\n", "\n", - "- The function `Problem.generate_random_dataset` generates a dictionary of input values to be fed into `jm.Interpreter`.\n", - "- Use `Problem.generate_random_instance` to directly generating OMMX instance without manually initiating `Interpreter`." + "- `Problem.generate_random_dataset` 関数は、`jm.Interpreter` に入力される値の辞書を生成します。\n", + "- `Problem.generate_random_instance` を使用して、`Interpreter` を手動で初期化することなく直接OMMXインスタンスを生成します。" ] }, { @@ -54,16 +54,16 @@ "id": "b6ddf32e", "metadata": {}, "source": [ - "#### Overview\n", - "To use random generation feature, you should specify some information in `Placeholder` declaration.\n", - "The following random-generation related attributes are added in this version:\n", + "#### 概要\n", + "ランダム生成機能を使用するには、`Placeholder` 宣言でいくつかの情報を指定する必要があります。\n", + "このバージョンでは、次のランダム生成関連の属性が追加されました:\n", "\n", - "- `dtype`: The type of the element of an array (or scalar). Must be either `jm.DataType.INTEGER` or `jm.DataType.FLOAT`.\n", - "- `jagged`: set to `True` to generate a jagged array. `False` by default.\n", - "- `shape`: To generate an $n$-dimensional array or jagged array, you should specify the shape. This should be a tuple, with components dimension expression or `None`.\n", - " - `None` means the size of the axis is indeterminate. For $n$-dimensional array, each axis has random but fixed size regardless of parent axes; for jagged arrays, the same axis can have different size for each parent axes.\n", + "- `dtype`: 配列(またはスカラー)の要素の型。`jm.DataType.INTEGER` または `jm.DataType.FLOAT` のいずれかでなければなりません。\n", + "- `jagged`: ジャギー配列を生成する場合は `True` に設定します。デフォルトは `False` です。\n", + "- `shape`: $n$ 次元配列またはジャギー配列を生成するには、形状を指定する必要があります。これは、次元式または `None` を含むタプルでなければなりません。\n", + " - `None` は軸のサイズが不定であることを意味します。$n$ 次元配列の場合、各軸は親軸に関係なくランダムで固定サイズです。ジャギー配列の場合、同じ軸が親軸ごとに異なるサイズを持つことができます。\n", "\n", - "If only `dtype` is specified, the placeholder is considered as a scalar value as in other cases." + "`dtype` のみが指定されている場合、プレースホルダーは他の場合と同様にスカラー値と見なされます。" ] }, { @@ -71,19 +71,19 @@ "id": "1cb4949d", "metadata": {}, "source": [ - "`Problem.generate_random_*` takes the following keyword arguments:\n", + "`Problem.generate_random_*` は次のキーワード引数を取ります:\n", "\n", - "- `seed` (optional): a seed for random data generation. If omitted, it samples from environmental entropy.\n", - "- `options` (optional): ranges for values and axis size for each placeholder.\n", - "- `default` (optional): default ranges option for placeholders absent in `options` argument.\n", + "- `seed` (オプション): ランダムデータ生成のためのシード。省略された場合、環境エントロピーからサンプルを取得します。\n", + "- `options` (オプション): 各プレースホルダーの値と軸サイズの範囲。\n", + "- `default` (オプション): `options` 引数に存在しないプレースホルダーのデフォルト範囲オプション。\n", "\n", - "You will specify range objects in `options` and `default`. A concrete syntax is described in [\"Range Parameters and Range Syntax\" section of API Reference](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#range-parameters-and-range-syntax).\n", - "In a nutshell, range object consists of the following fields:\n", + "`options` および `default` には範囲オブジェクトを指定します。具体的な構文は [APIリファレンスの「範囲パラメータと範囲構文」セクション](https://jij-inc.github.io/JijModeling-Tutorials/apis/jijmodeling.html#range-parameters-and-range-syntax) に記載されています。\n", + "要するに、範囲オブジェクトは次のフィールドで構成されます:\n", "\n", - "- `value`: range of the values in placeholder. (default: uniformly samples from closed interval $[-1, 1]$)\n", - "- `size`: range of the size of each axis in placeholder - ignored for scalar placeholders. (default: uniformly samples from closed interval $[1, 5] \\cap \\mathbb{N}$)\n", + "- `value`: プレースホルダーの値の範囲。(デフォルト: 閉区間 $[-1, 1]$ から一様にサンプル)\n", + "- `size`: プレースホルダーの各軸のサイズの範囲 - スカラープレースホルダーの場合は無視されます。(デフォルト: 閉区間 $[1, 5] \\cap \\mathbb{N}$ から一様にサンプル)\n", "\n", - "You can use functions from `jijmodeling.range`, `jijmodeling.range.value`, or `jijmodeling.range.size` modules and builtin `range(N, M)` function for `size` range." + "`jijmodeling.range`、`jijmodeling.range.value`、`jijmodeling.range.size` モジュールおよび組み込みの `range(N, M)` 関数を `size` 範囲に使用できます。" ] }, { @@ -91,7 +91,7 @@ "id": "e25480cb", "metadata": {}, "source": [ - "#### Examples" + "#### 例" ] }, { @@ -133,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "fd88afc4", "metadata": {}, "outputs": [ @@ -151,18 +151,18 @@ } ], "source": [ - "# Get the dictionary of generated data\n", + "# 生成されたデータの辞書を取得\n", "data_set = problem.generate_random_dataset(\n", " seed=42,\n", " # Default Options.\n", " default={\n", - " \"value\": jm.range.open_closed(5, 15), # Samples values 5 < x <= 15\n", + " \"value\": jm.range.open_closed(5, 15), # 値を 5 < x <= 15 からサンプル\n", " },\n", - " # Placheolder specific options.\n", + " # プレースホルダー固有のオプション。\n", " options={\n", " \"v\": {\n", " \"value\": range(1000, 10000),\n", - " \"size\": range(2, 10), # Each axis should be of length 2 <= n < 10\n", + " \"size\": range(2, 10), # 各軸の長さは 2 <= n < 10\n", " }\n", " },\n", ")\n", @@ -171,53 +171,53 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "52c27896", "metadata": {}, "outputs": [], "source": [ "config = {\n", " \"seed\": 42,\n", - " # Default Options.\n", + " # デフォルトオプション。\n", " \"default\": {\n", " \"value\": jm.range.open_closed(5, 15), # Samples values 5 < x <= 15\n", " },\n", - " # Placheolder specific options.\n", + " # プレースホルダー固有のオプション。\n", " \"options\": {\n", " \"v\": {\n", " \"value\": range(1000, 10000),\n", - " \"size\": range(2, 10), # Each axis should be of length 2 <= n < 10\n", + " \"size\": range(2, 10), # 各軸の長さは 2 <= n < 10\n", " }\n", " },\n", "}\n", "\n", - "# `generate_random_instance` is just a wrapper around generate_random_dataset and `Interpreter.eval_problem`.\n", + "# `generate_random_instance` は generate_random_dataset と `Interpreter.eval_problem` のラッパーです。\n", "instance = problem.generate_random_instance(**config)\n", "assert instance == jm.Interpreter(data_set).eval_problem(problem)" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "5b07cfd4", "metadata": {}, "outputs": [], "source": [ - "# $n$-dimensionary array vs jagged array.\n", + "# $n$ 次元配列 vs ジャギー配列。\n", "\n", "N = jm.Placeholder(\"N\", dtype=jm.DataType.INTEGER)\n", "\n", - "# When `jagged` unspecified (or set to `False`), the generated data will be a $n$-dimensionary array.\n", + "# `jagged` が指定されていない(または `False` に設定されている)場合、生成されたデータは $n$ 次元配列になります。\n", "ND = jm.Placeholder(\"ND\", dtype=jm.DataType.FLOAT, shape=[N, None])\n", "\n", - "# When `jagged` is set to `True`, the generated data will be a jagged array.\n", + "# `jagged` が `True` に設定されている場合、生成されたデータはジャギー配列になります。\n", "JD = jm.Placeholder(\"JD\", dtype=jm.DataType.FLOAT, shape=[N, None], jagged=True)\n", "\n", "W = jm.BinaryVar(\"W\", shape=[N])\n", "\n", - "# Both ND and JD has ndim 3, but `None` has different meaning.\n", + "# ND と JD はどちらも ndim 3 ですが、`None` の意味が異なります。\n", "\n", - "# Create dummy problem\n", + "# ダミー問題を作成\n", "\n", "problem = jm.Problem(\"MyProblem2\")\n", "problem += jm.sum(i, ND[i, 0] * JD[i, 0] * W[i])\n", diff --git a/pyproject.toml b/pyproject.toml index 4921748..9926f53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ description = "Tutorial for JijModeling" readme = "README.md" requires-python = ">=3.9, <3.12" # jijmodeling does not support Python 3.12 yet dependencies = [ - "jijmodeling >= 1.10.0, < 1.11.0", + "jijmodeling == 1.12.0", "jijmodeling-transpiler>=0.6.15", "ommx >= 1.8.2, < 2.0.0", "ommx-pyscipopt-adapter >= 1.8.2, < 2.0.0",