diff --git a/.github/PULL_REQUEST_TEMPLATE/release.md b/.github/PULL_REQUEST_TEMPLATE/release.md index e53490dc..66189bbe 100644 --- a/.github/PULL_REQUEST_TEMPLATE/release.md +++ b/.github/PULL_REQUEST_TEMPLATE/release.md @@ -2,7 +2,7 @@ - [ ] Check if the new version is uploaded to [PyPI](https://pypi.org/project/jijmodeling/). - [ ] Update `develop` branch so that: - + [ ] Run `uv sync --upgrade` + + [ ] Run `uv sync --upgrade --extra dev` + [ ] `uv pip compile pyproject.toml -o requirements.txt --upgrade` to regenerate `requirements.txt` + [ ] Finalize unreleased release notes by `task finalize_release_notes -- ` + [ ] Make sure `X.XX.X` in the release note title is replaced with the new version number. diff --git a/Taskfile.yml b/Taskfile.yml index 0a42396f..69fdaf61 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -123,6 +123,11 @@ tasks: yq -i '.parts[-2].chapters |= [{"file": "releases/jijmodeling-{{.CLI_ARGS}}"}] + .' "${TOC}" done + sync_unreleased: + desc: Synchorizes just the `unreleased.ipynb` files with thier respective markdown files. + cmds: + - uv run jupytext --sync --use-source-timestamp markdowns/*/releases/unreleased.md + sync_paired_notebooks: desc: Synchronize paired notebooks and markdown files cmds: @@ -215,4 +220,4 @@ tasks: desc: Run textlint --fix on English markdown files cmds: - task: textlint_fix - vars: {LANG: en} \ No newline at end of file + vars: {LANG: en} diff --git a/docs/en/_config.yml b/docs/en/_config.yml index f5ef8a33..ab93ba06 100644 --- a/docs/en/_config.yml +++ b/docs/en/_config.yml @@ -12,6 +12,7 @@ execute: timeout: 60 exclude_patterns: - "releases/jijmodeling-*" + - "releases/unreleased*" # Define the name of the latex output file for PDF builds latex: diff --git a/docs/en/_toc.yml b/docs/en/_toc.yml index bbb1eb53..5dde3791 100644 --- a/docs/en/_toc.yml +++ b/docs/en/_toc.yml @@ -20,6 +20,11 @@ parts: - file: basics/expressions - file: basics/modeling - file: basics/instance_generation + - caption: Advanced + chapters: + - file: advanced/named_expr + - file: advanced/generation + - file: advanced/serialize - caption: Reference chapters: - url: https://jij-inc-jijmodeling.readthedocs-hosted.com/en/ @@ -28,6 +33,7 @@ parts: - file: references/migration_guide_to_jijmodeling2 - caption: Release Note chapters: + - file: releases/jijmodeling-2.3.1 - file: releases/jijmodeling-2.2.0 - file: releases/jijmodeling-2.1.0 - file: releases/jijmodeling-2.0.0 diff --git a/docs/en/advanced/generation.ipynb b/docs/en/advanced/generation.ipynb new file mode 100644 index 00000000..b5a13869 --- /dev/null +++ b/docs/en/advanced/generation.ipynb @@ -0,0 +1,322 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "21f42332-3b40-49bf-b99e-95ed92f04b73", + "metadata": {}, + "source": [ + "# Using random instance generation\n", + "\n", + "{py:class}`~jijmodeling.Problem` provides methods to generate randomized sets of instance data, based on the problem's schema (its placeholders). This tutorial will go over all the different instance generation options.\n", + "\n", + "There are two methods: \n", + "- {py:meth}`Problem.generate_random_dataset` returns the data as a dictionary, like one you'd pass to {py:meth}`Problem.eval` as the instance data.\n", + "- {py:meth}`Problem.generate_random_instance` generates data in the same way, but returns the compiled problem as an OMMX instance. It's the same as using `generate_random_dataset` and then passing the returned dictionary to {py:meth}`Problem.eval`.\n", + "\n", + "Both of these methods accept the same generation parameters: `default`, `options`, and `seed`. Meanwhile, `generate_random_instance` accepts additional options that are passed along to `Problem.eval`: `prune_unused_dec_vars` and `constraint_detection`, etc.\n", + "\n", + "`seed` is simply the seed value used to initialize the random number generator. Use it when you want the generated instance to be reproducible.\n", + "\n", + "`default` and `options` specify how values should be generated for your random instance. `options` accepts a dictionary that allows you to specify value ranges for each {py:class}`~jijmodeing.Placeholder` in your problem, while `default` is the fallback parameter. Anything that is not present in `options` will refer to `default` to determine how its values should be generated. \n", + "\n", + "Neither of these is _required_. You don't need to set `default` if specifying `options` for every placeholder, and just setting `default` can be enough to generate a basic instance. However, note that generated instances are not guaranteed to be feasible, that depends entirely on the problem and parameters set.\n", + "\n", + "Let's go over how to specify these parameters for different kinds of problems. \n", + "\n", + "## Setting `default` and `options`\n", + "\n", + "Our generation parameters `default` and `options` can be specified in several different ways, namely:\n", + "\n", + "- A fixed value (just a number).\n", + "- A Python `range`.\n", + "- The object returned by one the many functions in the {py:mod}`jijmodeling.generation` submodule.\n", + "- Ranges defined with tuples and dictionaries. Refer to the API docs for {py:meth}`~jijmodeling.Problem.generate_random_dataset` for more details on how to use these.\n", + "\n", + "When using a fixed value, the placeholder will be set to that number. When using ranges (be they built-in python ranges, the ones from {py:mod}`jijmodeling.generation`, or defined by tuples/dictionaries), those will serve the boundary for generating random values.\n", + "\n", + "Let's look at a very simple problem to see how these are used." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "34020325-4747-42ce-ab64-4114e871dca0", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:29.173976Z", + "iopub.status.busy": "2026-03-24T02:05:29.173922Z", + "iopub.status.idle": "2026-03-24T02:05:29.226519Z", + "shell.execute_reply": "2026-03-24T02:05:29.226149Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'B': 3, 'A': 4}" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import jijmodeling as jm\n", + "\n", + "problem = jm.Problem(\"my problem\")\n", + "x = problem.BinaryVar(\"x\")\n", + "A = problem.Natural(\"A\")\n", + "B = problem.Natural(\"B\")\n", + "problem += A * x + B\n", + "\n", + "problem.generate_random_dataset(default={\"value\": range(1, 10)})" + ] + }, + { + "cell_type": "markdown", + "id": "d3db3cc1-3d7b-409d-9091-b756af674679", + "metadata": {}, + "source": [ + "In the above example, we don't use `options`, so we look to `default` when generating values for `A` and `B`. Both then get their own random value from within the default range.\n", + "\n", + "In this case we used a regular Python range, which are naturally `[closed, open)`, meaning the lower boundary is included, but the higher is excluded. (eg. `range(1,4)` is 1, 2 or 3, but not 4) The ranges provided in {py:mod}`jijmodeling.generation` provide additional options for defining ranges, like {py:func}`jijmodeling.generation.open` (neither of the bounds is included) or {py:func}`jijmodeling.generation.at_least` (include lower bound, infinty as upper bound). Python ranges are equivalent to {py:func}`jijmodeling.generation.closed_open`.\n", + "\n", + "Generated values will conform to types. That is, if you have a Natural Placeholder, only natural numbers will be generated for it, even if you use a range parameter including a negative number like `(-10, 10)`.\n", + "\n", + "Now, if we want to specify different ranges for `A` and `B`, we must pass a dictionary to `options`. Keys must match a placeholder's name, and values must be dictionaries specifying the options for that specific placeholder. In this scalar case, the only relevant option is `value`. We'll discuss other options that may go in the dictionary in future sections." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "9ea06ded-9bc5-4eb9-85c7-837538a5940b", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:29.227611Z", + "iopub.status.busy": "2026-03-24T02:05:29.227545Z", + "iopub.status.idle": "2026-03-24T02:05:29.229816Z", + "shell.execute_reply": "2026-03-24T02:05:29.229508Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'B': 5, 'A': 89}" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem.generate_random_dataset(default={\"value\": range(1, 10)}, options={\"A\": {\"value\": range(50, 100)}})" + ] + }, + { + "cell_type": "markdown", + "id": "0563f2f4-71d4-4d5b-ac3a-81ffa98d17c8", + "metadata": {}, + "source": [ + "In the above example, we give `\"A\"` its own value range through `options`. Since we didn't specify `\"B\"`, `default` is still used for its values. We can also set both in `options`:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "8fedb42a-12d2-41f6-b3de-c989ea1aa4ab", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:29.230837Z", + "iopub.status.busy": "2026-03-24T02:05:29.230782Z", + "iopub.status.idle": "2026-03-24T02:05:29.233098Z", + "shell.execute_reply": "2026-03-24T02:05:29.232823Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'B': 4, 'A': 68}" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem.generate_random_dataset(options = {\"A\": {\"value\": range(50, 100)}, \"B\": {\"value\": range(1, 10)}})" + ] + }, + { + "cell_type": "markdown", + "id": "2b7519a3-e7d6-4240-81cc-cf778eea4f32", + "metadata": {}, + "source": [ + "## Array placeholders\n", + "\n", + "With array placeholders, values can be specified in much the same way as scalars. If the placeholder's `shape` is well defined, an array (potentially multi-dimensional) of values will be generated matching the shape, all within the `value` range (or `default`, if `value` isn't specified for this placeholder)." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "19a45cfe-40de-4e5e-9cad-62114b225b09", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:29.234144Z", + "iopub.status.busy": "2026-03-24T02:05:29.234093Z", + "iopub.status.idle": "2026-03-24T02:05:29.282052Z", + "shell.execute_reply": "2026-03-24T02:05:29.281678Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'A': array([3, 9, 9, 4, 6, 9, 9, 9, 6, 8], dtype=object)}" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem = jm.Problem(\"my problem\")\n", + "# here we use a literal value for simplicity, but `shape` itself could be defined with a placeholder.\n", + "x = problem.BinaryVar(\"x\", shape=10)\n", + "A = problem.Natural(\"A\", shape=10)\n", + "problem += jm.sum(10, lambda i: A[i] * x[i])\n", + "\n", + "problem.generate_random_dataset(options={\"A\": {\"value\": range(1,10)}})" + ] + }, + { + "cell_type": "markdown", + "id": "4ad01538-ef71-494e-ac5d-8322248f6744", + "metadata": {}, + "source": [ + "If the placeholder's `shape` isn't fully defined, we should specify how many elements the array should have to be able to generate the instance data. To do that, we add a `size` parameter to the options dictionary. As `size` defines the length of the array, it must be a natural numbers, but like `value`, we still accept ranges -- meaning a random number of elements can be generated." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "ac97241e-47bd-4b5b-b8f6-49d5ddb43254", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:29.282996Z", + "iopub.status.busy": "2026-03-24T02:05:29.282922Z", + "iopub.status.idle": "2026-03-24T02:05:29.312705Z", + "shell.execute_reply": "2026-03-24T02:05:29.312400Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'A': array([-7.170054915922748, 4.5286379717568614, -0.7378605301076355,\n", + " -9.881771095294587, -6.66134733378656, -9.639830308073524,\n", + " 7.636033231278233, -7.2784681900176595, 2.46134220723353],\n", + " dtype=object)}" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem = jm.Problem(\"my problem\")\n", + "A = problem.Float(\"A\", ndim=1)\n", + "N = A.len_at(0)\n", + "x = problem.BinaryVar(\"x\", shape=(N,))\n", + "\n", + "problem += jm.sum(N, lambda i: A[i] * x[i])\n", + "\n", + "problem.generate_random_dataset(\n", + " options={\n", + " \"A\": {\"value\": range(-10, 10), \"size\": range(1,10),}\n", + " },\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "a18ee36c-9b86-419f-8811-124649c77e48", + "metadata": {}, + "source": [ + "When a placeholder has a partially defined `shape` (such as `(None, 10)`, etc.), `size` will be referenced to generate the number of elements for each dimension without a predefined value. Specifying `size` for an array placeholder with a well-defined shape has no effect; the `shape` information takes priority." + ] + }, + { + "cell_type": "markdown", + "id": "a3c5bdda-bfde-4611-b326-37c9fa073a9a", + "metadata": {}, + "source": [ + "## Dictionary placeholders\n", + "\n", + "For dictionary-like Placeholders keyed by `CategoryLabel`s, you _must_ define the keys that go in those category labels through `options`. The most explicit way of doing so, is by using a `keys` parameter. For example, if your problem has a category label `C`, this will define \"X\", \"Y\", and \"Z\" as the three valid keys:\n", + "\n", + "```python\n", + "{ \"C\": {\"keys\": [\"X\", \"Y\", \"Z\"]} }\n", + "```\n", + "\n", + "So each dictionary placeholder keyed by `C` will generate a value for each of the \"X\", \"Y\" and \"Z\" keys. Value ranges work the same way as array and scalar placeholders: they can be passed through `options`for each placeholder separately, or you can use `default`.\n", + "\n", + "However, if the actual strings don't matter for the instance you're generating, you can also use `size` (with either a fixed value or a range). In that case, we will generate a number arbitrary strings fitting that parameter. \n", + "\n", + "```python\n", + "{ \"C\": {\"size\": 5 } }\n", + "{ \"C\": {\"size\": range(3, 10)}}\n", + "```\n", + "\n", + "As said above, values will be generated for each key in each dictionary-like placeholder. This is still true for _partial_ dictionaries: by default, all keys are used. To limit the amount of keys used in a partial placeholder, we additionally pass either `keys` or `size` as part of that placeholder's entry in `options` to define a subset.\n", + "\n", + "For example, let's assume we have a partial dictionary placeholder `D`, keyed by the category label `C`:\n", + "\n", + "```python\n", + "{ \"C\": {\"keys\": [\"X\", \"Y\", \"Z\"]}, \"D\": {\"keys\": [\"X\", \"Y\"], \"value\": range(10, 100)} } }\n", + "```\n", + "\n", + "The above only works when you've defined the category label values using `keys`, and you must guarantee that it's a valid subset.\n", + "\n", + "On the other hand, using `size` in the partial dictionary's options, we can specify that a random selection must be made from the valid keys (no matter how they were specified):\n", + "```python\n", + "# either 1 or 2 keys will be picked at random:\n", + "{ \"C\": {\"keys\": [\"X\", \"Y\", \"Z\"]}, \"D\": {\"size\": range(1, 3), \"value\": range(10, 100)} } } \n", + "# 1, 2, 3, or 4 keys will be picked at random:\n", + "{ \"C\": {\"size\": range(3, 10)}, \"D\": {\"size\": range(1, 5), \"value\": range(10, 100)} } } \n", + "```" + ] + } + ], + "metadata": { + "jupytext": { + "default_lexer": "ipython3" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/en/advanced/named_expr.ipynb b/docs/en/advanced/named_expr.ipynb new file mode 100644 index 00000000..ab1edde4 --- /dev/null +++ b/docs/en/advanced/named_expr.ipynb @@ -0,0 +1,799 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "82450551", + "metadata": {}, + "source": [ + "# Naming Expressions and Saving Them in Instances\n", + "\n", + "JijModeling provides the {py:class}`~jijmodeling.NamedExpr` class to represent named expressions.\n", + "Like decision variables and placeholders, it can be declared using the {py:meth}`Problem.NamedExpr() ` method.\n", + "{py:meth}`Problem.NamedExpr() ` accepts the following arguments:\n", + "\n", + "| Argument | Type | Description |\n", + "| :-- | :--: | :-- |\n", + "| `name` | `str` | The name of the named expression. Optional in the Decorator API. |\n", + "| `definition` | Required. {py:data}`~jijmodeling.ExpressionLike` | The definition of the named expression. You can pass JijModeling expression objects or any object that can be converted into an expression, such as Python numbers, strings, tuples, lists, dictionaries, and NumPy arrays. |\n", + "| `description` | `Optional[str]` | Optional. A description of the named expression. It is used in mathematical output and in expressions saved to OMMX. |\n", + "| `latex` | `Optional[str]` | Optional. A $\\LaTeX$ representation of the named expression. It is used when rendering mathematical output. |\n", + "| `save_in_ommx` | `bool` | Optional, default `False`. If set to `True`, and the conditions described later are satisfied, the expression is saved in the OMMX instance as an {py:class}`ommx.v1.NamedFunction`. |\n", + "\n", + "{py:class}`~jijmodeling.NamedExpr` has the following two main use cases:\n", + "\n", + "1. Give a specific expression a name to make the $\\LaTeX$ output easier to read\n", + "2. Save a specific expression in an OMMX instance and evaluate its value after solving\n", + "\n", + "This document explains these uses of {py:class}`~jijmodeling.NamedExpr` with concrete examples." + ] + }, + { + "cell_type": "markdown", + "id": "5d9e6e66", + "metadata": {}, + "source": [ + "# Naming Expressions\n", + "\n", + "Let us look at an example of naming a specific expression to make the $\\LaTeX$ output easier to read. In the knapsack problem, suppose we want to infer the number of items $N$ from the length of the placeholder array $w$ representing the weight of each item, rather than providing $N$ explicitly as instance data.\n", + "First, here is a formulation that does not use {py:meth}`~jijmodeling.Problem.NamedExpr`:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "2ac9c9d4", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:30.709402Z", + "iopub.status.busy": "2026-03-24T02:05:30.709347Z", + "iopub.status.idle": "2026-03-24T02:05:30.900832Z", + "shell.execute_reply": "2026-03-24T02:05:30.900063Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Knapsack (Unnamed)}\\\\\\displaystyle \\max &\\displaystyle \\sum _{i=0}^{\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)-1}{{v}_{i}\\cdot {x}_{i}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", + "\\text{Weight}&\\quad \\displaystyle \\sum _{i=0}^{\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)-1}{{w}_{i}\\cdot {x}_{i}}\\leq W\\end{aligned}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right);\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\&&&\\text{$x_i = 1$ if item i is put in the knapsack}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{value of each item}\\\\&&&\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\&&&\\text{maximum weight capacity of the knapsack}\\\\&&&\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{weight of each item}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Knapsack (Unnamed)\", sense=MAXIMIZE, objective=sum(w.len_at(0).map(lambda (i: natural): v[i] * x[i])), constraints={Weight: [Constraint(name=\"Weight\", sense=LESS_THAN_EQUAL, left=sum(w.len_at(0).map(lambda (i: natural): w[i] * x[i])), right=W, shape=Scalar(Float)),],})" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import jijmodeling as jm\n", + "\n", + "\n", + "@jm.Problem.define(\"Knapsack (Unnamed)\", sense=jm.ProblemSense.MAXIMIZE)\n", + "def knapsack_unnamed(problem: jm.DecoratedProblem):\n", + " W = problem.Float(description=\"maximum weight capacity of the knapsack\")\n", + " w = problem.Float(ndim=1, description=\"weight of each item\")\n", + " # Infer N from the length of w.\n", + " N = w.len_at(0)\n", + " v = problem.Float(shape=(N,), description=\"value of each item\")\n", + " x = problem.BinaryVar(\n", + " shape=(N,), description=\"$x_i = 1$ if item i is put in the knapsack\"\n", + " )\n", + "\n", + " problem += jm.sum(v[i] * x[i] for i in N)\n", + " problem += problem.Constraint(\"Weight\", jm.sum(w[i] * x[i] for i in N) <= W)\n", + "\n", + "\n", + "knapsack_unnamed" + ] + }, + { + "cell_type": "markdown", + "id": "eadd8aba", + "metadata": {}, + "source": [ + "As you can see from the $\\LaTeX$ output, the definition `len_at(w, 0)` for $N$ is expanded inline, which makes the formulation, especially the summation ranges, harder to read.\n", + "Now let us define $N$ using {py:meth}`~jijmodeling.Problem.NamedExpr`:" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "eef87a2e", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:30.902082Z", + "iopub.status.busy": "2026-03-24T02:05:30.901973Z", + "iopub.status.idle": "2026-03-24T02:05:31.067538Z", + "shell.execute_reply": "2026-03-24T02:05:31.067176Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Knapsack}\\\\\\displaystyle \\max &\\displaystyle \\sum _{i=0}^{N-1}{{v}_{i}\\cdot {x}_{i}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", + "\\text{Weight}&\\quad \\displaystyle \\sum _{i=0}^{N-1}{{w}_{i}\\cdot {x}_{i}}\\leq W\\end{aligned}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\&&&\\text{$x_i = 1$ if item i is put in the knapsack}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[N;\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{value of each item}\\\\&&&\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\&&&\\text{maximum weight capacity of the knapsack}\\\\&&&\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{weight of each item}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N},\\text{Length of w}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Knapsack\", sense=MAXIMIZE, objective=sum(N.map(lambda (i: natural): v[i] * x[i])), constraints={Weight: [Constraint(name=\"Weight\", sense=LESS_THAN_EQUAL, left=sum(N.map(lambda (i: natural): w[i] * x[i])), right=W, shape=Scalar(Float)),],})" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "@jm.Problem.define(\"Knapsack\", sense=jm.ProblemSense.MAXIMIZE)\n", + "def knapsack(problem: jm.DecoratedProblem):\n", + " W = problem.Float(description=\"maximum weight capacity of the knapsack\")\n", + " w = problem.Float(ndim=1, description=\"weight of each item\")\n", + " # Use NamedExpr to give the length of w the name N.\n", + " N = problem.NamedExpr(w.len_at(0), description=\"Length of w\")\n", + " v = problem.Float(shape=(N,), description=\"value of each item\")\n", + " x = problem.BinaryVar(\n", + " shape=(N,), description=\"$x_i = 1$ if item i is put in the knapsack\"\n", + " )\n", + "\n", + " problem += jm.sum(v[i] * x[i] for i in N)\n", + " problem += problem.Constraint(\"Weight\", jm.sum(w[i] * x[i] for i in N) <= W)\n", + "\n", + "\n", + "knapsack" + ] + }, + { + "cell_type": "markdown", + "id": "9ef5cf9f", + "metadata": {}, + "source": [ + "The definition of $N$ now appears in the `Named Expressions` section at the end, while the rest of the formulation displays it simply as $N$, which makes the $\\LaTeX$ output easier to read." + ] + }, + { + "cell_type": "markdown", + "id": "b5d71352", + "metadata": {}, + "source": [ + "Also, although $N$ defined by {py:meth}`~jijmodeling.Problem.NamedExpr` is treated as a kind of variable in the JijModeling model, it is automatically expanded during compilation. Therefore, whether or not you use {py:meth}`~jijmodeling.Problem.NamedExpr` does not change the resulting OMMX instance." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "a1980058", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:31.068706Z", + "iopub.status.busy": "2026-03-24T02:05:31.068645Z", + "iopub.status.idle": "2026-03-24T02:05:32.352063Z", + "shell.execute_reply": "2026-03-24T02:05:32.351689Z" + } + }, + "outputs": [], + "source": [ + "knapsack_instance_data = {\n", + " \"v\": [10, 13, 18, 31, 7, 15],\n", + " \"w\": [11, 15, 20, 35, 10, 33],\n", + " \"W\": 47,\n", + "}\n", + "\n", + "instance_named = knapsack.eval(knapsack_instance_data)\n", + "instance_unnamed = knapsack_unnamed.eval(knapsack_instance_data)\n", + "\n", + "assert instance_named.objective.almost_equal(instance_unnamed.objective)\n", + "assert instance_named.constraints[0].function.almost_equal(\n", + " instance_unnamed.constraints[0].function\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "d61c5dd7", + "metadata": {}, + "source": [ + ":::{tip}\n", + "You can inspect the list of {py:class}`~jijmodeling.NamedExpr` objects registered in a model using {py:meth}`jijmodeling.Problem.named_exprs`.\n", + ":::" + ] + }, + { + "cell_type": "markdown", + "id": "4c373572", + "metadata": {}, + "source": [ + "## Saving in Instances\n", + "\n", + "By setting the `save_in_ommx` argument of {py:class}`~jijmodeling.Problem.NamedExpr` to `True`, you can save an expression in an OMMX instance only when it satisfies one of the following conditions:\n", + "\n", + "1. An expression whose possible values are scalars\n", + "2. An array of expressions whose possible values are scalars\n", + "3. A dictionary of expressions whose possible values are scalars\n", + "\n", + "More concretely, expressions like the following can be saved in an OMMX instance." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "de325406", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.353639Z", + "iopub.status.busy": "2026-03-24T02:05:32.353384Z", + "iopub.status.idle": "2026-03-24T02:05:32.400433Z", + "shell.execute_reply": "2026-03-24T02:05:32.400104Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Scalar}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[5;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}scalar&=\\sum _{\\vec{\\imath }}{{{\\left(x\\right)}}_{\\vec{\\imath }}}&\\quad &\\in \\left\\{0, 1\\right\\}\\\\&&&\\text{\\texttt{save\\_{}in\\_{}ommx=True}}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Scalar\", sense=MINIMIZE, objective=0, constraints=[])" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# An expression whose possible values are scalars\n", + "# Example: a sum of binary variables\n", + "problem = jm.Problem(\"Scalar\")\n", + "x = problem.BinaryVar(\"x\", shape=(5,))\n", + "S = problem.NamedExpr(\"scalar\", x.sum(), save_in_ommx=True)\n", + "problem" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "b86892f7", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.401429Z", + "iopub.status.busy": "2026-03-24T02:05:32.401375Z", + "iopub.status.idle": "2026-03-24T02:05:32.536699Z", + "shell.execute_reply": "2026-03-24T02:05:32.536396Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Tensor of Scalars}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}y&\\in \\mathop{\\mathrm{Array}}\\left[5;\\mathbb{Z}\\right]\\;\\left(0\\leq {y}_{i}\\leq 10\\right)&\\quad &1\\text{-dim integer variable}\\\\z&\\in \\mathop{\\mathrm{Array}}\\left[5;\\mathbb{Z}\\right]\\;\\left(0\\leq {z}_{i}\\leq 10\\right)&\\quad &1\\text{-dim integer variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}tensor\\_{}of\\_{}scalars&=y-z&\\quad &\\in \\mathop{\\mathrm{Array}}\\left[5;\\mathbb{Z}\\right]\\\\&&&\\text{\\texttt{save\\_{}in\\_{}ommx=True}}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Tensor of Scalars\", sense=MINIMIZE, objective=0, constraints=[])" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# An array of expressions whose possible values are scalars\n", + "# Example: the difference of two arrays of integer variables\n", + "problem = jm.Problem(\"Tensor of Scalars\")\n", + "y = problem.IntegerVar(\"y\", shape=(5,), lower_bound=0, upper_bound=10)\n", + "z = problem.IntegerVar(\"z\", shape=(5,), lower_bound=0, upper_bound=10)\n", + "T = problem.NamedExpr(\"tensor_of_scalars\", y - z, save_in_ommx=True)\n", + "problem" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "f2859f29", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.537878Z", + "iopub.status.busy": "2026-03-24T02:05:32.537817Z", + "iopub.status.idle": "2026-03-24T02:05:32.623433Z", + "shell.execute_reply": "2026-03-24T02:05:32.623068Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Dict of Scalars}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}w&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{K};\\mathbb{R}\\right]\\;\\left(0\\leq {w}_{i}\\leq 10\\right)&\\quad &\\text{a dictionary of }\\text{continuous}\\text{ variables with key }K\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{K};\\mathbb{R}\\right]&\\quad &\\text{A total dictionary of placeholders with keys }\\mathrm{K}\\text{, values in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Category Labels:}\\\\&\\qquad \\begin{array}{rl}\n", + "K&\\text{Category Label}\\end{array}\n", + "\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}dict\\_{}of\\_{}scalars&=a\\cdot w&\\quad &\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{K};\\mathbb{R}\\right]\\\\&&&\\text{\\texttt{save\\_{}in\\_{}ommx=True}}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Dict of Scalars\", sense=MINIMIZE, objective=0, constraints=[])" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# A dictionary of expressions whose possible values are scalars\n", + "# Example: the product of a placeholder dictionary and a real-valued variable dictionary\n", + "problem = jm.Problem(\"Dict of Scalars\")\n", + "K = problem.CategoryLabel(\"K\")\n", + "a = problem.Float(\"a\", dict_keys=K)\n", + "w = problem.ContinuousVar(\"w\", dict_keys=K, lower_bound=0, upper_bound=10)\n", + "U = problem.NamedExpr(\"dict_of_scalars\", a * w, save_in_ommx=True)\n", + "problem" + ] + }, + { + "cell_type": "markdown", + "id": "3038b5ab", + "metadata": {}, + "source": [ + "On the other hand, expressions like the following cannot be saved in an OMMX instance." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "6051c494", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.624428Z", + "iopub.status.busy": "2026-03-24T02:05:32.624367Z", + "iopub.status.idle": "2026-03-24T02:05:32.629533Z", + "shell.execute_reply": "2026-03-24T02:05:32.629140Z" + } + }, + "outputs": [], + "source": [ + "problem = jm.Problem(\"Errornous Problem\")" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "276ffb44", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.630573Z", + "iopub.status.busy": "2026-03-24T02:05:32.630508Z", + "iopub.status.idle": "2026-03-24T02:05:32.649968Z", + "shell.execute_reply": "2026-03-24T02:05:32.649557Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Named expression `comparison' has type `Comparison[int!, int!]' which cannot be stored as an OMMX NamedFunction (only scalar, tensor-of-scalars, and dict-of-scalars are supported)\n" + ] + } + ], + "source": [ + "# Comparison expressions cannot be saved.\n", + "a = problem.IntegerVar(\"a\", lower_bound=0, upper_bound=10)\n", + "try:\n", + " problem.NamedExpr(\"comparison\", a == 2, save_in_ommx=True)\n", + "except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "69a09dfa", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.650995Z", + "iopub.status.busy": "2026-03-24T02:05:32.650942Z", + "iopub.status.idle": "2026-03-24T02:05:32.658867Z", + "shell.execute_reply": "2026-03-24T02:05:32.658578Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Named expression `category_labels' has type `Set[CategoryLabel(\"L\")]' which cannot be stored as an OMMX NamedFunction (only scalar, tensor-of-scalars, and dict-of-scalars are supported)\n" + ] + } + ], + "source": [ + "# Category labels cannot be saved.\n", + "L = problem.CategoryLabel(\"L\")\n", + "try:\n", + " problem.NamedExpr(\"category_labels\", L, save_in_ommx=True)\n", + "except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "c3d56b52", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.659946Z", + "iopub.status.busy": "2026-03-24T02:05:32.659887Z", + "iopub.status.idle": "2026-03-24T02:05:32.675976Z", + "shell.execute_reply": "2026-03-24T02:05:32.675660Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Named expression `array_of_array' has type `Array[5; Array[5; binary!]]' which cannot be stored as an OMMX NamedFunction (only scalar, tensor-of-scalars, and dict-of-scalars are supported)\n" + ] + } + ], + "source": [ + "# `rows()` returns an array of arrays, so it cannot be saved.\n", + "x = problem.BinaryVar(\"M\", shape=(5, 5))\n", + "try:\n", + " problem.NamedExpr(\"array_of_array\", x.rows(), save_in_ommx=True)\n", + "except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "markdown", + "id": "caafd868", + "metadata": {}, + "source": [ + ":::{tip}\n", + "Even for expressions that cannot be saved in an OMMX instance, you can still declare them as `NamedExpr` by setting `save_in_ommx=False` or leaving it unspecified.\n", + ":::" + ] + }, + { + "cell_type": "markdown", + "id": "311c3842", + "metadata": {}, + "source": [ + "Now let us look at an example of saving a specific expression in an OMMX instance and evaluating its value after solving. In the knapsack problem, suppose that in addition to the objective value, which is the total value of the selected items, we also want to know the total weight of the items." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "d5d13841", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.677059Z", + "iopub.status.busy": "2026-03-24T02:05:32.677004Z", + "iopub.status.idle": "2026-03-24T02:05:32.871249Z", + "shell.execute_reply": "2026-03-24T02:05:32.870949Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Knapsack}\\\\\\displaystyle \\max &\\displaystyle \\sum _{i=0}^{N-1}{{v}_{i}\\cdot {x}_{i}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", + "\\text{Weight}&\\quad \\displaystyle total\\_{}weight\\leq W\\end{aligned}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\&&&\\text{$x_i = 1$ if item i is put in the knapsack}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[N;\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{value of each item}\\\\&&&\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\&&&\\text{maximum weight capacity of the knapsack}\\\\&&&\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{weight of each item}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N},\\text{Length of w}\\\\&&&\\\\total\\_{}weight&=\\sum _{i=0}^{N-1}{{w}_{i}\\cdot {x}_{i}}&\\quad &\\in \\mathbb{R},\\text{Total weight of items in the knapsack}\\\\&&&\\text{\\texttt{save\\_{}in\\_{}ommx=True}}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Knapsack\", sense=MAXIMIZE, objective=sum(N.map(lambda (i: natural): v[i] * x[i])), constraints={Weight: [Constraint(name=\"Weight\", sense=LESS_THAN_EQUAL, left=total_weight, right=W, shape=Scalar(Float)),],})" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "@jm.Problem.define(\"Knapsack\", sense=jm.ProblemSense.MAXIMIZE)\n", + "def knapsack_weight(problem: jm.DecoratedProblem):\n", + " W = problem.Float(description=\"maximum weight capacity of the knapsack\")\n", + " w = problem.Float(ndim=1, description=\"weight of each item\")\n", + " N = problem.NamedExpr(w.len_at(0), description=\"Length of w\")\n", + " v = problem.Float(shape=(N,), description=\"value of each item\")\n", + " x = problem.BinaryVar(\n", + " shape=(N,), description=\"$x_i = 1$ if item i is put in the knapsack\"\n", + " )\n", + " total_weight = problem.NamedExpr(\n", + " jm.sum(w[i] * x[i] for i in N),\n", + " description=\"Total weight of items in the knapsack\",\n", + " save_in_ommx=True,\n", + " )\n", + "\n", + " problem += jm.sum(v[i] * x[i] for i in N)\n", + " problem += problem.Constraint(\"Weight\", total_weight <= W)\n", + "\n", + "\n", + "knapsack_weight" + ] + }, + { + "cell_type": "markdown", + "id": "2e621011", + "metadata": {}, + "source": [ + "In the code above, we give the total-weight expression the name `total_weight`, and enable saving it in the OMMX instance by setting `save_in_ommx=True`. Now let us compile this model and generate the OMMX instance." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "dba7ad0a", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:32.872464Z", + "iopub.status.busy": "2026-03-24T02:05:32.872404Z", + "iopub.status.idle": "2026-03-24T02:05:33.214174Z", + "shell.execute_reply": "2026-03-24T02:05:33.213701Z" + } + }, + "outputs": [], + "source": [ + "instance = knapsack_weight.eval(knapsack_instance_data)" + ] + }, + { + "cell_type": "markdown", + "id": "2009e488", + "metadata": {}, + "source": [ + "You can inspect the expressions saved in the OMMX instance via the {py:meth}`ommx.v1.Instance.named_functions` and {py:meth}`ommx.v1.Instance.named_functions_df` properties." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "2e3710ba", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:33.215352Z", + "iopub.status.busy": "2026-03-24T02:05:33.215291Z", + "iopub.status.idle": "2026-03-24T02:05:33.225769Z", + "shell.execute_reply": "2026-03-24T02:05:33.225449Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
typefunctionused_idsnamesubscriptsdescriptionparameters.subscripts
id
0LinearFunction(11*x0 + 15*x1 + 20*x2 + 35*x3 + 10*x4...{0, 1, 2, 3, 4, 5}total_weight[]Total weight of items in the knapsack[]
\n", + "
" + ], + "text/plain": [ + " type function \\\n", + "id \n", + "0 Linear Function(11*x0 + 15*x1 + 20*x2 + 35*x3 + 10*x4... \n", + "\n", + " used_ids name subscripts \\\n", + "id \n", + "0 {0, 1, 2, 3, 4, 5} total_weight [] \n", + "\n", + " description parameters.subscripts \n", + "id \n", + "0 Total weight of items in the knapsack [] " + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "instance.named_functions_df" + ] + }, + { + "cell_type": "markdown", + "id": "a94be26e", + "metadata": {}, + "source": [ + ":::{tip}\n", + "To get the `NamedFunction` IDs corresponding to expressions saved in the OMMX instance, use {py:meth}`Compiler.get_named_function_id_by_name() `.\n", + ":::" + ] + }, + { + "cell_type": "markdown", + "id": "6be31497", + "metadata": {}, + "source": [ + "Now let us solve this OMMX instance with OpenJij and inspect the value of `total_weight` in the resulting solution." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "37c9e656", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:33.226786Z", + "iopub.status.busy": "2026-03-24T02:05:33.226736Z", + "iopub.status.idle": "2026-03-24T02:05:33.491441Z", + "shell.execute_reply": "2026-03-24T02:05:33.491017Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
valueused_idsnamesubscriptsdescriptionparameters.subscripts
id
046.0{0, 1, 2, 3, 4, 5}total_weight[]Total weight of items in the knapsack[]
\n", + "
" + ], + "text/plain": [ + " value used_ids name subscripts \\\n", + "id \n", + "0 46.0 {0, 1, 2, 3, 4, 5} total_weight [] \n", + "\n", + " description parameters.subscripts \n", + "id \n", + "0 Total weight of items in the knapsack [] " + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from ommx_openjij_adapter import OMMXOpenJijSAAdapter\n", + "\n", + "solution = OMMXOpenJijSAAdapter.solve(\n", + " instance,\n", + " num_reads=100,\n", + " num_sweeps=10,\n", + " uniform_penalty_weight=1.6,\n", + ")\n", + "\n", + "solution.named_functions_df" + ] + }, + { + "cell_type": "markdown", + "id": "cc1354f1", + "metadata": {}, + "source": [ + "This confirms that the value of the expression `total_weight` saved in the OMMX instance can be evaluated.\n", + "Besides this kind of usage, saving specific expressions in OMMX instances is also useful in cases such as weighted multi-objective optimization." + ] + } + ], + "metadata": { + "jupytext": { + "default_lexer": "ipython3" + }, + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/en/advanced/serialize.ipynb b/docs/en/advanced/serialize.ipynb new file mode 100644 index 00000000..30d626b0 --- /dev/null +++ b/docs/en/advanced/serialize.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "4c9e7601-a3f2-496b-88a0-88e76bd18e7c", + "metadata": {}, + "source": [ + "# Serialization\n", + "\n", + "JijModeling models can be easily serialized to [Protobuf](https://protobuf.dev) using the {py:func}`jijmodeling.to_protobuf` function or the {py:meth}`Problem.to_protobuf ` method." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "545186b3-caf3-4c92-a0a9-c7515923bffd", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:34.913506Z", + "iopub.status.busy": "2026-03-24T02:05:34.913412Z", + "iopub.status.idle": "2026-03-24T02:05:34.958083Z", + "shell.execute_reply": "2026-03-24T02:05:34.957577Z" + } + }, + "outputs": [], + "source": [ + "import jijmodeling as jm\n", + "\n", + "problem = jm.Problem(\"my problem\")\n", + "N = problem.Placeholder(\"N\", dtype=jm.DataType.NATURAL)\n", + "x = problem.BinaryVar(\"x\", shape=(N,))\n", + "problem += x.sum()\n", + "\n", + "serialized = problem.to_protobuf()" + ] + }, + { + "cell_type": "markdown", + "id": "033466c5-157a-4b25-90b7-f9d38f81067d", + "metadata": {}, + "source": [ + "To deserialize, use {py:func}`jijmodeling.from_protobuf` or {py:meth}`Problem.from_protobuf `." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "271e3da1-63a5-448e-ab1a-ccff3476b945", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:34.959384Z", + "iopub.status.busy": "2026-03-24T02:05:34.959313Z", + "iopub.status.idle": "2026-03-24T02:05:34.964237Z", + "shell.execute_reply": "2026-03-24T02:05:34.963959Z" + } + }, + "outputs": [], + "source": [ + "deserialized = jm.from_protobuf(serialized)" + ] + } + ], + "metadata": { + "jupytext": { + "default_lexer": "ipython3" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/en/basics/expressions.ipynb b/docs/en/basics/expressions.ipynb index 0dd44c53..bac74046 100644 --- a/docs/en/basics/expressions.ipynb +++ b/docs/en/basics/expressions.ipynb @@ -25,10 +25,10 @@ "id": "e511a2c6", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:42.894274Z", - "iopub.status.busy": "2026-02-26T05:58:42.894200Z", - "iopub.status.idle": "2026-02-26T05:58:44.052480Z", - "shell.execute_reply": "2026-02-26T05:58:44.051148Z" + "iopub.execute_input": "2026-03-24T02:05:22.675579Z", + "iopub.status.busy": "2026-03-24T02:05:22.675518Z", + "iopub.status.idle": "2026-03-24T02:05:22.680581Z", + "shell.execute_reply": "2026-03-24T02:05:22.680173Z" } }, "outputs": [], @@ -58,10 +58,10 @@ "id": "fdd9d4ad", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.058019Z", - "iopub.status.busy": "2026-02-26T05:58:44.057619Z", - "iopub.status.idle": "2026-02-26T05:58:44.142720Z", - "shell.execute_reply": "2026-02-26T05:58:44.142273Z" + "iopub.execute_input": "2026-03-24T02:05:22.681647Z", + "iopub.status.busy": "2026-03-24T02:05:22.681589Z", + "iopub.status.idle": "2026-03-24T02:05:22.747100Z", + "shell.execute_reply": "2026-03-24T02:05:22.746786Z" }, "label": "test-problem" }, @@ -182,10 +182,10 @@ "id": "e38e46d8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.143951Z", - "iopub.status.busy": "2026-02-26T05:58:44.143866Z", - "iopub.status.idle": "2026-02-26T05:58:44.163147Z", - "shell.execute_reply": "2026-02-26T05:58:44.162755Z" + "iopub.execute_input": "2026-03-24T02:05:22.748301Z", + "iopub.status.busy": "2026-03-24T02:05:22.748242Z", + "iopub.status.idle": "2026-03-24T02:05:22.763581Z", + "shell.execute_reply": "2026-03-24T02:05:22.763245Z" } }, "outputs": [ @@ -225,10 +225,10 @@ "id": "e7874eab", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.165660Z", - "iopub.status.busy": "2026-02-26T05:58:44.165573Z", - "iopub.status.idle": "2026-02-26T05:58:44.176311Z", - "shell.execute_reply": "2026-02-26T05:58:44.175298Z" + "iopub.execute_input": "2026-03-24T02:05:22.764719Z", + "iopub.status.busy": "2026-03-24T02:05:22.764658Z", + "iopub.status.idle": "2026-03-24T02:05:22.773383Z", + "shell.execute_reply": "2026-03-24T02:05:22.773031Z" } }, "outputs": [ @@ -238,13 +238,13 @@ "text": [ "Traceback (most recent last):\n", " while inferring the type of expression `x + Located { inner: \"hoge\", src_span: NoSrcSpan }',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/594888127.py\", line 3, col 19-29\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/594888127.py\", line 3, col 19-29\n", " while inferring the type of expression `x + Located { inner: \"hoge\", src_span: NoSrcSpan }',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/594888127.py\", line 3, col 19-29\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/594888127.py\", line 3, col 19-29\n", " while checking if types `binary!' and `Literal[\"hoge\"]' can be combined with numeric operator `Add',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/594888127.py\", line 3, col 19-29\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/594888127.py\", line 3, col 19-29\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/594888127.py\", line 3, col 19-29:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/594888127.py\", line 3, col 19-29:\n", "\n", " 3 | problem.infer(x + \"hoge\")\n", " ^^^^^^^^^^\n", @@ -277,7 +277,7 @@ "\n", "| Type name | Description |\n", "| --- | --- |\n", - "| `ExpressionLike` | A type that can be converted to {py:class}`~jijmodeling.Expression`. Depending on the context, this includes {py:class}`~jijmodeling.Expression` itself, {py:class}`~jijmodeling.Placeholder`, {py:class}`~jijmodeling.DecisionVar`, {py:class}`~jijmodeling.DependentVar`, as well as Python numbers, strings, tuples, lists, dictionaries, NumPy arrays, and so on. |\n", + "| `ExpressionLike` | A type that can be converted to {py:class}`~jijmodeling.Expression`. Depending on the context, this includes {py:class}`~jijmodeling.Expression` itself, {py:class}`~jijmodeling.Placeholder`, {py:class}`~jijmodeling.DecisionVar`, {py:class}`~jijmodeling.NamedExpr`, as well as Python numbers, strings, tuples, lists, dictionaries, NumPy arrays, and so on. |\n", "| `ExpressionFunction` | A function that takes one or more {py:class}`~jijmodeling.Expression` objects and returns a {py:class}`~jijmodeling.Expression`. In Python type hints, only up to 5 arguments are enumerated, but in practice there is no limit on the number of arguments. |\n", "\n", ":::\n", @@ -319,10 +319,10 @@ "id": "dc85ae1d", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.178310Z", - "iopub.status.busy": "2026-02-26T05:58:44.178213Z", - "iopub.status.idle": "2026-02-26T05:58:44.618748Z", - "shell.execute_reply": "2026-02-26T05:58:44.618317Z" + "iopub.execute_input": "2026-03-24T02:05:22.774450Z", + "iopub.status.busy": "2026-03-24T02:05:22.774398Z", + "iopub.status.idle": "2026-03-24T02:05:23.035083Z", + "shell.execute_reply": "2026-03-24T02:05:23.034403Z" } }, "outputs": [ @@ -384,10 +384,10 @@ "id": "4cdd5152", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.620391Z", - "iopub.status.busy": "2026-02-26T05:58:44.620279Z", - "iopub.status.idle": "2026-02-26T05:58:44.630713Z", - "shell.execute_reply": "2026-02-26T05:58:44.630316Z" + "iopub.execute_input": "2026-03-24T02:05:23.036874Z", + "iopub.status.busy": "2026-03-24T02:05:23.036736Z", + "iopub.status.idle": "2026-03-24T02:05:23.047188Z", + "shell.execute_reply": "2026-03-24T02:05:23.046886Z" } }, "outputs": [ @@ -415,10 +415,10 @@ "id": "28d877b6", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.632034Z", - "iopub.status.busy": "2026-02-26T05:58:44.631955Z", - "iopub.status.idle": "2026-02-26T05:58:44.666996Z", - "shell.execute_reply": "2026-02-26T05:58:44.666141Z" + "iopub.execute_input": "2026-03-24T02:05:23.048413Z", + "iopub.status.busy": "2026-03-24T02:05:23.048354Z", + "iopub.status.idle": "2026-03-24T02:05:23.072555Z", + "shell.execute_reply": "2026-03-24T02:05:23.072178Z" } }, "outputs": [ @@ -446,10 +446,10 @@ "id": "f96d34c7", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.670236Z", - "iopub.status.busy": "2026-02-26T05:58:44.670003Z", - "iopub.status.idle": "2026-02-26T05:58:44.692185Z", - "shell.execute_reply": "2026-02-26T05:58:44.691834Z" + "iopub.execute_input": "2026-03-24T02:05:23.073523Z", + "iopub.status.busy": "2026-03-24T02:05:23.073463Z", + "iopub.status.idle": "2026-03-24T02:05:23.090106Z", + "shell.execute_reply": "2026-03-24T02:05:23.089743Z" } }, "outputs": [ @@ -477,10 +477,10 @@ "id": "5adad4bc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.693398Z", - "iopub.status.busy": "2026-02-26T05:58:44.693335Z", - "iopub.status.idle": "2026-02-26T05:58:44.718578Z", - "shell.execute_reply": "2026-02-26T05:58:44.718289Z" + "iopub.execute_input": "2026-03-24T02:05:23.091104Z", + "iopub.status.busy": "2026-03-24T02:05:23.091047Z", + "iopub.status.idle": "2026-03-24T02:05:23.114714Z", + "shell.execute_reply": "2026-03-24T02:05:23.114316Z" } }, "outputs": [ @@ -508,10 +508,10 @@ "id": "6ab268e5", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.719917Z", - "iopub.status.busy": "2026-02-26T05:58:44.719853Z", - "iopub.status.idle": "2026-02-26T05:58:44.738865Z", - "shell.execute_reply": "2026-02-26T05:58:44.738592Z" + "iopub.execute_input": "2026-03-24T02:05:23.115598Z", + "iopub.status.busy": "2026-03-24T02:05:23.115550Z", + "iopub.status.idle": "2026-03-24T02:05:23.132080Z", + "shell.execute_reply": "2026-03-24T02:05:23.131772Z" } }, "outputs": [ @@ -547,10 +547,10 @@ "id": "75aa08e2", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.740153Z", - "iopub.status.busy": "2026-02-26T05:58:44.740090Z", - "iopub.status.idle": "2026-02-26T05:58:44.749592Z", - "shell.execute_reply": "2026-02-26T05:58:44.749289Z" + "iopub.execute_input": "2026-03-24T02:05:23.133342Z", + "iopub.status.busy": "2026-03-24T02:05:23.133282Z", + "iopub.status.idle": "2026-03-24T02:05:23.142279Z", + "shell.execute_reply": "2026-03-24T02:05:23.141967Z" } }, "outputs": [ @@ -560,13 +560,13 @@ "text": [ "Traceback (most recent last):\n", " while inferring the type of expression `S * y',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/2932800859.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/2932800859.py\", line 3, col 19-24\n", " while inferring the type of expression `S * y',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/2932800859.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/2932800859.py\", line 3, col 19-24\n", " while checking if types `TotalDict[N; float]' and `Array[N, M; int!]' can be combined with numeric operator `Mul',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/2932800859.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/2932800859.py\", line 3, col 19-24\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/2932800859.py\", line 3, col 19-24:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/2932800859.py\", line 3, col 19-24:\n", "\n", " 3 | problem.infer(S * y)\n", " ^^^^^\n", @@ -589,10 +589,10 @@ "id": "17c3299c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.750481Z", - "iopub.status.busy": "2026-02-26T05:58:44.750429Z", - "iopub.status.idle": "2026-02-26T05:58:44.759376Z", - "shell.execute_reply": "2026-02-26T05:58:44.759020Z" + "iopub.execute_input": "2026-03-24T02:05:23.143225Z", + "iopub.status.busy": "2026-03-24T02:05:23.143170Z", + "iopub.status.idle": "2026-03-24T02:05:23.152189Z", + "shell.execute_reply": "2026-03-24T02:05:23.151909Z" } }, "outputs": [ @@ -602,13 +602,13 @@ "text": [ "Traceback (most recent last):\n", " while inferring the type of expression `y + z',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/3762455632.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/3762455632.py\", line 3, col 19-24\n", " while inferring the type of expression `y + z',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/3762455632.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/3762455632.py\", line 3, col 19-24\n", " while checking if types `Array[N, M; int!]' and `Array[N, M, N; float!]' can be combined with numeric operator `Add',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/3762455632.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/3762455632.py\", line 3, col 19-24\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_20655/3762455632.py\", line 3, col 19-24:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_48108/3762455632.py\", line 3, col 19-24:\n", "\n", " 3 | problem.infer(y + z)\n", " ^^^^^\n", @@ -666,10 +666,10 @@ "id": "6c81d662", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.760446Z", - "iopub.status.busy": "2026-02-26T05:58:44.760395Z", - "iopub.status.idle": "2026-02-26T05:58:44.783255Z", - "shell.execute_reply": "2026-02-26T05:58:44.782898Z" + "iopub.execute_input": "2026-03-24T02:05:23.153443Z", + "iopub.status.busy": "2026-03-24T02:05:23.153393Z", + "iopub.status.idle": "2026-03-24T02:05:23.176773Z", + "shell.execute_reply": "2026-03-24T02:05:23.176454Z" } }, "outputs": [ @@ -697,10 +697,10 @@ "id": "b43188e5", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.784156Z", - "iopub.status.busy": "2026-02-26T05:58:44.784105Z", - "iopub.status.idle": "2026-02-26T05:58:44.793760Z", - "shell.execute_reply": "2026-02-26T05:58:44.793410Z" + "iopub.execute_input": "2026-03-24T02:05:23.177982Z", + "iopub.status.busy": "2026-03-24T02:05:23.177925Z", + "iopub.status.idle": "2026-03-24T02:05:23.187379Z", + "shell.execute_reply": "2026-03-24T02:05:23.187017Z" } }, "outputs": [ @@ -728,10 +728,10 @@ "id": "49d90ad4", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.794826Z", - "iopub.status.busy": "2026-02-26T05:58:44.794771Z", - "iopub.status.idle": "2026-02-26T05:58:44.834218Z", - "shell.execute_reply": "2026-02-26T05:58:44.833512Z" + "iopub.execute_input": "2026-03-24T02:05:23.188286Z", + "iopub.status.busy": "2026-03-24T02:05:23.188236Z", + "iopub.status.idle": "2026-03-24T02:05:23.225769Z", + "shell.execute_reply": "2026-03-24T02:05:23.225380Z" } }, "outputs": [ @@ -795,10 +795,10 @@ "id": "c4eff827", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.835508Z", - "iopub.status.busy": "2026-02-26T05:58:44.835432Z", - "iopub.status.idle": "2026-02-26T05:58:44.909805Z", - "shell.execute_reply": "2026-02-26T05:58:44.908559Z" + "iopub.execute_input": "2026-03-24T02:05:23.226698Z", + "iopub.status.busy": "2026-03-24T02:05:23.226647Z", + "iopub.status.idle": "2026-03-24T02:05:23.290179Z", + "shell.execute_reply": "2026-03-24T02:05:23.289811Z" } }, "outputs": [ @@ -851,6 +851,7 @@ ":::\n", "\n", "Some values are automatically converted to sets. For example, a multi-dimensional array becomes a set that scans elements in row-major order, a natural number $N$ becomes the set $\\{0, 1, \\ldots, N-1\\}$, and a category label `L` becomes the set of all values of `L` given at compile time.\n", + "Also, since JijModeling 2.3.1, the {py:func}`jijmodeling.range` function, corresponding to Python's built-in {py:class}`range() `, is available for defining sets consisting of arithmetic progressions of natural numbers.\n", "\n", ":::{admonition} Change from JijModeling 1: arrays as \"sets\"\n", ":class: caution\n", @@ -893,10 +894,10 @@ "id": "1b8b9adc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:44.912957Z", - "iopub.status.busy": "2026-02-26T05:58:44.912589Z", - "iopub.status.idle": "2026-02-26T05:58:45.013455Z", - "shell.execute_reply": "2026-02-26T05:58:45.012611Z" + "iopub.execute_input": "2026-03-24T02:05:23.291256Z", + "iopub.status.busy": "2026-03-24T02:05:23.291200Z", + "iopub.status.idle": "2026-03-24T02:05:23.369196Z", + "shell.execute_reply": "2026-03-24T02:05:23.368776Z" } }, "outputs": [ @@ -947,10 +948,10 @@ "id": "49336545", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.014589Z", - "iopub.status.busy": "2026-02-26T05:58:45.014518Z", - "iopub.status.idle": "2026-02-26T05:58:45.034770Z", - "shell.execute_reply": "2026-02-26T05:58:45.034092Z" + "iopub.execute_input": "2026-03-24T02:05:23.370170Z", + "iopub.status.busy": "2026-03-24T02:05:23.370113Z", + "iopub.status.idle": "2026-03-24T02:05:23.388606Z", + "shell.execute_reply": "2026-03-24T02:05:23.388206Z" } }, "outputs": [ @@ -990,10 +991,10 @@ "id": "e35b793f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.036965Z", - "iopub.status.busy": "2026-02-26T05:58:45.036831Z", - "iopub.status.idle": "2026-02-26T05:58:45.113446Z", - "shell.execute_reply": "2026-02-26T05:58:45.113080Z" + "iopub.execute_input": "2026-03-24T02:05:23.389577Z", + "iopub.status.busy": "2026-03-24T02:05:23.389524Z", + "iopub.status.idle": "2026-03-24T02:05:23.462197Z", + "shell.execute_reply": "2026-03-24T02:05:23.461854Z" } }, "outputs": [ @@ -1037,10 +1038,10 @@ "id": "a48f127c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.114625Z", - "iopub.status.busy": "2026-02-26T05:58:45.114562Z", - "iopub.status.idle": "2026-02-26T05:58:45.195189Z", - "shell.execute_reply": "2026-02-26T05:58:45.194754Z" + "iopub.execute_input": "2026-03-24T02:05:23.463249Z", + "iopub.status.busy": "2026-03-24T02:05:23.463195Z", + "iopub.status.idle": "2026-03-24T02:05:23.543095Z", + "shell.execute_reply": "2026-03-24T02:05:23.542728Z" } }, "outputs": [ @@ -1095,10 +1096,10 @@ "id": "788d6c0f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.196420Z", - "iopub.status.busy": "2026-02-26T05:58:45.196359Z", - "iopub.status.idle": "2026-02-26T05:58:45.307379Z", - "shell.execute_reply": "2026-02-26T05:58:45.307017Z" + "iopub.execute_input": "2026-03-24T02:05:23.544323Z", + "iopub.status.busy": "2026-03-24T02:05:23.544268Z", + "iopub.status.idle": "2026-03-24T02:05:23.670726Z", + "shell.execute_reply": "2026-03-24T02:05:23.670416Z" } }, "outputs": [ @@ -1144,10 +1145,10 @@ "id": "718ac630", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.308491Z", - "iopub.status.busy": "2026-02-26T05:58:45.308426Z", - "iopub.status.idle": "2026-02-26T05:58:45.411619Z", - "shell.execute_reply": "2026-02-26T05:58:45.411271Z" + "iopub.execute_input": "2026-03-24T02:05:23.671828Z", + "iopub.status.busy": "2026-03-24T02:05:23.671769Z", + "iopub.status.idle": "2026-03-24T02:05:23.765405Z", + "shell.execute_reply": "2026-03-24T02:05:23.765028Z" } }, "outputs": [ @@ -1196,10 +1197,10 @@ "id": "c5cf959f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.412660Z", - "iopub.status.busy": "2026-02-26T05:58:45.412605Z", - "iopub.status.idle": "2026-02-26T05:58:45.558268Z", - "shell.execute_reply": "2026-02-26T05:58:45.557921Z" + "iopub.execute_input": "2026-03-24T02:05:23.766463Z", + "iopub.status.busy": "2026-03-24T02:05:23.766410Z", + "iopub.status.idle": "2026-03-24T02:05:23.879279Z", + "shell.execute_reply": "2026-03-24T02:05:23.878939Z" } }, "outputs": [ @@ -1246,10 +1247,10 @@ "id": "54bec6e0", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.559419Z", - "iopub.status.busy": "2026-02-26T05:58:45.559364Z", - "iopub.status.idle": "2026-02-26T05:58:45.660347Z", - "shell.execute_reply": "2026-02-26T05:58:45.660015Z" + "iopub.execute_input": "2026-03-24T02:05:23.881047Z", + "iopub.status.busy": "2026-03-24T02:05:23.880962Z", + "iopub.status.idle": "2026-03-24T02:05:23.991294Z", + "shell.execute_reply": "2026-03-24T02:05:23.990927Z" } }, "outputs": [ @@ -1296,10 +1297,10 @@ "id": "b37473be", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.661398Z", - "iopub.status.busy": "2026-02-26T05:58:45.661340Z", - "iopub.status.idle": "2026-02-26T05:58:45.797636Z", - "shell.execute_reply": "2026-02-26T05:58:45.797279Z" + "iopub.execute_input": "2026-03-24T02:05:23.992442Z", + "iopub.status.busy": "2026-03-24T02:05:23.992383Z", + "iopub.status.idle": "2026-03-24T02:05:24.137472Z", + "shell.execute_reply": "2026-03-24T02:05:24.137062Z" } }, "outputs": [ @@ -1351,10 +1352,10 @@ "id": "cc27b233", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.798601Z", - "iopub.status.busy": "2026-02-26T05:58:45.798548Z", - "iopub.status.idle": "2026-02-26T05:58:45.912169Z", - "shell.execute_reply": "2026-02-26T05:58:45.911808Z" + "iopub.execute_input": "2026-03-24T02:05:24.138503Z", + "iopub.status.busy": "2026-03-24T02:05:24.138438Z", + "iopub.status.idle": "2026-03-24T02:05:24.257288Z", + "shell.execute_reply": "2026-03-24T02:05:24.256983Z" } }, "outputs": [ @@ -1401,10 +1402,10 @@ "id": "38abd485", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:45.913202Z", - "iopub.status.busy": "2026-02-26T05:58:45.913145Z", - "iopub.status.idle": "2026-02-26T05:58:45.978516Z", - "shell.execute_reply": "2026-02-26T05:58:45.978112Z" + "iopub.execute_input": "2026-03-24T02:05:24.258572Z", + "iopub.status.busy": "2026-03-24T02:05:24.258514Z", + "iopub.status.idle": "2026-03-24T02:05:24.327328Z", + "shell.execute_reply": "2026-03-24T02:05:24.326896Z" } }, "outputs": [ diff --git a/docs/en/basics/instance_generation.ipynb b/docs/en/basics/instance_generation.ipynb index 133c6c3c..1e3eb7fe 100644 --- a/docs/en/basics/instance_generation.ipynb +++ b/docs/en/basics/instance_generation.ipynb @@ -30,10 +30,10 @@ "id": "2c684576", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:46.704188Z", - "iopub.status.busy": "2026-02-26T05:58:46.704122Z", - "iopub.status.idle": "2026-02-26T05:58:47.056490Z", - "shell.execute_reply": "2026-02-26T05:58:47.056075Z" + "iopub.execute_input": "2026-03-24T02:05:14.106336Z", + "iopub.status.busy": "2026-03-24T02:05:14.106269Z", + "iopub.status.idle": "2026-03-24T02:05:14.479929Z", + "shell.execute_reply": "2026-03-24T02:05:14.479587Z" } }, "outputs": [ @@ -109,10 +109,10 @@ "id": "0a5c6de3", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:47.057671Z", - "iopub.status.busy": "2026-02-26T05:58:47.057580Z", - "iopub.status.idle": "2026-02-26T05:58:47.059929Z", - "shell.execute_reply": "2026-02-26T05:58:47.059618Z" + "iopub.execute_input": "2026-03-24T02:05:14.481204Z", + "iopub.status.busy": "2026-03-24T02:05:14.481103Z", + "iopub.status.idle": "2026-03-24T02:05:14.483607Z", + "shell.execute_reply": "2026-03-24T02:05:14.483299Z" } }, "outputs": [], @@ -163,10 +163,10 @@ "id": "ee4308f1", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:47.060773Z", - "iopub.status.busy": "2026-02-26T05:58:47.060715Z", - "iopub.status.idle": "2026-02-26T05:58:49.401610Z", - "shell.execute_reply": "2026-02-26T05:58:49.401231Z" + "iopub.execute_input": "2026-03-24T02:05:14.484698Z", + "iopub.status.busy": "2026-03-24T02:05:14.484640Z", + "iopub.status.idle": "2026-03-24T02:05:15.313963Z", + "shell.execute_reply": "2026-03-24T02:05:15.313614Z" } }, "outputs": [ @@ -248,10 +248,10 @@ "id": "6b03e399", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:49.402647Z", - "iopub.status.busy": "2026-02-26T05:58:49.402560Z", - "iopub.status.idle": "2026-02-26T05:58:49.407455Z", - "shell.execute_reply": "2026-02-26T05:58:49.407195Z" + "iopub.execute_input": "2026-03-24T02:05:15.315112Z", + "iopub.status.busy": "2026-03-24T02:05:15.315011Z", + "iopub.status.idle": "2026-03-24T02:05:15.320236Z", + "shell.execute_reply": "2026-03-24T02:05:15.319907Z" } }, "outputs": [ @@ -455,10 +455,10 @@ "id": "59256385", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:49.408493Z", - "iopub.status.busy": "2026-02-26T05:58:49.408444Z", - "iopub.status.idle": "2026-02-26T05:58:49.410182Z", - "shell.execute_reply": "2026-02-26T05:58:49.409946Z" + "iopub.execute_input": "2026-03-24T02:05:15.321269Z", + "iopub.status.busy": "2026-03-24T02:05:15.321214Z", + "iopub.status.idle": "2026-03-24T02:05:15.326594Z", + "shell.execute_reply": "2026-03-24T02:05:15.326281Z" } }, "outputs": [ @@ -492,10 +492,10 @@ "id": "201474f3", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:49.411092Z", - "iopub.status.busy": "2026-02-26T05:58:49.411037Z", - "iopub.status.idle": "2026-02-26T05:58:49.953662Z", - "shell.execute_reply": "2026-02-26T05:58:49.953081Z" + "iopub.execute_input": "2026-03-24T02:05:15.327716Z", + "iopub.status.busy": "2026-03-24T02:05:15.327656Z", + "iopub.status.idle": "2026-03-24T02:05:15.712228Z", + "shell.execute_reply": "2026-03-24T02:05:15.711893Z" } }, "outputs": [], @@ -555,10 +555,10 @@ "id": "90434a42", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:49.957405Z", - "iopub.status.busy": "2026-02-26T05:58:49.957314Z", - "iopub.status.idle": "2026-02-26T05:58:49.983035Z", - "shell.execute_reply": "2026-02-26T05:58:49.982683Z" + "iopub.execute_input": "2026-03-24T02:05:15.713668Z", + "iopub.status.busy": "2026-03-24T02:05:15.713595Z", + "iopub.status.idle": "2026-03-24T02:05:15.737562Z", + "shell.execute_reply": "2026-03-24T02:05:15.737202Z" } }, "outputs": [ @@ -630,10 +630,10 @@ "id": "135be9f2", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:49.984068Z", - "iopub.status.busy": "2026-02-26T05:58:49.984008Z", - "iopub.status.idle": "2026-02-26T05:58:50.297589Z", - "shell.execute_reply": "2026-02-26T05:58:50.297105Z" + "iopub.execute_input": "2026-03-24T02:05:15.738711Z", + "iopub.status.busy": "2026-03-24T02:05:15.738644Z", + "iopub.status.idle": "2026-03-24T02:05:15.791763Z", + "shell.execute_reply": "2026-03-24T02:05:15.791431Z" } }, "outputs": [ diff --git a/docs/en/basics/modeling.ipynb b/docs/en/basics/modeling.ipynb index 254944b0..d22916f9 100644 --- a/docs/en/basics/modeling.ipynb +++ b/docs/en/basics/modeling.ipynb @@ -17,10 +17,10 @@ "id": "b08e6532", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:51.815691Z", - "iopub.status.busy": "2026-02-26T05:58:51.815468Z", - "iopub.status.idle": "2026-02-26T05:58:51.840063Z", - "shell.execute_reply": "2026-02-26T05:58:51.835727Z" + "iopub.execute_input": "2026-03-24T02:05:18.322485Z", + "iopub.status.busy": "2026-03-24T02:05:18.322275Z", + "iopub.status.idle": "2026-03-24T02:05:18.331695Z", + "shell.execute_reply": "2026-03-24T02:05:18.331323Z" } }, "outputs": [], @@ -55,10 +55,10 @@ "id": "ae36f6cb", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:51.878840Z", - "iopub.status.busy": "2026-02-26T05:58:51.878528Z", - "iopub.status.idle": "2026-02-26T05:58:52.172315Z", - "shell.execute_reply": "2026-02-26T05:58:52.171435Z" + "iopub.execute_input": "2026-03-24T02:05:18.332840Z", + "iopub.status.busy": "2026-03-24T02:05:18.332782Z", + "iopub.status.idle": "2026-03-24T02:05:18.383874Z", + "shell.execute_reply": "2026-03-24T02:05:18.383231Z" } }, "outputs": [ @@ -100,10 +100,10 @@ "id": "2f314ff6", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:52.173437Z", - "iopub.status.busy": "2026-02-26T05:58:52.173360Z", - "iopub.status.idle": "2026-02-26T05:58:52.195868Z", - "shell.execute_reply": "2026-02-26T05:58:52.195412Z" + "iopub.execute_input": "2026-03-24T02:05:18.384853Z", + "iopub.status.busy": "2026-03-24T02:05:18.384791Z", + "iopub.status.idle": "2026-03-24T02:05:18.406343Z", + "shell.execute_reply": "2026-03-24T02:05:18.406018Z" } }, "outputs": [ @@ -138,6 +138,12 @@ "You can see that the existing term was not replaced; instead, $y$ was added and the new objective is $x + y$.\n", "If you might need to remove objective terms later, keep a list of terms in Python and set the objective from that list when needed.\n", "\n", + ":::{admonition} Subtracting terms from the objective\n", + ":class: tip\n", + "\n", + "Since JijModeling 2.3.1, you can also \"subtract\" scalar {py:class}`~jijmodeling.Expression` objects from the objective by using the {py:meth}`-= ` operator on a {py:class}`~jijmodeling.Problem`.\n", + ":::\n", + "\n", "As a more practical example, let's set the objective for the knapsack problem." ] }, @@ -147,10 +153,10 @@ "id": "71a3019e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:52.196950Z", - "iopub.status.busy": "2026-02-26T05:58:52.196892Z", - "iopub.status.idle": "2026-02-26T05:58:52.779506Z", - "shell.execute_reply": "2026-02-26T05:58:52.778802Z" + "iopub.execute_input": "2026-03-24T02:05:18.407562Z", + "iopub.status.busy": "2026-03-24T02:05:18.407499Z", + "iopub.status.idle": "2026-03-24T02:05:18.505954Z", + "shell.execute_reply": "2026-03-24T02:05:18.505541Z" } }, "outputs": [ @@ -225,10 +231,10 @@ "id": "ec207a7d", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:52.781271Z", - "iopub.status.busy": "2026-02-26T05:58:52.781204Z", - "iopub.status.idle": "2026-02-26T05:58:52.892726Z", - "shell.execute_reply": "2026-02-26T05:58:52.892356Z" + "iopub.execute_input": "2026-03-24T02:05:18.507453Z", + "iopub.status.busy": "2026-03-24T02:05:18.507378Z", + "iopub.status.idle": "2026-03-24T02:05:18.646245Z", + "shell.execute_reply": "2026-03-24T02:05:18.645925Z" } }, "outputs": [ @@ -273,6 +279,12 @@ "\n", "When adding a constraint, always use the {py:meth}`+= ` operator.\n", "Simply calling {py:meth}`Problem.Constraint() ` does not add the constraint to the model.\n", + ":::\n", + "\n", + ":::{admonition} Removing constraints\n", + ":class: important\n", + "\n", + "At present, there is no way to remove constraints from a model. In particular, note that you cannot \"subtract\" constraints from a model using the {py:func}`-= ` operator.\n", ":::" ] }, @@ -315,10 +327,10 @@ "id": "e9d70317", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:52.893858Z", - "iopub.status.busy": "2026-02-26T05:58:52.893799Z", - "iopub.status.idle": "2026-02-26T05:58:53.280553Z", - "shell.execute_reply": "2026-02-26T05:58:53.280176Z" + "iopub.execute_input": "2026-03-24T02:05:18.647477Z", + "iopub.status.busy": "2026-03-24T02:05:18.647411Z", + "iopub.status.idle": "2026-03-24T02:05:19.025472Z", + "shell.execute_reply": "2026-03-24T02:05:19.025070Z" } }, "outputs": [ @@ -327,7 +339,7 @@ "text/latex": [ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{TSP, Decorated}\\\\\\displaystyle \\min &\\displaystyle \\sum _{t=0}^{\\#C-1}{\\sum _{i\\in C}{\\sum _{j\\in C}{{d}_{i,j}\\cdot {x}_{t,i}\\cdot {x}_{\\left(t+1\\right)\\bmod \\#C,j}}}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", - "\\text{one city}&\\quad \\displaystyle \\sum _{i\\in C}{{x}_{t,i}}=1\\quad \\forall t\\;\\text{s.t.}\\;t\\in \\#C\\\\\\text{one time}&\\quad \\displaystyle \\sum _{t\\in \\#C}{{x}_{t,i}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in C\\end{aligned}\n", + "\\text{one city}&\\quad \\displaystyle \\sum _{i\\in C}{{x}_{t,i}}=1\\quad \\forall t\\;\\text{s.t.}\\;t\\in \\left\\{0,\\ldots ,\\#C-1\\right\\}\\\\\\text{one time}&\\quad \\displaystyle \\sum _{t=0}^{\\#C-1}{{x}_{t,i}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in C\\end{aligned}\n", "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\#C\\times C;\\left\\{0, 1\\right\\}\\right]&\\quad &\\text{a dictionary of }\\text{binary}\\text{ variables with key }\\#C\\times C\\\\&&&\\text{$x_{t,i} = 1$ if City $i$ is visited at time $t$}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}d&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{C}\\times \\mathrm{C};\\mathbb{R}\\right]&\\quad &\\text{A total dictionary of placeholders with keys }\\left(\\mathrm{C},\\mathrm{C}\\right)\\text{, values in }\\mathbb{R}\\\\&&&\\text{distance between cities}\\\\\\end{alignedat}\\\\&\\\\&\\text{Category Labels:}\\\\&\\qquad \\begin{array}{rl}\n", "C&\\text{Labels of Cities}\\end{array}\n", "\\end{array}\n", @@ -383,10 +395,10 @@ "id": "a4643a1c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:53.281779Z", - "iopub.status.busy": "2026-02-26T05:58:53.281718Z", - "iopub.status.idle": "2026-02-26T05:58:53.614155Z", - "shell.execute_reply": "2026-02-26T05:58:53.613766Z" + "iopub.execute_input": "2026-03-24T02:05:19.026595Z", + "iopub.status.busy": "2026-03-24T02:05:19.026530Z", + "iopub.status.idle": "2026-03-24T02:05:19.343648Z", + "shell.execute_reply": "2026-03-24T02:05:19.343340Z" } }, "outputs": [ @@ -395,7 +407,7 @@ "text/latex": [ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{TSP, Decorated}\\\\\\displaystyle \\min &\\displaystyle \\sum _{t=0}^{\\#C-1}{\\sum _{i\\in C}{\\sum _{j\\in C}{{d}_{i,j}\\cdot {x}_{t,i}\\cdot {x}_{\\left(t+1\\right)\\bmod \\#C,j}}}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", - "\\text{one city}&\\quad \\displaystyle \\sum _{i\\in C}{{x}_{t,i}}=1\\quad \\forall t\\;\\text{s.t.}\\;t\\in \\#C\\\\\\text{one time}&\\quad \\displaystyle \\sum _{t\\in \\#C}{{x}_{t,i}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in C\\end{aligned}\n", + "\\text{one city}&\\quad \\displaystyle \\sum _{i\\in C}{{x}_{t,i}}=1\\quad \\forall t\\;\\text{s.t.}\\;t\\in \\left\\{0,\\ldots ,\\#C-1\\right\\}\\\\\\text{one time}&\\quad \\displaystyle \\sum _{t=0}^{\\#C-1}{{x}_{t,i}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in C\\end{aligned}\n", "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\#C\\times C;\\left\\{0, 1\\right\\}\\right]&\\quad &\\text{a dictionary of }\\text{binary}\\text{ variables with key }\\#C\\times C\\\\&&&\\text{$x_{t,i} = 1$ if City $i$ is visited at time $t$}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}d&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{C}\\times \\mathrm{C};\\mathbb{R}\\right]&\\quad &\\text{A total dictionary of placeholders with keys }\\left(\\mathrm{C},\\mathrm{C}\\right)\\text{, values in }\\mathbb{R}\\\\&&&\\text{distance between cities}\\\\\\end{alignedat}\\\\&\\\\&\\text{Category Labels:}\\\\&\\qquad \\begin{array}{rl}\n", "C&\\text{Labels of Cities}\\end{array}\n", "\\end{array}\n", @@ -459,10 +471,10 @@ "id": "8070e0c3", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:53.615191Z", - "iopub.status.busy": "2026-02-26T05:58:53.615128Z", - "iopub.status.idle": "2026-02-26T05:58:53.837782Z", - "shell.execute_reply": "2026-02-26T05:58:53.837397Z" + "iopub.execute_input": "2026-03-24T02:05:19.344979Z", + "iopub.status.busy": "2026-03-24T02:05:19.344921Z", + "iopub.status.idle": "2026-03-24T02:05:19.584042Z", + "shell.execute_reply": "2026-03-24T02:05:19.583600Z" } }, "outputs": [ @@ -476,7 +488,7 @@ "$$" ], "text/plain": [ - "Problem(name=\"TSP, Decorated\", sense=MINIMIZE, objective=sum(N.flat_map(lambda (t: natural): N.map(lambda (i: natural): (t, i))).flat_map(lambda ((t, i): Tuple[natural, natural]): N.map(lambda (j: natural): (t, i, j))).map(lambda ((t, i, j): Tuple[natural, natural, natural]): d[i, j] * x[t, i] * x[(t + 1) % N, j])), constraints={one city: [Constraint(name=\"one city\", sense=EQUAL, left=x.sum(1), right=1, shape=TensorLikeVsScalar { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/4051608972.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/4051608972.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Binary }, src_span: NoSrcSpan } }), scalar: Binary }),],one time: [Constraint(name=\"one time\", sense=EQUAL, left=x.sum(0), right=1, shape=TensorLikeVsScalar { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/4051608972.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/4051608972.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Binary }, src_span: NoSrcSpan } }), scalar: Binary }),],})" + "Problem(name=\"TSP, Decorated\", sense=MINIMIZE, objective=sum(N.flat_map(lambda (t: natural): N.map(lambda (i: natural): (t, i))).flat_map(lambda ((t, i): Tuple[natural, natural]): N.map(lambda (j: natural): (t, i, j))).map(lambda ((t, i, j): Tuple[natural, natural, natural]): d[i, j] * x[t, i] * x[(t + 1) % N, j])), constraints={one city: [Constraint(name=\"one city\", sense=EQUAL, left=x.sum(1), right=1, shape=TensorLikeVsScalar { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/4051608972.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/4051608972.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Binary }, src_span: NoSrcSpan } }), scalar: Binary }),],one time: [Constraint(name=\"one time\", sense=EQUAL, left=x.sum(0), right=1, shape=TensorLikeVsScalar { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/4051608972.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/4051608972.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Binary }, src_span: NoSrcSpan } }), scalar: Binary }),],})" ] }, "execution_count": 8, @@ -522,10 +534,10 @@ "id": "bd709223", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:53.838811Z", - "iopub.status.busy": "2026-02-26T05:58:53.838753Z", - "iopub.status.idle": "2026-02-26T05:58:53.852777Z", - "shell.execute_reply": "2026-02-26T05:58:53.852456Z" + "iopub.execute_input": "2026-03-24T02:05:19.585023Z", + "iopub.status.busy": "2026-03-24T02:05:19.584971Z", + "iopub.status.idle": "2026-03-24T02:05:19.599318Z", + "shell.execute_reply": "2026-03-24T02:05:19.598886Z" } }, "outputs": [ @@ -574,10 +586,10 @@ "id": "e62303cb", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:53.854267Z", - "iopub.status.busy": "2026-02-26T05:58:53.854207Z", - "iopub.status.idle": "2026-02-26T05:58:54.111112Z", - "shell.execute_reply": "2026-02-26T05:58:54.110791Z" + "iopub.execute_input": "2026-03-24T02:05:19.600528Z", + "iopub.status.busy": "2026-03-24T02:05:19.600471Z", + "iopub.status.idle": "2026-03-24T02:05:19.833831Z", + "shell.execute_reply": "2026-03-24T02:05:19.833421Z" } }, "outputs": [ @@ -627,10 +639,10 @@ "id": "b442d9b0", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:54.112136Z", - "iopub.status.busy": "2026-02-26T05:58:54.112076Z", - "iopub.status.idle": "2026-02-26T05:58:54.626210Z", - "shell.execute_reply": "2026-02-26T05:58:54.625791Z" + "iopub.execute_input": "2026-03-24T02:05:19.834787Z", + "iopub.status.busy": "2026-03-24T02:05:19.834731Z", + "iopub.status.idle": "2026-03-24T02:05:21.196547Z", + "shell.execute_reply": "2026-03-24T02:05:21.196113Z" } }, "outputs": [ @@ -770,10 +782,10 @@ "id": "9a608594", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:54.627458Z", - "iopub.status.busy": "2026-02-26T05:58:54.627362Z", - "iopub.status.idle": "2026-02-26T05:58:54.647697Z", - "shell.execute_reply": "2026-02-26T05:58:54.647293Z" + "iopub.execute_input": "2026-03-24T02:05:21.197683Z", + "iopub.status.busy": "2026-03-24T02:05:21.197558Z", + "iopub.status.idle": "2026-03-24T02:05:21.220036Z", + "shell.execute_reply": "2026-03-24T02:05:21.219654Z" } }, "outputs": [ @@ -783,9 +795,9 @@ "text": [ "Traceback (most recent last):\n", " while evaluating problem `Problem(name=\"Possibly Overlapping Constraints\", sense=MINIMIZE, objective=0, constraints={constr: [Constraint(name=\"constr\", , lambda i: x[i] >= 1, domain=set(N)),Constraint(name=\"constr\", , lambda i: x[i] <= 2, domain=set(M)),],})',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/316836703.py\", line 1, col 2-55\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/316836703.py\", line 1, col 2-55\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/316836703.py\", line 1, col 2-55:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/316836703.py\", line 1, col 2-55:\n", "\n", " 1 | @jm.Problem.define(\"Possibly Overlapping Constraints\")\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", @@ -817,10 +829,10 @@ "id": "92176ef9", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:54.648602Z", - "iopub.status.busy": "2026-02-26T05:58:54.648554Z", - "iopub.status.idle": "2026-02-26T05:58:54.687791Z", - "shell.execute_reply": "2026-02-26T05:58:54.687501Z" + "iopub.execute_input": "2026-03-24T02:05:21.221047Z", + "iopub.status.busy": "2026-03-24T02:05:21.220992Z", + "iopub.status.idle": "2026-03-24T02:05:21.263953Z", + "shell.execute_reply": "2026-03-24T02:05:21.263607Z" } }, "outputs": [ @@ -830,18 +842,18 @@ "text": [ "Traceback (most recent last):\n", " while adding constraint 'constr',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/2812696639.py\", line 7, col 9-56\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/2812696639.py\", line 7, col 9-56\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/2812696639.py\", line 7, col 9-56:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/2812696639.py\", line 7, col 9-56:\n", "\n", " 7 | problem += problem.Constraint(\"constr\", x <= 2)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", "\n", "Constraint 'constr' has conflicting definition!\n", " existing: Constraint(name=\"constr\", sense=GREATER_THAN_EQUAL, left=x, right=1, shape=Scalar(Integer))\n", - " defined at: File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/2812696639.py\", line 6, col 20-56\n", + " defined at: File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/2812696639.py\", line 6, col 20-56\n", " new: Constraint(name=\"constr\", sense=LESS_THAN_EQUAL, left=x, right=2, shape=Scalar(Integer))\n", - " defined at: File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_21258/2812696639.py\", line 7, col 20-56\n" + " defined at: File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47870/2812696639.py\", line 7, col 20-56\n" ] } ], diff --git a/docs/en/basics/problem.ipynb b/docs/en/basics/problem.ipynb index 7573b343..632c008e 100644 --- a/docs/en/basics/problem.ipynb +++ b/docs/en/basics/problem.ipynb @@ -22,10 +22,10 @@ "id": "7b8759ae", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.006789Z", - "iopub.status.busy": "2026-02-26T05:58:56.006691Z", - "iopub.status.idle": "2026-02-26T05:58:56.014616Z", - "shell.execute_reply": "2026-02-26T05:58:56.013983Z" + "iopub.execute_input": "2026-03-24T02:05:27.724684Z", + "iopub.status.busy": "2026-03-24T02:05:27.724622Z", + "iopub.status.idle": "2026-03-24T02:05:27.729576Z", + "shell.execute_reply": "2026-03-24T02:05:27.729251Z" } }, "outputs": [], @@ -50,10 +50,10 @@ "id": "ee62b49c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.016027Z", - "iopub.status.busy": "2026-02-26T05:58:56.015947Z", - "iopub.status.idle": "2026-02-26T05:58:56.049400Z", - "shell.execute_reply": "2026-02-26T05:58:56.049074Z" + "iopub.execute_input": "2026-03-24T02:05:27.730719Z", + "iopub.status.busy": "2026-03-24T02:05:27.730660Z", + "iopub.status.idle": "2026-03-24T02:05:27.759990Z", + "shell.execute_reply": "2026-03-24T02:05:27.759672Z" } }, "outputs": [], @@ -82,10 +82,10 @@ "id": "7e0217ec", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.050631Z", - "iopub.status.busy": "2026-02-26T05:58:56.050573Z", - "iopub.status.idle": "2026-02-26T05:58:56.067944Z", - "shell.execute_reply": "2026-02-26T05:58:56.067670Z" + "iopub.execute_input": "2026-03-24T02:05:27.761139Z", + "iopub.status.busy": "2026-03-24T02:05:27.761071Z", + "iopub.status.idle": "2026-03-24T02:05:27.779979Z", + "shell.execute_reply": "2026-03-24T02:05:27.779590Z" } }, "outputs": [ @@ -127,10 +127,10 @@ "id": "be7ff8c0", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.069053Z", - "iopub.status.busy": "2026-02-26T05:58:56.068998Z", - "iopub.status.idle": "2026-02-26T05:58:56.087717Z", - "shell.execute_reply": "2026-02-26T05:58:56.087431Z" + "iopub.execute_input": "2026-03-24T02:05:27.781157Z", + "iopub.status.busy": "2026-03-24T02:05:27.781094Z", + "iopub.status.idle": "2026-03-24T02:05:27.801351Z", + "shell.execute_reply": "2026-03-24T02:05:27.800946Z" } }, "outputs": [ @@ -195,10 +195,10 @@ "id": "abd131df", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.088769Z", - "iopub.status.busy": "2026-02-26T05:58:56.088711Z", - "iopub.status.idle": "2026-02-26T05:58:56.090514Z", - "shell.execute_reply": "2026-02-26T05:58:56.090260Z" + "iopub.execute_input": "2026-03-24T02:05:27.802391Z", + "iopub.status.busy": "2026-03-24T02:05:27.802334Z", + "iopub.status.idle": "2026-03-24T02:05:27.805407Z", + "shell.execute_reply": "2026-03-24T02:05:27.804630Z" } }, "outputs": [ @@ -236,10 +236,10 @@ "id": "eecf1bff", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.091328Z", - "iopub.status.busy": "2026-02-26T05:58:56.091280Z", - "iopub.status.idle": "2026-02-26T05:58:56.116706Z", - "shell.execute_reply": "2026-02-26T05:58:56.116417Z" + "iopub.execute_input": "2026-03-24T02:05:27.807325Z", + "iopub.status.busy": "2026-03-24T02:05:27.807233Z", + "iopub.status.idle": "2026-03-24T02:05:27.839924Z", + "shell.execute_reply": "2026-03-24T02:05:27.839463Z" } }, "outputs": [ @@ -280,10 +280,10 @@ "id": "d3d912cf", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.117759Z", - "iopub.status.busy": "2026-02-26T05:58:56.117700Z", - "iopub.status.idle": "2026-02-26T05:58:56.142471Z", - "shell.execute_reply": "2026-02-26T05:58:56.142149Z" + "iopub.execute_input": "2026-03-24T02:05:27.841184Z", + "iopub.status.busy": "2026-03-24T02:05:27.841105Z", + "iopub.status.idle": "2026-03-24T02:05:27.868184Z", + "shell.execute_reply": "2026-03-24T02:05:27.867818Z" } }, "outputs": [ diff --git a/docs/en/basics/variables.ipynb b/docs/en/basics/variables.ipynb index 80a1fdc1..07b4ec0c 100644 --- a/docs/en/basics/variables.ipynb +++ b/docs/en/basics/variables.ipynb @@ -17,10 +17,10 @@ "id": "6c5a391b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.839216Z", - "iopub.status.busy": "2026-02-26T05:58:56.839156Z", - "iopub.status.idle": "2026-02-26T05:58:56.844350Z", - "shell.execute_reply": "2026-02-26T05:58:56.843970Z" + "iopub.execute_input": "2026-03-24T02:05:25.607254Z", + "iopub.status.busy": "2026-03-24T02:05:25.607024Z", + "iopub.status.idle": "2026-03-24T02:05:25.615487Z", + "shell.execute_reply": "2026-03-24T02:05:25.615076Z" } }, "outputs": [], @@ -89,10 +89,10 @@ "id": "051961dc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.845291Z", - "iopub.status.busy": "2026-02-26T05:58:56.845239Z", - "iopub.status.idle": "2026-02-26T05:58:56.946112Z", - "shell.execute_reply": "2026-02-26T05:58:56.945463Z" + "iopub.execute_input": "2026-03-24T02:05:25.616914Z", + "iopub.status.busy": "2026-03-24T02:05:25.616846Z", + "iopub.status.idle": "2026-03-24T02:05:25.785233Z", + "shell.execute_reply": "2026-03-24T02:05:25.784837Z" } }, "outputs": [ @@ -151,10 +151,10 @@ "id": "4e178bbc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:56.948478Z", - "iopub.status.busy": "2026-02-26T05:58:56.948292Z", - "iopub.status.idle": "2026-02-26T05:58:57.037415Z", - "shell.execute_reply": "2026-02-26T05:58:57.036773Z" + "iopub.execute_input": "2026-03-24T02:05:25.787215Z", + "iopub.status.busy": "2026-03-24T02:05:25.786986Z", + "iopub.status.idle": "2026-03-24T02:05:25.848383Z", + "shell.execute_reply": "2026-03-24T02:05:25.848089Z" } }, "outputs": [ @@ -244,10 +244,10 @@ "id": "ce6cc419", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.038562Z", - "iopub.status.busy": "2026-02-26T05:58:57.038488Z", - "iopub.status.idle": "2026-02-26T05:58:57.090940Z", - "shell.execute_reply": "2026-02-26T05:58:57.090596Z" + "iopub.execute_input": "2026-03-24T02:05:25.849591Z", + "iopub.status.busy": "2026-03-24T02:05:25.849528Z", + "iopub.status.idle": "2026-03-24T02:05:25.906292Z", + "shell.execute_reply": "2026-03-24T02:05:25.905970Z" } }, "outputs": [ @@ -289,10 +289,10 @@ "id": "1f668218", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.091995Z", - "iopub.status.busy": "2026-02-26T05:58:57.091936Z", - "iopub.status.idle": "2026-02-26T05:58:57.145765Z", - "shell.execute_reply": "2026-02-26T05:58:57.145448Z" + "iopub.execute_input": "2026-03-24T02:05:25.907428Z", + "iopub.status.busy": "2026-03-24T02:05:25.907369Z", + "iopub.status.idle": "2026-03-24T02:05:25.967471Z", + "shell.execute_reply": "2026-03-24T02:05:25.967098Z" } }, "outputs": [ @@ -352,10 +352,10 @@ "id": "b84e1374", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.146948Z", - "iopub.status.busy": "2026-02-26T05:58:57.146891Z", - "iopub.status.idle": "2026-02-26T05:58:57.148685Z", - "shell.execute_reply": "2026-02-26T05:58:57.148430Z" + "iopub.execute_input": "2026-03-24T02:05:25.968484Z", + "iopub.status.busy": "2026-03-24T02:05:25.968428Z", + "iopub.status.idle": "2026-03-24T02:05:25.970239Z", + "shell.execute_reply": "2026-03-24T02:05:25.969918Z" } }, "outputs": [ @@ -380,10 +380,10 @@ "id": "d3a9f52b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.149548Z", - "iopub.status.busy": "2026-02-26T05:58:57.149496Z", - "iopub.status.idle": "2026-02-26T05:58:57.151359Z", - "shell.execute_reply": "2026-02-26T05:58:57.150851Z" + "iopub.execute_input": "2026-03-24T02:05:25.971094Z", + "iopub.status.busy": "2026-03-24T02:05:25.971042Z", + "iopub.status.idle": "2026-03-24T02:05:25.972795Z", + "shell.execute_reply": "2026-03-24T02:05:25.972456Z" } }, "outputs": [ @@ -501,10 +501,10 @@ "id": "5f2e4dc8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.152338Z", - "iopub.status.busy": "2026-02-26T05:58:57.152280Z", - "iopub.status.idle": "2026-02-26T05:58:57.184521Z", - "shell.execute_reply": "2026-02-26T05:58:57.184229Z" + "iopub.execute_input": "2026-03-24T02:05:25.973659Z", + "iopub.status.busy": "2026-03-24T02:05:25.973600Z", + "iopub.status.idle": "2026-03-24T02:05:26.008568Z", + "shell.execute_reply": "2026-03-24T02:05:26.008130Z" } }, "outputs": [ @@ -558,10 +558,10 @@ "id": "4ce83fe1", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.185632Z", - "iopub.status.busy": "2026-02-26T05:58:57.185579Z", - "iopub.status.idle": "2026-02-26T05:58:57.225706Z", - "shell.execute_reply": "2026-02-26T05:58:57.225348Z" + "iopub.execute_input": "2026-03-24T02:05:26.009810Z", + "iopub.status.busy": "2026-03-24T02:05:26.009753Z", + "iopub.status.idle": "2026-03-24T02:05:26.053482Z", + "shell.execute_reply": "2026-03-24T02:05:26.053160Z" } }, "outputs": [ @@ -659,10 +659,10 @@ "id": "7333a2d6", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.226708Z", - "iopub.status.busy": "2026-02-26T05:58:57.226659Z", - "iopub.status.idle": "2026-02-26T05:58:57.271483Z", - "shell.execute_reply": "2026-02-26T05:58:57.271139Z" + "iopub.execute_input": "2026-03-24T02:05:26.054444Z", + "iopub.status.busy": "2026-03-24T02:05:26.054385Z", + "iopub.status.idle": "2026-03-24T02:05:26.103076Z", + "shell.execute_reply": "2026-03-24T02:05:26.102778Z" } }, "outputs": [ @@ -718,10 +718,10 @@ "id": "34184cce", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.272443Z", - "iopub.status.busy": "2026-02-26T05:58:57.272392Z", - "iopub.status.idle": "2026-02-26T05:58:57.315106Z", - "shell.execute_reply": "2026-02-26T05:58:57.314755Z" + "iopub.execute_input": "2026-03-24T02:05:26.104252Z", + "iopub.status.busy": "2026-03-24T02:05:26.104195Z", + "iopub.status.idle": "2026-03-24T02:05:26.150591Z", + "shell.execute_reply": "2026-03-24T02:05:26.150302Z" } }, "outputs": [ @@ -778,10 +778,10 @@ "id": "ffa2feec", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.316100Z", - "iopub.status.busy": "2026-02-26T05:58:57.316047Z", - "iopub.status.idle": "2026-02-26T05:58:57.357913Z", - "shell.execute_reply": "2026-02-26T05:58:57.357556Z" + "iopub.execute_input": "2026-03-24T02:05:26.151709Z", + "iopub.status.busy": "2026-03-24T02:05:26.151656Z", + "iopub.status.idle": "2026-03-24T02:05:26.196996Z", + "shell.execute_reply": "2026-03-24T02:05:26.196637Z" } }, "outputs": [ @@ -918,10 +918,10 @@ "id": "f86e9eac", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.358986Z", - "iopub.status.busy": "2026-02-26T05:58:57.358926Z", - "iopub.status.idle": "2026-02-26T05:58:57.376958Z", - "shell.execute_reply": "2026-02-26T05:58:57.376698Z" + "iopub.execute_input": "2026-03-24T02:05:26.198156Z", + "iopub.status.busy": "2026-03-24T02:05:26.198092Z", + "iopub.status.idle": "2026-03-24T02:05:26.217859Z", + "shell.execute_reply": "2026-03-24T02:05:26.217468Z" } }, "outputs": [ @@ -965,10 +965,10 @@ "id": "470c7514", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.378100Z", - "iopub.status.busy": "2026-02-26T05:58:57.378047Z", - "iopub.status.idle": "2026-02-26T05:58:57.396364Z", - "shell.execute_reply": "2026-02-26T05:58:57.396011Z" + "iopub.execute_input": "2026-03-24T02:05:26.219447Z", + "iopub.status.busy": "2026-03-24T02:05:26.219293Z", + "iopub.status.idle": "2026-03-24T02:05:26.241095Z", + "shell.execute_reply": "2026-03-24T02:05:26.240712Z" } }, "outputs": [ @@ -1033,10 +1033,10 @@ "id": "955b0199", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.397347Z", - "iopub.status.busy": "2026-02-26T05:58:57.397297Z", - "iopub.status.idle": "2026-02-26T05:58:57.438050Z", - "shell.execute_reply": "2026-02-26T05:58:57.437778Z" + "iopub.execute_input": "2026-03-24T02:05:26.242175Z", + "iopub.status.busy": "2026-03-24T02:05:26.242114Z", + "iopub.status.idle": "2026-03-24T02:05:26.298565Z", + "shell.execute_reply": "2026-03-24T02:05:26.298193Z" } }, "outputs": [ @@ -1121,10 +1121,10 @@ "id": "b3e88831", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.439149Z", - "iopub.status.busy": "2026-02-26T05:58:57.439100Z", - "iopub.status.idle": "2026-02-26T05:58:57.495158Z", - "shell.execute_reply": "2026-02-26T05:58:57.494835Z" + "iopub.execute_input": "2026-03-24T02:05:26.299780Z", + "iopub.status.busy": "2026-03-24T02:05:26.299719Z", + "iopub.status.idle": "2026-03-24T02:05:26.365280Z", + "shell.execute_reply": "2026-03-24T02:05:26.364805Z" } }, "outputs": [ @@ -1178,10 +1178,10 @@ "id": "4a1d9f04", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:57.496175Z", - "iopub.status.busy": "2026-02-26T05:58:57.496101Z", - "iopub.status.idle": "2026-02-26T05:58:57.535816Z", - "shell.execute_reply": "2026-02-26T05:58:57.535513Z" + "iopub.execute_input": "2026-03-24T02:05:26.366287Z", + "iopub.status.busy": "2026-03-24T02:05:26.366198Z", + "iopub.status.idle": "2026-03-24T02:05:26.408065Z", + "shell.execute_reply": "2026-03-24T02:05:26.407681Z" } }, "outputs": [ diff --git a/docs/en/introduction.ipynb b/docs/en/introduction.ipynb index 06574be0..1964e924 100644 --- a/docs/en/introduction.ipynb +++ b/docs/en/introduction.ipynb @@ -73,10 +73,10 @@ "id": "bf93e55f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:58.228952Z", - "iopub.status.busy": "2026-02-26T05:58:58.228889Z", - "iopub.status.idle": "2026-02-26T05:58:58.493467Z", - "shell.execute_reply": "2026-02-26T05:58:58.493135Z" + "iopub.execute_input": "2026-03-24T02:05:12.168227Z", + "iopub.status.busy": "2026-03-24T02:05:12.168162Z", + "iopub.status.idle": "2026-03-24T02:05:12.357614Z", + "shell.execute_reply": "2026-03-24T02:05:12.357091Z" } }, "outputs": [ @@ -146,10 +146,10 @@ "id": "3e35cee2", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:58.494626Z", - "iopub.status.busy": "2026-02-26T05:58:58.494559Z", - "iopub.status.idle": "2026-02-26T05:58:58.523828Z", - "shell.execute_reply": "2026-02-26T05:58:58.523475Z" + "iopub.execute_input": "2026-03-24T02:05:12.359106Z", + "iopub.status.busy": "2026-03-24T02:05:12.359026Z", + "iopub.status.idle": "2026-03-24T02:05:12.396417Z", + "shell.execute_reply": "2026-03-24T02:05:12.395851Z" } }, "outputs": [], @@ -174,10 +174,10 @@ "id": "d7c62729", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:58.524888Z", - "iopub.status.busy": "2026-02-26T05:58:58.524833Z", - "iopub.status.idle": "2026-02-26T05:58:58.562528Z", - "shell.execute_reply": "2026-02-26T05:58:58.562226Z" + "iopub.execute_input": "2026-03-24T02:05:12.397937Z", + "iopub.status.busy": "2026-03-24T02:05:12.397860Z", + "iopub.status.idle": "2026-03-24T02:05:12.441146Z", + "shell.execute_reply": "2026-03-24T02:05:12.440785Z" } }, "outputs": [], @@ -219,17 +219,17 @@ "id": "05305f86", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:58.563716Z", - "iopub.status.busy": "2026-02-26T05:58:58.563662Z", - "iopub.status.idle": "2026-02-26T05:58:58.565393Z", - "shell.execute_reply": "2026-02-26T05:58:58.565148Z" + "iopub.execute_input": "2026-03-24T02:05:12.442451Z", + "iopub.status.busy": "2026-03-24T02:05:12.442393Z", + "iopub.status.idle": "2026-03-24T02:05:12.444506Z", + "shell.execute_reply": "2026-03-24T02:05:12.444040Z" } }, "outputs": [ { "data": { "text/plain": [ - "'2.2.0'" + "'2.3.1'" ] }, "execution_count": 4, diff --git a/docs/en/quickstart/openjij.ipynb b/docs/en/quickstart/openjij.ipynb index 080ed376..da31c033 100644 --- a/docs/en/quickstart/openjij.ipynb +++ b/docs/en/quickstart/openjij.ipynb @@ -94,10 +94,10 @@ "id": "a9c293f9", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:59.273238Z", - "iopub.status.busy": "2026-02-26T05:58:59.273183Z", - "iopub.status.idle": "2026-02-26T05:58:59.497336Z", - "shell.execute_reply": "2026-02-26T05:58:59.495145Z" + "iopub.execute_input": "2026-03-24T02:05:54.140257Z", + "iopub.status.busy": "2026-03-24T02:05:54.140176Z", + "iopub.status.idle": "2026-03-24T02:05:54.344261Z", + "shell.execute_reply": "2026-03-24T02:05:54.343870Z" } }, "outputs": [ @@ -169,10 +169,10 @@ "id": "4e5f7ef5", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:59.500049Z", - "iopub.status.busy": "2026-02-26T05:58:59.499878Z", - "iopub.status.idle": "2026-02-26T05:58:59.540070Z", - "shell.execute_reply": "2026-02-26T05:58:59.539297Z" + "iopub.execute_input": "2026-03-24T02:05:54.345358Z", + "iopub.status.busy": "2026-03-24T02:05:54.345291Z", + "iopub.status.idle": "2026-03-24T02:05:54.347068Z", + "shell.execute_reply": "2026-03-24T02:05:54.346754Z" } }, "outputs": [], @@ -201,10 +201,10 @@ "id": "ec59b351", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:58:59.542022Z", - "iopub.status.busy": "2026-02-26T05:58:59.541922Z", - "iopub.status.idle": "2026-02-26T05:59:00.192059Z", - "shell.execute_reply": "2026-02-26T05:59:00.191683Z" + "iopub.execute_input": "2026-03-24T02:05:54.348084Z", + "iopub.status.busy": "2026-03-24T02:05:54.348028Z", + "iopub.status.idle": "2026-03-24T02:05:55.318686Z", + "shell.execute_reply": "2026-03-24T02:05:55.318251Z" } }, "outputs": [], @@ -238,10 +238,10 @@ "id": "89191aba", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:00.193522Z", - "iopub.status.busy": "2026-02-26T05:59:00.193443Z", - "iopub.status.idle": "2026-02-26T05:59:01.306730Z", - "shell.execute_reply": "2026-02-26T05:59:01.306060Z" + "iopub.execute_input": "2026-03-24T02:05:55.319966Z", + "iopub.status.busy": "2026-03-24T02:05:55.319862Z", + "iopub.status.idle": "2026-03-24T02:05:55.608844Z", + "shell.execute_reply": "2026-03-24T02:05:55.608370Z" } }, "outputs": [], @@ -272,10 +272,10 @@ "id": "7dbff4db", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:01.308190Z", - "iopub.status.busy": "2026-02-26T05:59:01.308069Z", - "iopub.status.idle": "2026-02-26T05:59:01.314724Z", - "shell.execute_reply": "2026-02-26T05:59:01.314329Z" + "iopub.execute_input": "2026-03-24T02:05:55.609979Z", + "iopub.status.busy": "2026-03-24T02:05:55.609862Z", + "iopub.status.idle": "2026-03-24T02:05:55.618691Z", + "shell.execute_reply": "2026-03-24T02:05:55.617915Z" } }, "outputs": [ @@ -322,19 +322,19 @@ " 1\n", " x\n", " [1]\n", - " 0.0\n", + " 1.0\n", " \n", " \n", " 2\n", " x\n", " [2]\n", - " 0.0\n", + " 1.0\n", " \n", " \n", " 3\n", " x\n", " [3]\n", - " 1.0\n", + " 0.0\n", " \n", " \n", " 4\n", @@ -356,9 +356,9 @@ " name subscripts value\n", "id \n", "0 x [0] 1.0\n", - "1 x [1] 0.0\n", - "2 x [2] 0.0\n", - "3 x [3] 1.0\n", + "1 x [1] 1.0\n", + "2 x [2] 1.0\n", + "3 x [3] 0.0\n", "4 x [4] 0.0\n", "5 x [5] 0.0" ] diff --git a/docs/en/quickstart/scip.ipynb b/docs/en/quickstart/scip.ipynb index 9e065641..46b9e789 100644 --- a/docs/en/quickstart/scip.ipynb +++ b/docs/en/quickstart/scip.ipynb @@ -94,10 +94,10 @@ "id": "0e58428f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:02.155693Z", - "iopub.status.busy": "2026-02-26T05:59:02.155456Z", - "iopub.status.idle": "2026-02-26T05:59:02.356003Z", - "shell.execute_reply": "2026-02-26T05:59:02.355554Z" + "iopub.execute_input": "2026-03-24T02:05:57.033597Z", + "iopub.status.busy": "2026-03-24T02:05:57.033524Z", + "iopub.status.idle": "2026-03-24T02:05:57.220613Z", + "shell.execute_reply": "2026-03-24T02:05:57.220137Z" } }, "outputs": [ @@ -169,10 +169,10 @@ "id": "9065e4c7", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:02.357108Z", - "iopub.status.busy": "2026-02-26T05:59:02.357042Z", - "iopub.status.idle": "2026-02-26T05:59:02.358823Z", - "shell.execute_reply": "2026-02-26T05:59:02.358523Z" + "iopub.execute_input": "2026-03-24T02:05:57.221770Z", + "iopub.status.busy": "2026-03-24T02:05:57.221702Z", + "iopub.status.idle": "2026-03-24T02:05:57.223631Z", + "shell.execute_reply": "2026-03-24T02:05:57.223262Z" } }, "outputs": [], @@ -201,10 +201,10 @@ "id": "c7014264", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:02.359695Z", - "iopub.status.busy": "2026-02-26T05:59:02.359645Z", - "iopub.status.idle": "2026-02-26T05:59:02.911563Z", - "shell.execute_reply": "2026-02-26T05:59:02.911176Z" + "iopub.execute_input": "2026-03-24T02:05:57.224565Z", + "iopub.status.busy": "2026-03-24T02:05:57.224511Z", + "iopub.status.idle": "2026-03-24T02:05:57.823423Z", + "shell.execute_reply": "2026-03-24T02:05:57.823067Z" } }, "outputs": [], @@ -238,10 +238,10 @@ "id": "deeb53b7", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:02.912832Z", - "iopub.status.busy": "2026-02-26T05:59:02.912747Z", - "iopub.status.idle": "2026-02-26T05:59:02.978893Z", - "shell.execute_reply": "2026-02-26T05:59:02.978509Z" + "iopub.execute_input": "2026-03-24T02:05:57.824990Z", + "iopub.status.busy": "2026-03-24T02:05:57.824880Z", + "iopub.status.idle": "2026-03-24T02:05:57.897273Z", + "shell.execute_reply": "2026-03-24T02:05:57.896862Z" } }, "outputs": [ @@ -276,10 +276,10 @@ "id": "bc247e30", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:02.979806Z", - "iopub.status.busy": "2026-02-26T05:59:02.979717Z", - "iopub.status.idle": "2026-02-26T05:59:02.984553Z", - "shell.execute_reply": "2026-02-26T05:59:02.984246Z" + "iopub.execute_input": "2026-03-24T02:05:57.898343Z", + "iopub.status.busy": "2026-03-24T02:05:57.898246Z", + "iopub.status.idle": "2026-03-24T02:05:57.903584Z", + "shell.execute_reply": "2026-03-24T02:05:57.903279Z" } }, "outputs": [ diff --git a/docs/en/references/cheat_sheet.ipynb b/docs/en/references/cheat_sheet.ipynb index bb1ef68e..888467c0 100644 --- a/docs/en/references/cheat_sheet.ipynb +++ b/docs/en/references/cheat_sheet.ipynb @@ -14,10 +14,10 @@ "id": "58e0d17d", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:03.644822Z", - "iopub.status.busy": "2026-02-26T05:59:03.644769Z", - "iopub.status.idle": "2026-02-26T05:59:03.660611Z", - "shell.execute_reply": "2026-02-26T05:59:03.658585Z" + "iopub.execute_input": "2026-03-24T02:05:49.138769Z", + "iopub.status.busy": "2026-03-24T02:05:49.138673Z", + "iopub.status.idle": "2026-03-24T02:05:49.144634Z", + "shell.execute_reply": "2026-03-24T02:05:49.144172Z" } }, "outputs": [], @@ -49,10 +49,10 @@ "id": "1fa8bcb8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:03.663571Z", - "iopub.status.busy": "2026-02-26T05:59:03.663380Z", - "iopub.status.idle": "2026-02-26T05:59:03.782633Z", - "shell.execute_reply": "2026-02-26T05:59:03.779461Z" + "iopub.execute_input": "2026-03-24T02:05:49.145935Z", + "iopub.status.busy": "2026-03-24T02:05:49.145870Z", + "iopub.status.idle": "2026-03-24T02:05:49.208435Z", + "shell.execute_reply": "2026-03-24T02:05:49.208052Z" } }, "outputs": [ @@ -95,10 +95,10 @@ "id": "01dbd1aa", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:03.791300Z", - "iopub.status.busy": "2026-02-26T05:59:03.791094Z", - "iopub.status.idle": "2026-02-26T05:59:03.842178Z", - "shell.execute_reply": "2026-02-26T05:59:03.841200Z" + "iopub.execute_input": "2026-03-24T02:05:49.209566Z", + "iopub.status.busy": "2026-03-24T02:05:49.209508Z", + "iopub.status.idle": "2026-03-24T02:05:49.247617Z", + "shell.execute_reply": "2026-03-24T02:05:49.247212Z" } }, "outputs": [ @@ -150,10 +150,10 @@ "id": "e544f20f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:03.844860Z", - "iopub.status.busy": "2026-02-26T05:59:03.844451Z", - "iopub.status.idle": "2026-02-26T05:59:03.910791Z", - "shell.execute_reply": "2026-02-26T05:59:03.910279Z" + "iopub.execute_input": "2026-03-24T02:05:49.248803Z", + "iopub.status.busy": "2026-03-24T02:05:49.248745Z", + "iopub.status.idle": "2026-03-24T02:05:49.300815Z", + "shell.execute_reply": "2026-03-24T02:05:49.300523Z" } }, "outputs": [ @@ -161,7 +161,7 @@ "data": { "text/latex": [ "$$\\begin{array}{rl}\n", - "\\text{Problem}\\colon &\\text{WeightedSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(a\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\text{Problem}\\colon &\\text{WeightedSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(a\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -176,7 +176,7 @@ "source": [ "problem = jm.Problem(\"WeightedSum\")\n", "a = problem.Float(\"a\", ndim=1)\n", - "N = problem.DependentVar(\"N\", a.len_at(0))\n", + "N = problem.NamedExpr(\"N\", a.len_at(0))\n", "x = problem.BinaryVar(\"x\", shape=(N,))\n", "problem += jm.sum(a * x)\n", "\n", @@ -197,10 +197,10 @@ "id": "b987d8a2", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:03.911785Z", - "iopub.status.busy": "2026-02-26T05:59:03.911729Z", - "iopub.status.idle": "2026-02-26T05:59:03.964043Z", - "shell.execute_reply": "2026-02-26T05:59:03.963681Z" + "iopub.execute_input": "2026-03-24T02:05:49.302089Z", + "iopub.status.busy": "2026-03-24T02:05:49.302028Z", + "iopub.status.idle": "2026-03-24T02:05:49.360395Z", + "shell.execute_reply": "2026-03-24T02:05:49.360096Z" } }, "outputs": [ @@ -208,7 +208,7 @@ "data": { "text/latex": [ "$$\\begin{array}{rl}\n", - "\\text{Problem}\\colon &\\text{WeightedSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(a\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\text{Problem}\\colon &\\text{WeightedSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(a\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -224,7 +224,7 @@ "@jm.Problem.define(\"WeightedSum\")\n", "def problem(problem: jm.DecoratedProblem):\n", " a = problem.Float(ndim=1)\n", - " N = problem.DependentVar(a.len_at(0))\n", + " N = problem.NamedExpr(a.len_at(0))\n", " x = problem.BinaryVar(shape=(N,))\n", " problem += (a * x).sum()\n", "\n", @@ -253,10 +253,10 @@ "id": "16f43d5e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:03.965107Z", - "iopub.status.busy": "2026-02-26T05:59:03.965047Z", - "iopub.status.idle": "2026-02-26T05:59:04.029525Z", - "shell.execute_reply": "2026-02-26T05:59:04.029140Z" + "iopub.execute_input": "2026-03-24T02:05:49.361838Z", + "iopub.status.busy": "2026-03-24T02:05:49.361761Z", + "iopub.status.idle": "2026-03-24T02:05:49.435051Z", + "shell.execute_reply": "2026-03-24T02:05:49.434653Z" } }, "outputs": [ @@ -300,10 +300,10 @@ "id": "8e08a289", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.030480Z", - "iopub.status.busy": "2026-02-26T05:59:04.030424Z", - "iopub.status.idle": "2026-02-26T05:59:04.101243Z", - "shell.execute_reply": "2026-02-26T05:59:04.100841Z" + "iopub.execute_input": "2026-03-24T02:05:49.436176Z", + "iopub.status.busy": "2026-03-24T02:05:49.436111Z", + "iopub.status.idle": "2026-03-24T02:05:49.509020Z", + "shell.execute_reply": "2026-03-24T02:05:49.508680Z" } }, "outputs": [ @@ -356,10 +356,10 @@ "id": "cb70d54b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.102457Z", - "iopub.status.busy": "2026-02-26T05:59:04.102388Z", - "iopub.status.idle": "2026-02-26T05:59:04.173856Z", - "shell.execute_reply": "2026-02-26T05:59:04.173575Z" + "iopub.execute_input": "2026-03-24T02:05:49.510225Z", + "iopub.status.busy": "2026-03-24T02:05:49.510162Z", + "iopub.status.idle": "2026-03-24T02:05:49.583409Z", + "shell.execute_reply": "2026-03-24T02:05:49.583111Z" } }, "outputs": [ @@ -403,10 +403,10 @@ "id": "99bccede", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.175019Z", - "iopub.status.busy": "2026-02-26T05:59:04.174965Z", - "iopub.status.idle": "2026-02-26T05:59:04.250298Z", - "shell.execute_reply": "2026-02-26T05:59:04.249987Z" + "iopub.execute_input": "2026-03-24T02:05:49.584536Z", + "iopub.status.busy": "2026-03-24T02:05:49.584478Z", + "iopub.status.idle": "2026-03-24T02:05:49.663348Z", + "shell.execute_reply": "2026-03-24T02:05:49.662945Z" } }, "outputs": [ @@ -459,10 +459,10 @@ "id": "0c7a84b9", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.251491Z", - "iopub.status.busy": "2026-02-26T05:59:04.251428Z", - "iopub.status.idle": "2026-02-26T05:59:04.374046Z", - "shell.execute_reply": "2026-02-26T05:59:04.373670Z" + "iopub.execute_input": "2026-03-24T02:05:49.664450Z", + "iopub.status.busy": "2026-03-24T02:05:49.664393Z", + "iopub.status.idle": "2026-03-24T02:05:49.785497Z", + "shell.execute_reply": "2026-03-24T02:05:49.785171Z" } }, "outputs": [ @@ -509,10 +509,10 @@ "id": "2099890c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.375082Z", - "iopub.status.busy": "2026-02-26T05:59:04.375030Z", - "iopub.status.idle": "2026-02-26T05:59:04.504348Z", - "shell.execute_reply": "2026-02-26T05:59:04.504069Z" + "iopub.execute_input": "2026-03-24T02:05:49.786631Z", + "iopub.status.busy": "2026-03-24T02:05:49.786573Z", + "iopub.status.idle": "2026-03-24T02:05:49.910277Z", + "shell.execute_reply": "2026-03-24T02:05:49.909994Z" } }, "outputs": [ @@ -565,10 +565,10 @@ "id": "b0c6a474", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.505529Z", - "iopub.status.busy": "2026-02-26T05:59:04.505474Z", - "iopub.status.idle": "2026-02-26T05:59:04.600406Z", - "shell.execute_reply": "2026-02-26T05:59:04.600128Z" + "iopub.execute_input": "2026-03-24T02:05:49.911529Z", + "iopub.status.busy": "2026-03-24T02:05:49.911466Z", + "iopub.status.idle": "2026-03-24T02:05:50.007014Z", + "shell.execute_reply": "2026-03-24T02:05:50.006612Z" } }, "outputs": [ @@ -614,10 +614,10 @@ "id": "ffd9b043", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.601646Z", - "iopub.status.busy": "2026-02-26T05:59:04.601583Z", - "iopub.status.idle": "2026-02-26T05:59:04.696105Z", - "shell.execute_reply": "2026-02-26T05:59:04.695743Z" + "iopub.execute_input": "2026-03-24T02:05:50.008161Z", + "iopub.status.busy": "2026-03-24T02:05:50.008096Z", + "iopub.status.idle": "2026-03-24T02:05:50.111449Z", + "shell.execute_reply": "2026-03-24T02:05:50.111109Z" } }, "outputs": [ @@ -669,10 +669,10 @@ "id": "5136e06e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.697325Z", - "iopub.status.busy": "2026-02-26T05:59:04.697270Z", - "iopub.status.idle": "2026-02-26T05:59:04.770320Z", - "shell.execute_reply": "2026-02-26T05:59:04.769934Z" + "iopub.execute_input": "2026-03-24T02:05:50.112733Z", + "iopub.status.busy": "2026-03-24T02:05:50.112670Z", + "iopub.status.idle": "2026-03-24T02:05:50.189751Z", + "shell.execute_reply": "2026-03-24T02:05:50.189365Z" } }, "outputs": [ @@ -680,7 +680,7 @@ "data": { "text/latex": [ "$$\\begin{array}{rl}\n", - "\\text{Problem}\\colon &\\text{DependentSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{i=0}^{M-1}{\\sum _{j=0}^{{a}_{i}-1}{{x}_{j}}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\text{Problem}\\colon &\\text{DependentSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{i=0}^{M-1}{\\sum _{j=0}^{{a}_{i}-1}{{x}_{j}}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -697,7 +697,7 @@ "N = problem.Natural(\"N\")\n", "x = problem.BinaryVar(\"x\", shape=(N,))\n", "a = problem.Natural(\"a\", ndim=1)\n", - "M = problem.DependentVar(\"M\", a.len_at(0))\n", + "M = problem.NamedExpr(\"M\", a.len_at(0))\n", "problem += jm.sum(jm.flat_map(lambda i: a[i].map(lambda j: x[j]), M))\n", "\n", "problem" @@ -717,10 +717,10 @@ "id": "22097eb3", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.771348Z", - "iopub.status.busy": "2026-02-26T05:59:04.771291Z", - "iopub.status.idle": "2026-02-26T05:59:04.869553Z", - "shell.execute_reply": "2026-02-26T05:59:04.869184Z" + "iopub.execute_input": "2026-03-24T02:05:50.190859Z", + "iopub.status.busy": "2026-03-24T02:05:50.190800Z", + "iopub.status.idle": "2026-03-24T02:05:50.294869Z", + "shell.execute_reply": "2026-03-24T02:05:50.294439Z" } }, "outputs": [ @@ -728,7 +728,7 @@ "data": { "text/latex": [ "$$\\begin{array}{rl}\n", - "\\text{Problem}\\colon &\\text{DependentSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{i=0}^{M-1}{\\sum _{j\\in {a}_{i}}{{x}_{j}}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\text{Problem}\\colon &\\text{DependentSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{i=0}^{M-1}{\\sum _{j\\in {a}_{i}}{{x}_{j}}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -746,7 +746,7 @@ " N = problem.Natural()\n", " x = problem.BinaryVar(shape=(N,))\n", " a = problem.Natural(ndim=1)\n", - " M = problem.DependentVar(a.len_at(0))\n", + " M = problem.NamedExpr(a.len_at(0))\n", " problem += jm.sum(x[j] for i in M for j in a[i])\n", "\n", "problem" @@ -776,10 +776,10 @@ "id": "4c24379f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.870592Z", - "iopub.status.busy": "2026-02-26T05:59:04.870535Z", - "iopub.status.idle": "2026-02-26T05:59:04.936053Z", - "shell.execute_reply": "2026-02-26T05:59:04.935613Z" + "iopub.execute_input": "2026-03-24T02:05:50.296177Z", + "iopub.status.busy": "2026-03-24T02:05:50.296114Z", + "iopub.status.idle": "2026-03-24T02:05:50.365231Z", + "shell.execute_reply": "2026-03-24T02:05:50.364897Z" } }, "outputs": [ @@ -824,10 +824,10 @@ "id": "73fff5dc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:04.936947Z", - "iopub.status.busy": "2026-02-26T05:59:04.936888Z", - "iopub.status.idle": "2026-02-26T05:59:05.005130Z", - "shell.execute_reply": "2026-02-26T05:59:05.004785Z" + "iopub.execute_input": "2026-03-24T02:05:50.366462Z", + "iopub.status.busy": "2026-03-24T02:05:50.366397Z", + "iopub.status.idle": "2026-03-24T02:05:50.467014Z", + "shell.execute_reply": "2026-03-24T02:05:50.465641Z" } }, "outputs": [ @@ -881,10 +881,10 @@ "id": "28999f5f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.006165Z", - "iopub.status.busy": "2026-02-26T05:59:05.006109Z", - "iopub.status.idle": "2026-02-26T05:59:05.072540Z", - "shell.execute_reply": "2026-02-26T05:59:05.072223Z" + "iopub.execute_input": "2026-03-24T02:05:50.473756Z", + "iopub.status.busy": "2026-03-24T02:05:50.473630Z", + "iopub.status.idle": "2026-03-24T02:05:50.574785Z", + "shell.execute_reply": "2026-03-24T02:05:50.574354Z" } }, "outputs": [ @@ -930,10 +930,10 @@ "id": "7091b61a", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.073546Z", - "iopub.status.busy": "2026-02-26T05:59:05.073495Z", - "iopub.status.idle": "2026-02-26T05:59:05.142780Z", - "shell.execute_reply": "2026-02-26T05:59:05.142444Z" + "iopub.execute_input": "2026-03-24T02:05:50.576009Z", + "iopub.status.busy": "2026-03-24T02:05:50.575942Z", + "iopub.status.idle": "2026-03-24T02:05:50.655183Z", + "shell.execute_reply": "2026-03-24T02:05:50.654590Z" } }, "outputs": [ @@ -988,10 +988,10 @@ "id": "db92c346", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.143786Z", - "iopub.status.busy": "2026-02-26T05:59:05.143737Z", - "iopub.status.idle": "2026-02-26T05:59:05.227777Z", - "shell.execute_reply": "2026-02-26T05:59:05.227459Z" + "iopub.execute_input": "2026-03-24T02:05:50.656805Z", + "iopub.status.busy": "2026-03-24T02:05:50.656716Z", + "iopub.status.idle": "2026-03-24T02:05:50.753056Z", + "shell.execute_reply": "2026-03-24T02:05:50.752741Z" } }, "outputs": [ @@ -1001,11 +1001,11 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{2D K-Hot}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{2d k-hot}&\\quad \\displaystyle x.\\mathop{\\mathtt{sum}}\\left(\\mathtt{axis}=\\left[1\\right]\\right)=K\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N\\times M;\\left\\{0, 1\\right\\}\\right]&\\quad &2\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}K&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\M&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(K,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N\\times M;\\left\\{0, 1\\right\\}\\right]&\\quad &2\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}K&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\M&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(K,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ - "Problem(name=\"2D K-Hot\", sense=MINIMIZE, objective=0, constraints={2d k-hot: [Constraint(name=\"2d k-hot\", sense=EQUAL, left=x.sum(1), right=K, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: None, subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22129/3312631698.py\", start: SrcLoc { line: 5, column: 4 }, end: SrcLoc { line: 5, column: 40 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22129/3312631698.py\", start: SrcLoc { line: 5, column: 4 }, end: SrcLoc { line: 5, column: 40 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Natural }, src_span: NoSrcSpan } }), scalar: Natural }),],})" + "Problem(name=\"2D K-Hot\", sense=MINIMIZE, objective=0, constraints={2d k-hot: [Constraint(name=\"2d k-hot\", sense=EQUAL, left=x.sum(1), right=K, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: None, subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_49545/1184867636.py\", start: SrcLoc { line: 5, column: 4 }, end: SrcLoc { line: 5, column: 40 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_49545/1184867636.py\", start: SrcLoc { line: 5, column: 4 }, end: SrcLoc { line: 5, column: 40 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Natural }, src_span: NoSrcSpan } }), scalar: Natural }),],})" ] }, "execution_count": 20, @@ -1016,7 +1016,7 @@ "source": [ "problem = jm.Problem(\"2D K-Hot\")\n", "K = problem.Natural(\"K\", ndim=1)\n", - "N = problem.DependentVar(\"N\", K.len_at(0))\n", + "N = problem.NamedExpr(\"N\", K.len_at(0))\n", "M = problem.Natural(\"M\")\n", "x = problem.BinaryVar(\"x\", shape=(N, M))\n", "problem += problem.Constraint(\"2d k-hot\", x.sum(axis=1) == K)\n", @@ -1038,10 +1038,10 @@ "id": "60016a39", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.228752Z", - "iopub.status.busy": "2026-02-26T05:59:05.228704Z", - "iopub.status.idle": "2026-02-26T05:59:05.319122Z", - "shell.execute_reply": "2026-02-26T05:59:05.318816Z" + "iopub.execute_input": "2026-03-24T02:05:50.754176Z", + "iopub.status.busy": "2026-03-24T02:05:50.754110Z", + "iopub.status.idle": "2026-03-24T02:05:50.855294Z", + "shell.execute_reply": "2026-03-24T02:05:50.854844Z" } }, "outputs": [ @@ -1051,11 +1051,11 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{2D K-Hot}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{2d k-hot}&\\quad \\displaystyle x.\\mathop{\\mathtt{sum}}\\left(\\mathtt{axis}=\\left[1\\right]\\right)=K\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N\\times M;\\left\\{0, 1\\right\\}\\right]&\\quad &2\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}K&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\M&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(K,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N\\times M;\\left\\{0, 1\\right\\}\\right]&\\quad &2\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}K&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\M&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(K,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ - "Problem(name=\"2D K-Hot\", sense=MINIMIZE, objective=0, constraints={2d k-hot: [Constraint(name=\"2d k-hot\", sense=EQUAL, left=x.sum(1), right=K, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: None, subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22129/313414419.py\", start: SrcLoc { line: 6, column: 8 }, end: SrcLoc { line: 6, column: 39 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22129/313414419.py\", start: SrcLoc { line: 6, column: 8 }, end: SrcLoc { line: 6, column: 39 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Natural }, src_span: NoSrcSpan } }), scalar: Natural }),],})" + "Problem(name=\"2D K-Hot\", sense=MINIMIZE, objective=0, constraints={2d k-hot: [Constraint(name=\"2d k-hot\", sense=EQUAL, left=x.sum(1), right=K, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: None, subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_49545/1629874504.py\", start: SrcLoc { line: 6, column: 8 }, end: SrcLoc { line: 6, column: 39 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_49545/1629874504.py\", start: SrcLoc { line: 6, column: 8 }, end: SrcLoc { line: 6, column: 39 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Natural }, src_span: NoSrcSpan } }), scalar: Natural }),],})" ] }, "execution_count": 21, @@ -1067,7 +1067,7 @@ "@jm.Problem.define(\"2D K-Hot\")\n", "def problem(problem: jm.DecoratedProblem):\n", " K = problem.Natural(ndim=1)\n", - " N = problem.DependentVar(K.len_at(0))\n", + " N = problem.NamedExpr(K.len_at(0))\n", " M = problem.Natural()\n", " x = problem.BinaryVar(shape=(N, M))\n", " problem += problem.Constraint(\"2d k-hot\", x.sum(axis=1) == K)\n", @@ -1097,10 +1097,10 @@ "id": "8dbef935", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.320174Z", - "iopub.status.busy": "2026-02-26T05:59:05.320124Z", - "iopub.status.idle": "2026-02-26T05:59:05.456805Z", - "shell.execute_reply": "2026-02-26T05:59:05.456477Z" + "iopub.execute_input": "2026-03-24T02:05:50.856482Z", + "iopub.status.busy": "2026-03-24T02:05:50.856419Z", + "iopub.status.idle": "2026-03-24T02:05:51.037052Z", + "shell.execute_reply": "2026-03-24T02:05:51.036766Z" } }, "outputs": [ @@ -1110,7 +1110,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{KHotOverSet}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{k-hot\\_{}constraint}&\\quad \\displaystyle \\sum _{i\\in {C}_{a}}{{x}_{i}}={K}_{a}\\quad \\forall a\\;\\text{s.t.}\\;a\\in \\left\\{0,\\ldots ,M-1\\right\\}\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1126,7 +1126,7 @@ "problem = jm.Problem(\"KHotOverSet\")\n", "N = problem.Natural(\"N\")\n", "C = problem.Natural(\"C\", jagged=True, ndim=2)\n", - "M = problem.DependentVar(\"M\", C.len_at(0))\n", + "M = problem.NamedExpr(\"M\", C.len_at(0))\n", "K = problem.Natural(\"K\", shape=(M,))\n", "x = problem.BinaryVar(\"x\", shape=(N,))\n", "problem += problem.Constraint(\n", @@ -1150,10 +1150,10 @@ "id": "ccce502f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.457857Z", - "iopub.status.busy": "2026-02-26T05:59:05.457808Z", - "iopub.status.idle": "2026-02-26T05:59:05.603535Z", - "shell.execute_reply": "2026-02-26T05:59:05.603276Z" + "iopub.execute_input": "2026-03-24T02:05:51.038413Z", + "iopub.status.busy": "2026-03-24T02:05:51.038340Z", + "iopub.status.idle": "2026-03-24T02:05:51.220940Z", + "shell.execute_reply": "2026-03-24T02:05:51.220510Z" } }, "outputs": [ @@ -1163,7 +1163,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{KHotOverSet}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{k-hot\\_{}constraint}&\\quad \\displaystyle \\sum _{i\\in {C}_{a}}{{x}_{i}}={K}_{a}\\quad \\forall a\\;\\text{s.t.}\\;a\\in \\left\\{0,\\ldots ,M-1\\right\\}\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1180,7 +1180,7 @@ "def problem(problem: jm.DecoratedProblem):\n", " N = problem.Natural()\n", " C = problem.Natural(jagged=True, ndim=2)\n", - " M = problem.DependentVar(C.len_at(0))\n", + " M = problem.NamedExpr(C.len_at(0))\n", " K = problem.Natural(shape=(M,))\n", " x = problem.BinaryVar(shape=(N,))\n", " problem += problem.Constraint(\n", @@ -1212,10 +1212,10 @@ "id": "3f12d8d7", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.604685Z", - "iopub.status.busy": "2026-02-26T05:59:05.604628Z", - "iopub.status.idle": "2026-02-26T05:59:05.687672Z", - "shell.execute_reply": "2026-02-26T05:59:05.687397Z" + "iopub.execute_input": "2026-03-24T02:05:51.222576Z", + "iopub.status.busy": "2026-03-24T02:05:51.222483Z", + "iopub.status.idle": "2026-03-24T02:05:51.314397Z", + "shell.execute_reply": "2026-03-24T02:05:51.313970Z" } }, "outputs": [ @@ -1225,7 +1225,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{LinearInequality}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{weight}&\\quad \\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(w\\cdot x\\right)}}_{\\vec{\\imath }}}\\leq W\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1240,7 +1240,7 @@ "source": [ "problem = jm.Problem(\"LinearInequality\")\n", "w = problem.Float(\"w\", ndim=1)\n", - "N = problem.DependentVar(\"N\", w.len_at(0))\n", + "N = problem.NamedExpr(\"N\", w.len_at(0))\n", "W = problem.Float(\"W\")\n", "x = problem.BinaryVar(\"x\", shape=(N,))\n", "problem += problem.Constraint(\"weight\", (w * x).sum() <= W)\n", @@ -1262,10 +1262,10 @@ "id": "d4b89527", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.688738Z", - "iopub.status.busy": "2026-02-26T05:59:05.688683Z", - "iopub.status.idle": "2026-02-26T05:59:05.775395Z", - "shell.execute_reply": "2026-02-26T05:59:05.775049Z" + "iopub.execute_input": "2026-03-24T02:05:51.315599Z", + "iopub.status.busy": "2026-03-24T02:05:51.315536Z", + "iopub.status.idle": "2026-03-24T02:05:51.412830Z", + "shell.execute_reply": "2026-03-24T02:05:51.412389Z" } }, "outputs": [ @@ -1275,7 +1275,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{LinearInequality}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{weight}&\\quad \\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(w\\cdot x\\right)}}_{\\vec{\\imath }}}\\leq W\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1291,7 +1291,7 @@ "@jm.Problem.define(\"LinearInequality\")\n", "def problem(problem: jm.DecoratedProblem):\n", " w = problem.Float(ndim=1)\n", - " N = problem.DependentVar(w.len_at(0))\n", + " N = problem.NamedExpr(w.len_at(0))\n", " W = problem.Float()\n", " x = problem.BinaryVar(shape=(N,))\n", " problem += problem.Constraint(\"weight\", (w * x).sum() <= W)\n", @@ -1321,10 +1321,10 @@ "id": "632c4d8c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.776470Z", - "iopub.status.busy": "2026-02-26T05:59:05.776421Z", - "iopub.status.idle": "2026-02-26T05:59:05.934328Z", - "shell.execute_reply": "2026-02-26T05:59:05.933900Z" + "iopub.execute_input": "2026-03-24T02:05:51.414267Z", + "iopub.status.busy": "2026-03-24T02:05:51.414180Z", + "iopub.status.idle": "2026-03-24T02:05:51.569044Z", + "shell.execute_reply": "2026-03-24T02:05:51.568650Z" } }, "outputs": [ @@ -1338,7 +1338,7 @@ "$$" ], "text/plain": [ - "Problem(name=\"SOS-1\", sense=MINIMIZE, objective=0, constraints={Big-M: [Constraint(name=\"Big-M\", sense=LESS_THAN_EQUAL, left=a, right=M * x, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22129/1199227916.py\", start: SrcLoc { line: 2, column: 4 }, end: SrcLoc { line: 2, column: 24 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22129/1199227916.py\", start: SrcLoc { line: 2, column: 4 }, end: SrcLoc { line: 2, column: 24 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Float }, src_span: NoSrcSpan } }), scalar: Float }),],SOS1: [Constraint(name=\"SOS1\", sense=LESS_THAN_EQUAL, left=sum(x), right=1, shape=Scalar(Binary)),],})" + "Problem(name=\"SOS-1\", sense=MINIMIZE, objective=0, constraints={Big-M: [Constraint(name=\"Big-M\", sense=LESS_THAN_EQUAL, left=a, right=M * x, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_49545/1199227916.py\", start: SrcLoc { line: 2, column: 4 }, end: SrcLoc { line: 2, column: 24 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_49545/1199227916.py\", start: SrcLoc { line: 2, column: 4 }, end: SrcLoc { line: 2, column: 24 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Float }, src_span: NoSrcSpan } }), scalar: Float }),],SOS1: [Constraint(name=\"SOS1\", sense=LESS_THAN_EQUAL, left=sum(x), right=1, shape=Scalar(Binary)),],})" ] }, "execution_count": 26, @@ -1372,10 +1372,10 @@ "id": "cfcc2cf8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:05.935510Z", - "iopub.status.busy": "2026-02-26T05:59:05.935456Z", - "iopub.status.idle": "2026-02-26T05:59:06.090821Z", - "shell.execute_reply": "2026-02-26T05:59:06.090443Z" + "iopub.execute_input": "2026-03-24T02:05:51.570194Z", + "iopub.status.busy": "2026-03-24T02:05:51.570136Z", + "iopub.status.idle": "2026-03-24T02:05:51.730890Z", + "shell.execute_reply": "2026-03-24T02:05:51.730482Z" } }, "outputs": [ @@ -1389,7 +1389,7 @@ "$$" ], "text/plain": [ - "Problem(name=\"SOS-1\", sense=MINIMIZE, objective=0, constraints={Big-M: [Constraint(name=\"Big-M\", sense=LESS_THAN_EQUAL, left=a, right=M * x, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22129/3596302424.py\", start: SrcLoc { line: 3, column: 8 }, end: SrcLoc { line: 3, column: 25 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22129/3596302424.py\", start: SrcLoc { line: 3, column: 8 }, end: SrcLoc { line: 3, column: 25 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Float }, src_span: NoSrcSpan } }), scalar: Float }),],SOS1: [Constraint(name=\"SOS1\", sense=LESS_THAN_EQUAL, left=sum(x), right=1, shape=Scalar(Binary)),],})" + "Problem(name=\"SOS-1\", sense=MINIMIZE, objective=0, constraints={Big-M: [Constraint(name=\"Big-M\", sense=LESS_THAN_EQUAL, left=a, right=M * x, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_49545/3596302424.py\", start: SrcLoc { line: 3, column: 8 }, end: SrcLoc { line: 3, column: 25 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_49545/3596302424.py\", start: SrcLoc { line: 3, column: 8 }, end: SrcLoc { line: 3, column: 25 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Float }, src_span: NoSrcSpan } }), scalar: Float }),],SOS1: [Constraint(name=\"SOS1\", sense=LESS_THAN_EQUAL, left=sum(x), right=1, shape=Scalar(Binary)),],})" ] }, "execution_count": 27, @@ -1432,10 +1432,10 @@ "id": "29ed161b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:06.091910Z", - "iopub.status.busy": "2026-02-26T05:59:06.091861Z", - "iopub.status.idle": "2026-02-26T05:59:06.312314Z", - "shell.execute_reply": "2026-02-26T05:59:06.311913Z" + "iopub.execute_input": "2026-03-24T02:05:51.732007Z", + "iopub.status.busy": "2026-03-24T02:05:51.731947Z", + "iopub.status.idle": "2026-03-24T02:05:51.983084Z", + "shell.execute_reply": "2026-03-24T02:05:51.982595Z" } }, "outputs": [ @@ -1490,10 +1490,10 @@ "id": "01df2009", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:06.313307Z", - "iopub.status.busy": "2026-02-26T05:59:06.313251Z", - "iopub.status.idle": "2026-02-26T05:59:06.559599Z", - "shell.execute_reply": "2026-02-26T05:59:06.559272Z" + "iopub.execute_input": "2026-03-24T02:05:51.984105Z", + "iopub.status.busy": "2026-03-24T02:05:51.984039Z", + "iopub.status.idle": "2026-03-24T02:05:52.267729Z", + "shell.execute_reply": "2026-03-24T02:05:52.267301Z" } }, "outputs": [ diff --git a/docs/en/references/migration_guide_to_jijmodeling2.ipynb b/docs/en/references/migration_guide_to_jijmodeling2.ipynb index df6d862d..ac8ca450 100644 --- a/docs/en/references/migration_guide_to_jijmodeling2.ipynb +++ b/docs/en/references/migration_guide_to_jijmodeling2.ipynb @@ -55,7 +55,7 @@ " * Real: `problem.Float()`.\n", " - They produce clearer intent, tighter static type checking, and better error messages. Use `Placeholder` only for advanced cases (tuple / custom `dtype`s).\n", "\n", - "7. **Introduction of Dependent Variables**: The newly introduced `problem.DependentVar(..)` declaration allows you to bind and reuse frequently appearing sub-expressions as dependent variables. This resolves the issue in traditional JijModeling where definitions of variables in LaTeX (defined with `with_latex()` or `latex=...`) were unclear.\n", + "7. **Introduction of Named Expressions**: The newly introduced `problem.NamedExpr(..)` and `problem.NamedExpr(..)` declaration allows you to bind and reuse frequently appearing sub-expressions as named expressions. This resolves the issue in traditional JijModeling where definitions of variables in LaTeX (defined with `with_latex()` or `latex=...`) were unclear.\n", "\n", "8. **New Datatypes**: JijModeling 2 now shipped with dictionary and category label types!\n", " - Many cases formerly written using jagged arrays can now be written more simply with dictionaries!\n", @@ -123,10 +123,10 @@ "id": "07073ecc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:07.252840Z", - "iopub.status.busy": "2026-02-26T05:59:07.252783Z", - "iopub.status.idle": "2026-02-26T05:59:07.637412Z", - "shell.execute_reply": "2026-02-26T05:59:07.637017Z" + "iopub.execute_input": "2026-03-24T02:05:43.321800Z", + "iopub.status.busy": "2026-03-24T02:05:43.321690Z", + "iopub.status.idle": "2026-03-24T02:05:43.798175Z", + "shell.execute_reply": "2026-03-24T02:05:43.797789Z" } }, "outputs": [ @@ -192,10 +192,10 @@ "id": "a735444a", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:07.638487Z", - "iopub.status.busy": "2026-02-26T05:59:07.638399Z", - "iopub.status.idle": "2026-02-26T05:59:08.134770Z", - "shell.execute_reply": "2026-02-26T05:59:08.134303Z" + "iopub.execute_input": "2026-03-24T02:05:43.799604Z", + "iopub.status.busy": "2026-03-24T02:05:43.799490Z", + "iopub.status.idle": "2026-03-24T02:05:44.480146Z", + "shell.execute_reply": "2026-03-24T02:05:44.479708Z" } }, "outputs": [ @@ -372,10 +372,10 @@ "id": "1ff67480", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:08.135859Z", - "iopub.status.busy": "2026-02-26T05:59:08.135773Z", - "iopub.status.idle": "2026-02-26T05:59:08.137647Z", - "shell.execute_reply": "2026-02-26T05:59:08.137379Z" + "iopub.execute_input": "2026-03-24T02:05:44.481185Z", + "iopub.status.busy": "2026-03-24T02:05:44.481084Z", + "iopub.status.idle": "2026-03-24T02:05:44.483291Z", + "shell.execute_reply": "2026-03-24T02:05:44.482927Z" } }, "outputs": [ @@ -408,10 +408,10 @@ "id": "e436bcac", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:08.138517Z", - "iopub.status.busy": "2026-02-26T05:59:08.138464Z", - "iopub.status.idle": "2026-02-26T05:59:08.467511Z", - "shell.execute_reply": "2026-02-26T05:59:08.467102Z" + "iopub.execute_input": "2026-03-24T02:05:44.484201Z", + "iopub.status.busy": "2026-03-24T02:05:44.484151Z", + "iopub.status.idle": "2026-03-24T02:05:44.821125Z", + "shell.execute_reply": "2026-03-24T02:05:44.820732Z" } }, "outputs": [], @@ -710,10 +710,10 @@ "id": "4248c879", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:08.468835Z", - "iopub.status.busy": "2026-02-26T05:59:08.468769Z", - "iopub.status.idle": "2026-02-26T05:59:08.531535Z", - "shell.execute_reply": "2026-02-26T05:59:08.531163Z" + "iopub.execute_input": "2026-03-24T02:05:44.822546Z", + "iopub.status.busy": "2026-03-24T02:05:44.822476Z", + "iopub.status.idle": "2026-03-24T02:05:44.888743Z", + "shell.execute_reply": "2026-03-24T02:05:44.888343Z" } }, "outputs": [ @@ -784,10 +784,10 @@ "id": "70c79151", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:08.532616Z", - "iopub.status.busy": "2026-02-26T05:59:08.532554Z", - "iopub.status.idle": "2026-02-26T05:59:08.614564Z", - "shell.execute_reply": "2026-02-26T05:59:08.614216Z" + "iopub.execute_input": "2026-03-24T02:05:44.889952Z", + "iopub.status.busy": "2026-03-24T02:05:44.889891Z", + "iopub.status.idle": "2026-03-24T02:05:44.978267Z", + "shell.execute_reply": "2026-03-24T02:05:44.977914Z" } }, "outputs": [ @@ -852,10 +852,10 @@ "id": "a4897d4a", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:08.615559Z", - "iopub.status.busy": "2026-02-26T05:59:08.615502Z", - "iopub.status.idle": "2026-02-26T05:59:08.701689Z", - "shell.execute_reply": "2026-02-26T05:59:08.701388Z" + "iopub.execute_input": "2026-03-24T02:05:44.979404Z", + "iopub.status.busy": "2026-03-24T02:05:44.979343Z", + "iopub.status.idle": "2026-03-24T02:05:45.071099Z", + "shell.execute_reply": "2026-03-24T02:05:45.070806Z" } }, "outputs": [ @@ -920,10 +920,10 @@ "id": "bbb6f2fc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:08.702705Z", - "iopub.status.busy": "2026-02-26T05:59:08.702651Z", - "iopub.status.idle": "2026-02-26T05:59:08.788681Z", - "shell.execute_reply": "2026-02-26T05:59:08.788313Z" + "iopub.execute_input": "2026-03-24T02:05:45.072441Z", + "iopub.status.busy": "2026-03-24T02:05:45.072369Z", + "iopub.status.idle": "2026-03-24T02:05:45.163873Z", + "shell.execute_reply": "2026-03-24T02:05:45.163453Z" } }, "outputs": [ @@ -981,10 +981,10 @@ "id": "8407f344", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:08.789652Z", - "iopub.status.busy": "2026-02-26T05:59:08.789604Z", - "iopub.status.idle": "2026-02-26T05:59:08.897651Z", - "shell.execute_reply": "2026-02-26T05:59:08.897369Z" + "iopub.execute_input": "2026-03-24T02:05:45.164965Z", + "iopub.status.busy": "2026-03-24T02:05:45.164904Z", + "iopub.status.idle": "2026-03-24T02:05:45.284771Z", + "shell.execute_reply": "2026-03-24T02:05:45.284467Z" } }, "outputs": [ @@ -1049,10 +1049,10 @@ "id": "0d391b43", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:08.898702Z", - "iopub.status.busy": "2026-02-26T05:59:08.898650Z", - "iopub.status.idle": "2026-02-26T05:59:09.045685Z", - "shell.execute_reply": "2026-02-26T05:59:09.045296Z" + "iopub.execute_input": "2026-03-24T02:05:45.286019Z", + "iopub.status.busy": "2026-03-24T02:05:45.285964Z", + "iopub.status.idle": "2026-03-24T02:05:45.434244Z", + "shell.execute_reply": "2026-03-24T02:05:45.433890Z" } }, "outputs": [ @@ -1102,10 +1102,10 @@ "id": "e3050e27", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:09.046690Z", - "iopub.status.busy": "2026-02-26T05:59:09.046635Z", - "iopub.status.idle": "2026-02-26T05:59:09.166255Z", - "shell.execute_reply": "2026-02-26T05:59:09.165876Z" + "iopub.execute_input": "2026-03-24T02:05:45.435289Z", + "iopub.status.busy": "2026-03-24T02:05:45.435233Z", + "iopub.status.idle": "2026-03-24T02:05:45.703773Z", + "shell.execute_reply": "2026-03-24T02:05:45.703350Z" } }, "outputs": [ @@ -1155,10 +1155,10 @@ "id": "d4636310", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:09.167301Z", - "iopub.status.busy": "2026-02-26T05:59:09.167241Z", - "iopub.status.idle": "2026-02-26T05:59:09.644528Z", - "shell.execute_reply": "2026-02-26T05:59:09.644177Z" + "iopub.execute_input": "2026-03-24T02:05:45.704909Z", + "iopub.status.busy": "2026-03-24T02:05:45.704842Z", + "iopub.status.idle": "2026-03-24T02:05:46.234851Z", + "shell.execute_reply": "2026-03-24T02:05:46.234033Z" } }, "outputs": [ @@ -1257,10 +1257,10 @@ "id": "164f130e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:09.645565Z", - "iopub.status.busy": "2026-02-26T05:59:09.645503Z", - "iopub.status.idle": "2026-02-26T05:59:10.094438Z", - "shell.execute_reply": "2026-02-26T05:59:10.094000Z" + "iopub.execute_input": "2026-03-24T02:05:46.236868Z", + "iopub.status.busy": "2026-03-24T02:05:46.236694Z", + "iopub.status.idle": "2026-03-24T02:05:46.762020Z", + "shell.execute_reply": "2026-03-24T02:05:46.761647Z" } }, "outputs": [], @@ -1318,10 +1318,10 @@ "id": "60c7c648", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:10.095849Z", - "iopub.status.busy": "2026-02-26T05:59:10.095789Z", - "iopub.status.idle": "2026-02-26T05:59:10.180647Z", - "shell.execute_reply": "2026-02-26T05:59:10.180303Z" + "iopub.execute_input": "2026-03-24T02:05:46.764301Z", + "iopub.status.busy": "2026-03-24T02:05:46.764158Z", + "iopub.status.idle": "2026-03-24T02:05:46.857048Z", + "shell.execute_reply": "2026-03-24T02:05:46.856713Z" } }, "outputs": [ @@ -1384,10 +1384,10 @@ "id": "c141cc39", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:10.181702Z", - "iopub.status.busy": "2026-02-26T05:59:10.181648Z", - "iopub.status.idle": "2026-02-26T05:59:10.361210Z", - "shell.execute_reply": "2026-02-26T05:59:10.360852Z" + "iopub.execute_input": "2026-03-24T02:05:46.858358Z", + "iopub.status.busy": "2026-03-24T02:05:46.858294Z", + "iopub.status.idle": "2026-03-24T02:05:47.052041Z", + "shell.execute_reply": "2026-03-24T02:05:47.051690Z" } }, "outputs": [ @@ -1397,7 +1397,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{KHotOverSet}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{k-hot\\_{}constraint}&\\quad \\displaystyle \\sum _{i\\in {C}_{a}}{{x}_{i}}={K}_{a}\\quad \\forall a\\;\\text{s.t.}\\;a\\in \\left\\{0,\\ldots ,M-1\\right\\}\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1416,7 +1416,7 @@ "def _(problem: jm.DecoratedProblem):\n", " N = problem.Length()\n", " C = problem.Natural(jagged=True, ndim=2)\n", - " M = problem.DependentVar(C.len_at(0))\n", + " M = problem.NamedExpr(C.len_at(0))\n", " K = problem.Placeholder(dtype=jm.DataType.NATURAL, shape=(M,))\n", " x = problem.BinaryVar(shape=(N,))\n", " \n", @@ -1466,10 +1466,10 @@ "id": "63466e33", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:10.362353Z", - "iopub.status.busy": "2026-02-26T05:59:10.362293Z", - "iopub.status.idle": "2026-02-26T05:59:10.794772Z", - "shell.execute_reply": "2026-02-26T05:59:10.794504Z" + "iopub.execute_input": "2026-03-24T02:05:47.053191Z", + "iopub.status.busy": "2026-03-24T02:05:47.053134Z", + "iopub.status.idle": "2026-03-24T02:05:47.619735Z", + "shell.execute_reply": "2026-03-24T02:05:47.619326Z" } }, "outputs": [ @@ -1479,7 +1479,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{CompilerDemo}\\\\\\displaystyle \\max &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(v\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{weight}&\\quad \\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(w\\cdot x\\right)}}_{\\vec{\\imath }}}\\leq W\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(v,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(v,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1506,7 +1506,7 @@ "def _(problem: jm.DecoratedProblem):\n", " v = problem.Placeholder(dtype=jm.DataType.FLOAT, ndim=1)\n", " w = problem.Placeholder(dtype=jm.DataType.FLOAT, ndim=1)\n", - " N = problem.DependentVar(v.len_at(0))\n", + " N = problem.NamedExpr(v.len_at(0))\n", " W = problem.Float()\n", " x = problem.BinaryVar(shape=(N,))\n", " \n", @@ -1766,10 +1766,10 @@ "id": "66f48d43", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:10.795941Z", - "iopub.status.busy": "2026-02-26T05:59:10.795883Z", - "iopub.status.idle": "2026-02-26T05:59:10.913095Z", - "shell.execute_reply": "2026-02-26T05:59:10.912778Z" + "iopub.execute_input": "2026-03-24T02:05:47.621016Z", + "iopub.status.busy": "2026-03-24T02:05:47.620953Z", + "iopub.status.idle": "2026-03-24T02:05:47.748264Z", + "shell.execute_reply": "2026-03-24T02:05:47.747608Z" } }, "outputs": [ @@ -1813,10 +1813,10 @@ "id": "35080ca8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:10.914151Z", - "iopub.status.busy": "2026-02-26T05:59:10.914100Z", - "iopub.status.idle": "2026-02-26T05:59:11.009725Z", - "shell.execute_reply": "2026-02-26T05:59:11.009409Z" + "iopub.execute_input": "2026-03-24T02:05:47.749365Z", + "iopub.status.busy": "2026-03-24T02:05:47.749301Z", + "iopub.status.idle": "2026-03-24T02:05:47.850728Z", + "shell.execute_reply": "2026-03-24T02:05:47.850339Z" } }, "outputs": [ diff --git a/docs/en/releases/jijmodeling-2.3.1.ipynb b/docs/en/releases/jijmodeling-2.3.1.ipynb new file mode 100644 index 00000000..d5b53884 --- /dev/null +++ b/docs/en/releases/jijmodeling-2.3.1.ipynb @@ -0,0 +1,203 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "e8db6ac3", + "metadata": {}, + "source": [ + "# JijModeling 2.3.1 Release Notes" + ] + }, + { + "cell_type": "markdown", + "id": "5384a18c", + "metadata": {}, + "source": [ + "## Feature Enhancements" + ] + }, + { + "cell_type": "markdown", + "id": "bfabf210", + "metadata": {}, + "source": [ + "### Added `jm.range()`\n", + "\n", + "With the {py:func}`jijmodeling.range()` function you can now represent sequences by using {py:class}`~jijmodeling.Expression`s. Its usage is similar to python's built-in {py:class}`range() `.\n", + "\n", + "Example usage:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "18732837", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:39.222220Z", + "iopub.status.busy": "2026-03-24T02:05:39.222101Z", + "iopub.status.idle": "2026-03-24T02:05:39.303333Z", + "shell.execute_reply": "2026-03-24T02:05:39.302886Z" + } + }, + "outputs": [], + "source": [ + "import jijmodeling as jm\n", + "\n", + "\n", + "@jm.Problem.define(\"RangeProblem\")\n", + "def problem(problem: jm.DecoratedProblem):\n", + " S = problem.Natural()\n", + " F = problem.Natural()\n", + " N = problem.Natural()\n", + " x = problem.BinaryVar(shape=(10,))\n", + " problem += jm.sum(x[i] for i in jm.range(S, F, N))" + ] + }, + { + "cell_type": "markdown", + "id": "f7237d0b", + "metadata": {}, + "source": [ + "### Support `-=` operator to update a `Problem`'s objective function\n", + "\n", + "You can now use `-=` to add subtracted terms from a {py:class}`~jijmodeling.Problem`'s objective function. \n", + "\n", + "Unlike `+=`, `-=` does not support removing constraints." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "1c465812", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:39.304771Z", + "iopub.status.busy": "2026-03-24T02:05:39.304704Z", + "iopub.status.idle": "2026-03-24T02:05:39.329026Z", + "shell.execute_reply": "2026-03-24T02:05:39.328617Z" + } + }, + "outputs": [], + "source": [ + "problem = jm.Problem(\"problem\")\n", + "x = problem.ContinuousVar(\"x\", lower_bound=0, upper_bound=5)\n", + "y = problem.ContinuousVar(\"y\", lower_bound=0, upper_bound=5)\n", + "\n", + "problem += x\n", + "problem -= y\n", + "assert jm.is_same(problem.objective, x - y)" + ] + }, + { + "cell_type": "markdown", + "id": "1427646e", + "metadata": {}, + "source": [ + "### `DependentVar` becomes `NamedExpr`\n", + "\n", + "Before JijModeling 2.3, there was a `DependentVar` class for representing dependent variables.\n", + "Despite the name, this feature could also be used to define values that do not depend on decision variables, such as the length of a Placeholder.\n", + "Because this could be confusing, the `DependentVar` class has been replaced by the {py:class}`~jijmodeling.NamedExpr` class, which provides the same functionality. Use {py:class}`~jijmodeling.NamedExpr` instead.\n", + "\n", + "For details, see {doc}`../advanced/named_expr`." + ] + }, + { + "cell_type": "markdown", + "id": "c6d00850", + "metadata": {}, + "source": [ + "## Bugfixes" + ] + }, + { + "cell_type": "markdown", + "id": "4b2d929b", + "metadata": {}, + "source": [ + "### Bugfix: Proper handling of bound variables in slice notation\n", + "\n", + "The handling of bound variables in slice notation has been fixed, ensuring that variables bound in comprehensions or constraint indices are correctly handled within slice notation.\n", + "\n", + "### Bugfix: LaTeX output for sums and membership relations over natural numbers in indexed constraints\n", + "\n", + "In previous versions, when the domain of an indexed constraint or the range of a summation was over natural numbers, the membership relation was output using $\\in$, for example:\n", + "\n", + "$$\n", + "\\text{c1}:\\quad\\sum _{j\\in {N}_{1}}{{x}_{i,j}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in {N}_{0}\n", + "$$\n", + "\n", + "Starting in this release, the output is made natural in the same way as objective functions and standalone constraints:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "1162639e", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:05:39.330504Z", + "iopub.status.busy": "2026-03-24T02:05:39.330436Z", + "iopub.status.idle": "2026-03-24T02:05:39.450426Z", + "shell.execute_reply": "2026-03-24T02:05:39.450094Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\text{c1}\\colon \\quad \\sum _{j=0}^{{N}_{1}-1}{{x}_{i,j}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in \\left\\{0,\\ldots ,{N}_{0}-1\\right\\}$$" + ], + "text/plain": [ + "Constraint(name=\"c1\", , lambda i: sum(N[1].map(lambda (j: natural): x[i, j])) == 1, domain=set(N[0]))" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem = jm.Problem(\"P\")\n", + "N = problem.Natural(\"N\", shape=2)\n", + "x = problem.BinaryVar(\"x\", shape=(N[0], N[1]))\n", + "problem.Constraint(\"c1\", lambda i: jm.sum(N[1], lambda j: x[i, j]) == 1, domain=N[0])" + ] + }, + { + "cell_type": "markdown", + "id": "7db8f59e", + "metadata": {}, + "source": [ + "### Bugfix: Fixes unrecoverable error in random instance generation under unused placeholder\n", + "\n", + "We have fixed the bug where the random instance generation panics under the presence of an unused placeholder in the problem definition." + ] + } + ], + "metadata": { + "jupytext": { + "default_lexer": "ipython3" + }, + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/ja/_config.yml b/docs/ja/_config.yml index 1c174c83..6a0b0f75 100644 --- a/docs/ja/_config.yml +++ b/docs/ja/_config.yml @@ -12,6 +12,7 @@ execute: timeout: 60 exclude_patterns: - "releases/jijmodeling-*" + - "releases/unreleased*" # Define the name of the latex output file for PDF builds latex: diff --git a/docs/ja/_toc.yml b/docs/ja/_toc.yml index 2720bd8a..3fca1eac 100644 --- a/docs/ja/_toc.yml +++ b/docs/ja/_toc.yml @@ -4,16 +4,16 @@ format: jb-book root: introduction parts: - # TODO: JijModeling2が正式リリースされた際には、latestではなくstableへのリンクに変更すること + # TODO: JijModeling2 が正式リリースされた際には、latest ではなく stable へのリンクに変更すること - caption: Switch Language chapters: - url: https://jij-inc-jijmodeling-tutorials-en.readthedocs-hosted.com/en/ title: English - - caption: クイックスタート + - caption: Quick Start chapters: - file: quickstart/scip - file: quickstart/openjij - - caption: JijModelingの基本 + - caption: Basics chapters: - file: basics/overview - file: basics/problem @@ -21,20 +21,26 @@ parts: - file: basics/expressions - file: basics/modeling - file: basics/instance_generation - - caption: リファレンス + - caption: Advanced + chapters: + - file: advanced/named_expr + - file: advanced/generation + - file: advanced/serialize + - caption: Reference chapters: - url: https://jij-inc-jijmodeling.readthedocs-hosted.com/en/ title: jijmodeling API Reference - file: references/cheat_sheet - file: references/migration_guide_to_jijmodeling2 - - caption: リリースノート + - caption: Release Notes chapters: + - file: releases/jijmodeling-2.3.1 - file: releases/jijmodeling-2.2.0 - file: releases/jijmodeling-2.1.0 - file: releases/jijmodeling-2.0.0 - url: https://jij-inc-jijmodeling-tutorials-ja.readthedocs-hosted.com/ja/jijmodeling1 title: JijModeling 1.x 系統 - - caption: 旧バージョン向けリソース + - caption: Resources for Older Versions chapters: - url: https://jij-inc-jijmodeling-tutorials-ja.readthedocs-hosted.com/ja/jijmodeling1 title: JijModeling 1.x diff --git a/docs/ja/advanced/generation.ipynb b/docs/ja/advanced/generation.ipynb new file mode 100644 index 00000000..d9f383eb --- /dev/null +++ b/docs/ja/advanced/generation.ipynb @@ -0,0 +1,311 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "21f42332-3b40-49bf-b99e-95ed92f04b73", + "metadata": {}, + "source": [ + "# インスタンスのランダム生成の使い方\n", + "\n", + "{py:class}`~jijmodeling.Problem`には、 問題のスキーマ(つまり、プレースホルダー)に基づいたインスタンスデータのランダム生成が行えるメソッドがあります。本節では、そのランダム生成における設定などを説明します。\n", + "\n", + "メソッドは2つあり、以下の通りになります。\n", + "- {py:meth}`Problem.generate_random_dataset ` は、{py:meth}`Problem.eval` に渡すインスタンスデータを返します。\n", + "- {py:meth}`Problem.generate_random_instance ` は、 同じくデータを生成するが、 OMMX インスタンスとして返します。 `generate_random_dataset`で取得したインスタンスデータをそのまま{py:meth}`Problem.eval`に渡すのと同じです。\n", + "\n", + "上記メソッドの生成に関する引数は共通で、`default` と `options` と `seed` の3つです。さらには`generate_random_instance`は`Problem.eval`の引数も対応しています(`prune_unused_dec_vars`、`constraint_detection`など)。\n", + "\n", + "`seed`パラメータは、乱数生成の初期化に使われる乱数シードです。インスタンス生成に再現性を求める場合に使えます。\n", + "\n", + "`default`と`options`は、インスタンスデータの値の範囲を決めるものです。`options` では、辞書で問題の各{py:class}`~jijmodeing.Placeholder` に対してそれぞれの値の範囲を指定することができます。`default`は、特定の範囲指定がない値のためのデフォルト範囲となります。いずれも必須ではありません。`options`で全プレースホルダーの範囲を指定している場合は`default`を渡す必要がありませんし、`default`だけでシンプルなデータを生成できる場合もあります。しかし、生成されたインスタンスが実行可能解を持つ保証はないので注意してください。\n", + "\n", + "実際に引数の指定方法を見ていきましょう。\n", + "\n", + "## `default` と `options`の指定方法\n", + "\n", + "`default`と`options` は両方とも以下の指定方法を対応としています。\n", + "- 固定値\n", + "- Python 組み込みの`range`\n", + "- {py:mod}`jijmodeling.generation` 配下の関数から取得されたオブジェクト\n", + "- タプルや辞書などを使った範囲指定。詳細は{py:meth}`~jijmodeling.Problem.generate_random_dataset`の API リファレンスを参照してください\n", + "\n", + "固定値が指定された場合、その数値がそのままプレースホルダーの値に使われます(ランダムな値は使いません)。 Python の `range` や {py:mod}`jijmodeling.generation` などの範囲が指定された場合、その範囲がランダム生成の境界になります。\n", + "\n", + "指定方法の例を見てみましょう。" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "34020325-4747-42ce-ab64-4114e871dca0", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:40.949446Z", + "iopub.status.busy": "2026-03-24T02:04:40.949109Z", + "iopub.status.idle": "2026-03-24T02:04:41.010745Z", + "shell.execute_reply": "2026-03-24T02:04:41.010319Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'A': 6, 'B': 1}" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import jijmodeling as jm\n", + "\n", + "problem = jm.Problem(\"my problem\")\n", + "x = problem.BinaryVar(\"x\")\n", + "A = problem.Natural(\"A\")\n", + "B = problem.Natural(\"B\")\n", + "problem += A * x + B\n", + "\n", + "problem.generate_random_dataset(default={\"value\": range(1, 10)})" + ] + }, + { + "cell_type": "markdown", + "id": "d3db3cc1-3d7b-409d-9091-b756af674679", + "metadata": {}, + "source": [ + "上記の例では、`options`がないため、 `A`と`B`の値の生成時は、`default`が参照されます。`range`の区間内でそれぞれ別の値が生成されます。\n", + "\n", + "今回使った Python 組み込みの`range`は左閉右開になっています(つまり、`range(1,4)`の場合、1、2、3が入って、4は入らない)。{py:mod}`jijmodeling.generation` では、 開区間の{py:func}`jijmodeling.generation.open`や左有界(上界が無限大)の{py:func}`jijmodeling.generation.at_least`など、違うスタイルの範囲を定義するための関数を提供しています。 Python 組み込みの`range`は {py:func}`jijmodeling.generation.closed_open`と同じになります。\n", + "\n", + "生成された値はプレースホルダーの型に則します。つまり、自然数のプレースホルダーがあった場合、`(-10, 10)` など負数を含む範囲を渡しても、生成されるのは自然数のみです。\n", + "\n", + "それでは、`options`を使って、`A`と`B`に別々の範囲を指定したい場合をみてみましょう。プレースホルダーの名前がキー、値が該当プレースホルダーの生成オプションになります。生成オプションは複数あるので、辞書である必要があります。スカラーの場合は`value`オプションのみで十分です。他のオプションは下記で説明します。" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "9ea06ded-9bc5-4eb9-85c7-837538a5940b", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:41.011898Z", + "iopub.status.busy": "2026-03-24T02:04:41.011838Z", + "iopub.status.idle": "2026-03-24T02:04:41.014289Z", + "shell.execute_reply": "2026-03-24T02:04:41.013956Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'B': 6, 'A': 81}" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem.generate_random_dataset(default={\"value\": range(1, 10)}, options={\"A\": {\"value\": range(50, 100)}})" + ] + }, + { + "cell_type": "markdown", + "id": "0563f2f4-71d4-4d5b-ac3a-81ffa98d17c8", + "metadata": {}, + "source": [ + "このコードでは、`options`を通じて`\"A\"`の値の範囲を指定しています。`\"B\"`は`options`で指定していないため、前述の通り`default`を参照しています。もちろん、次のようにどちらも`options`で指定することも可能です。" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "8fedb42a-12d2-41f6-b3de-c989ea1aa4ab", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:41.015385Z", + "iopub.status.busy": "2026-03-24T02:04:41.015329Z", + "iopub.status.idle": "2026-03-24T02:04:41.017678Z", + "shell.execute_reply": "2026-03-24T02:04:41.017370Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'A': 69, 'B': 1}" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem.generate_random_dataset(options = {\"A\": {\"value\": range(50, 100)}, \"B\": {\"value\": range(1, 10)}})" + ] + }, + { + "cell_type": "markdown", + "id": "2b7519a3-e7d6-4240-81cc-cf778eea4f32", + "metadata": {}, + "source": [ + "## 配列プレスホルダー\n", + "\n", + "配列プレスホルダーの値の範囲指定は基本的にスカラーと同じです。プレースホルダーの`shape`が完全に定義された場合、その`shape`に則した配列が生成されます。要素はすべて`value`範囲内となります(`value`指定がない場合、`default`が参照されます)。" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "19a45cfe-40de-4e5e-9cad-62114b225b09", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:41.018524Z", + "iopub.status.busy": "2026-03-24T02:04:41.018472Z", + "iopub.status.idle": "2026-03-24T02:04:41.071480Z", + "shell.execute_reply": "2026-03-24T02:04:41.071114Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'A': array([1, 8, 4, 6, 7, 3, 8, 9, 6, 3], dtype=object)}" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem = jm.Problem(\"my problem\")\n", + "# この例では、数値の10にしているが、shapeをプレースホルダーにしても問題ありません。\n", + "x = problem.BinaryVar(\"x\", shape=10)\n", + "A = problem.Natural(\"A\", shape=10)\n", + "problem += jm.sum(10, lambda i: A[i] * x[i])\n", + "\n", + "problem.generate_random_dataset(options={\"A\": {\"value\": range(1,10)}})" + ] + }, + { + "cell_type": "markdown", + "id": "4ad01538-ef71-494e-ac5d-8322248f6744", + "metadata": {}, + "source": [ + "`shape`が完全に定義されていない場合は、配列の要素数を`size`キーで指定する必要があります。`size`は要素数を決めるものなので自然数でなければなりませんが、`value`と同様、範囲指定に対応しています。そのため、配列の要素数がランダムなインスタンスも生成可能です。" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "ac97241e-47bd-4b5b-b8f6-49d5ddb43254", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:41.072644Z", + "iopub.status.busy": "2026-03-24T02:04:41.072558Z", + "iopub.status.idle": "2026-03-24T02:04:41.103176Z", + "shell.execute_reply": "2026-03-24T02:04:41.102769Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'A': array([7.922440851203646, -2.2362166205229705, -1.187315801401505,\n", + " 3.8729629770943053, 7.164100076039116], dtype=object)}" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem = jm.Problem(\"my problem\")\n", + "A = problem.Float(\"A\", ndim=1)\n", + "N = A.len_at(0)\n", + "x = problem.BinaryVar(\"x\", shape=(N,))\n", + "\n", + "problem += jm.sum(N, lambda i: A[i] * x[i])\n", + "\n", + "problem.generate_random_dataset(\n", + " options={\n", + " \"A\": {\"value\": range(-10, 10), \"size\": range(1,10),}\n", + " },\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "a18ee36c-9b86-419f-8811-124649c77e48", + "metadata": {}, + "source": [ + "`shape`の一部が未指定のプレースホルダーの場合(たとえば`shape=(None, 10)`など)、要素数が未指定になっている次元はそれぞれ`size`を参照して要素数を決めます。`shape`の情報が優先されるので、要素数が完全に定義されているプレースホルダーに`size`オプションをつけても意味ありません。" + ] + }, + { + "cell_type": "markdown", + "id": "a3c5bdda-bfde-4611-b326-37c9fa073a9a", + "metadata": {}, + "source": [ + "## 辞書型プレースホルダー\n", + "\n", + "カテゴリーラベル型をキーとしている辞書型のプレースホルダーの場合、`options`でそのカテゴリーラベルに該当するキーを定義する必要があります。カテゴリーラベルのオプションに`keys`に文字列の配列を設定すると、キー集合を明示的に定義できます。たとえば、カテゴリーラベル`C`のキー集合をX、Y、Zにするには以下のように書きます。\n", + "\n", + "```python\n", + "{ \"C\": {\"keys\": [\"X\", \"Y\", \"Z\"]} }\n", + "```\n", + "\n", + "`C` をキー集合にしている辞書型プレースホルダーは、`keys`に渡された各文字列に対して値を生成します。範囲指定はスカラーと配列型と同じで、`default`を渡すか、各プレースホルダーの`options`で指定することができます。\n", + "\n", + "生成したいインスタンスにとってカテゴリーラベルで実際使われる文字列がなんでもよいという場合、カテゴリーラベルのオプションに`keys`ではなく、`size`をすることも可能です(固定値も範囲指定も可)。その場合、その数だけの文字列が適当に生成されます。\n", + "\n", + "`PartialDict`含め、デフォルトで全辞書型プレースホルダーで全域に対して値を生成するということになっています。`PartialDict`のキーを制限したいときは、そのプレースホルダーのオプションに追加で`keys`か`size`を渡す必要があります。\n", + "たとえば、`C`がキー集合になっている `D` プレースホルダー(`PartialDict`)がある場合は次のように書きます。\n", + "\n", + "```python\n", + "{ \"C\": {\"keys\": [\"X\", \"Y\", \"Z\"]}, \"D\": {\"keys\": [\"X\", \"Y\"], \"value\": range(10, 100)} } }\n", + "```\n", + "\n", + "上記はカテゴリーラベルに`keys`を設定している時のみ使える書き方で、`\"D\"`の`keys`がキー集合の部分集合になっていないとエラーになるのでご注意ください。\n", + "\n", + "一方、プレースホルダーのオプションに`size`を使うことで、キー集合の中からその数だけ任意に選ばれます。この方法だとカテゴリーラベルがどのように定義されても構いません。\n", + "```python\n", + "# キーが1個か2個選ばれる場合\n", + "{ \"C\": {\"keys\": [\"X\", \"Y\", \"Z\"]}, \"D\": {\"size\": range(1, 3), \"value\": range(10, 100)} } } \n", + "# キーが1個から4個選ばれる場合\n", + "{ \"C\": {\"size\": range(3, 10)}, \"D\": {\"size\": range(1, 5), \"value\": range(10, 100)} } } \n", + "```" + ] + } + ], + "metadata": { + "jupytext": { + "default_lexer": "ipython3" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/ja/advanced/named_expr.ipynb b/docs/ja/advanced/named_expr.ipynb new file mode 100644 index 00000000..5ad1b565 --- /dev/null +++ b/docs/ja/advanced/named_expr.ipynb @@ -0,0 +1,796 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "32626170", + "metadata": {}, + "source": [ + "# 式の命名とインスタンスへの保存\n", + "\n", + "JijModeling では、名前つきの式を表すクラスとして {py:class}`~jijmodeling.NamedExpr` クラスが提供されており、\n", + "決定変数やプレースホルダーと同様に、 {py:meth}`Problem.NamedExpr() ` メソッドを使って宣言することができます。\n", + "{py:meth}`Problem.NamedExpr() ` の引数は以下の通りです。\n", + "\n", + "| 引数 | 型 | 説明 |\n", + "| :-- | :--: | :-- |\n", + "| `name` | `str` | 名前つき式の名前。Decorator API では省略可能。 |\n", + "| `definition` | 必須。{py:data}`~jijmodeling.ExpressionLike` | 名前つき式の定義。JijModeling の式オブジェクトや、Python の数値、文字列、タプル、リスト、辞書、NumPy 配列など、式に変換可能なオブジェクトを指定できます。 |\n", + "| `description` | `Optional[str]` | 省略可。名前つき式の説明。数式出力や OMMX に保存される式の説明に使用されます。 |\n", + "| `latex` | `Optional[str]` | 省略可。名前つき式の $\\LaTeX$ 表現。数式出力時に使用されます。 |\n", + "| `save_in_ommx` | `bool` | 省略可(デフォルト:`False`)。`True` にすると、後述する条件を満たす場合、OMMX インスタンスに {py:class}`ommx.v1.NamedFunction` として保存されます。 |\n", + "\n", + "{py:class}`~jijmodeling.NamedExpr` には、以下の 2 つの使い方があります。\n", + "\n", + "1. 特定の式に対して名前をつけて $\\LaTeX$ 表示を見やすくする\n", + "2. 特定の式を OMMX インスタンスに保存して求解後にその式の値を評価する\n", + "\n", + "本ドキュメントでは、 {py:class}`~jijmodeling.NamedExpr` のこれらの使い方について具体例を交えながら説明していきます。" + ] + }, + { + "cell_type": "markdown", + "id": "67efc510", + "metadata": {}, + "source": [ + "# 式の命名\n", + "\n", + "特定の式に対して名前をつけて $\\LaTeX$ 表示を見やすくする例を見てみましょう。ナップサック問題において、アイテム数 $N$ をインスタンスデータとして与えるのではなく、各アイテムの重さを表すプレースホルダー配列 $w$ の長さから推論することを考えます。\n", + "まずは、 {py:meth}`~jijmodeling.Problem.NamedExpr` を使わずに定式化すると以下のようになります。" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "fa9c461b", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:42.375128Z", + "iopub.status.busy": "2026-03-24T02:04:42.374891Z", + "iopub.status.idle": "2026-03-24T02:04:42.556974Z", + "shell.execute_reply": "2026-03-24T02:04:42.556630Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Knapsack (Unnamed)}\\\\\\displaystyle \\max &\\displaystyle \\sum _{i=0}^{\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)-1}{{v}_{i}\\cdot {x}_{i}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", + "\\text{Weight}&\\quad \\displaystyle \\sum _{i=0}^{\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)-1}{{w}_{i}\\cdot {x}_{i}}\\leq W\\end{aligned}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right);\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\&&&\\text{$x_i = 1$ if item i is put in the knapsack}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{value of each item}\\\\&&&\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\&&&\\text{maximum weight capacity of the knapsack}\\\\&&&\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{weight of each item}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Knapsack (Unnamed)\", sense=MAXIMIZE, objective=sum(w.len_at(0).map(lambda (i: natural): v[i] * x[i])), constraints={Weight: [Constraint(name=\"Weight\", sense=LESS_THAN_EQUAL, left=sum(w.len_at(0).map(lambda (i: natural): w[i] * x[i])), right=W, shape=Scalar(Float)),],})" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import jijmodeling as jm\n", + "\n", + "\n", + "@jm.Problem.define(\"Knapsack (Unnamed)\", sense=jm.ProblemSense.MAXIMIZE)\n", + "def knapsack_unnamed(problem: jm.DecoratedProblem):\n", + " W = problem.Float(description=\"maximum weight capacity of the knapsack\")\n", + " w = problem.Float(ndim=1, description=\"weight of each item\")\n", + " # w の長さから N を推論させる\n", + " N = w.len_at(0)\n", + " v = problem.Float(shape=(N,), description=\"value of each item\")\n", + " x = problem.BinaryVar(\n", + " shape=(N,), description=\"$x_i = 1$ if item i is put in the knapsack\"\n", + " )\n", + "\n", + " problem += jm.sum(v[i] * x[i] for i in N)\n", + " problem += problem.Constraint(\"Weight\", jm.sum(w[i] * x[i] for i in N) <= W)\n", + "\n", + "\n", + "knapsack_unnamed" + ] + }, + { + "cell_type": "markdown", + "id": "cefc66f3", + "metadata": {}, + "source": [ + "$\\LaTeX$ 表示を見るとわかる通り、$N$ の定義式 `len_at(w, 0)` が定義中で展開されてしまっており、特に総和の範囲などがみづらくなっています。\n", + "そこで、$N$ を {py:meth}`~jijmodeling.Problem.NamedExpr` を使って定義してみましょう。" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "225fa821", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:42.558188Z", + "iopub.status.busy": "2026-03-24T02:04:42.558125Z", + "iopub.status.idle": "2026-03-24T02:04:42.720393Z", + "shell.execute_reply": "2026-03-24T02:04:42.719977Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Knapsack}\\\\\\displaystyle \\max &\\displaystyle \\sum _{i=0}^{N-1}{{v}_{i}\\cdot {x}_{i}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", + "\\text{Weight}&\\quad \\displaystyle \\sum _{i=0}^{N-1}{{w}_{i}\\cdot {x}_{i}}\\leq W\\end{aligned}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\&&&\\text{$x_i = 1$ if item i is put in the knapsack}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[N;\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{value of each item}\\\\&&&\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\&&&\\text{maximum weight capacity of the knapsack}\\\\&&&\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{weight of each item}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N},\\text{Length of w}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Knapsack\", sense=MAXIMIZE, objective=sum(N.map(lambda (i: natural): v[i] * x[i])), constraints={Weight: [Constraint(name=\"Weight\", sense=LESS_THAN_EQUAL, left=sum(N.map(lambda (i: natural): w[i] * x[i])), right=W, shape=Scalar(Float)),],})" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "@jm.Problem.define(\"Knapsack\", sense=jm.ProblemSense.MAXIMIZE)\n", + "def knapsack(problem: jm.DecoratedProblem):\n", + " W = problem.Float(description=\"maximum weight capacity of the knapsack\")\n", + " w = problem.Float(ndim=1, description=\"weight of each item\")\n", + " # w の長さに対して NamedExpr を利用して N という名前をつける\n", + " N = problem.NamedExpr(w.len_at(0), description=\"Length of w\")\n", + " v = problem.Float(shape=(N,), description=\"value of each item\")\n", + " x = problem.BinaryVar(\n", + " shape=(N,), description=\"$x_i = 1$ if item i is put in the knapsack\"\n", + " )\n", + "\n", + " problem += jm.sum(v[i] * x[i] for i in N)\n", + " problem += problem.Constraint(\"Weight\", jm.sum(w[i] * x[i] for i in N) <= W)\n", + "\n", + "\n", + "knapsack" + ] + }, + { + "cell_type": "markdown", + "id": "96c95171", + "metadata": {}, + "source": [ + "末尾の `Named Expressions` 節に $N$ の定義式が現れ、残りの数式中でも $N$ として表示されるようになり、$\\LaTeX$ 表示としても見やすくなりました。" + ] + }, + { + "cell_type": "markdown", + "id": "a821a5fe", + "metadata": {}, + "source": [ + "また、 {py:meth}`~jijmodeling.Problem.NamedExpr` で定義された $N$ は JijModeling の数理モデルの中では変数の一種として扱われますが、コンパイル時に自動で展開されるため、 {py:meth}`~jijmodeling.Problem.NamedExpr` の有無で OMMX インスタンスが変わることはありません。" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "21904726", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:42.721549Z", + "iopub.status.busy": "2026-03-24T02:04:42.721491Z", + "iopub.status.idle": "2026-03-24T02:04:43.863718Z", + "shell.execute_reply": "2026-03-24T02:04:43.863251Z" + } + }, + "outputs": [], + "source": [ + "knapsack_instance_data = {\n", + " \"v\": [10, 13, 18, 31, 7, 15],\n", + " \"w\": [11, 15, 20, 35, 10, 33],\n", + " \"W\": 47,\n", + "}\n", + "\n", + "instance_named = knapsack.eval(knapsack_instance_data)\n", + "instance_unnamed = knapsack_unnamed.eval(knapsack_instance_data)\n", + "\n", + "assert instance_named.objective.almost_equal(instance_unnamed.objective)\n", + "assert instance_named.constraints[0].function.almost_equal(\n", + " instance_unnamed.constraints[0].function\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "3e6bcec4", + "metadata": {}, + "source": [ + ":::{tip}\n", + "数理モデルに登録されている {py:class}`~jijmodeling.NamedExpr` の一覧は、 {py:meth}`jijmodeling.Problem.named_exprs` で確認できます。\n", + ":::" + ] + }, + { + "cell_type": "markdown", + "id": "ac90ca24", + "metadata": {}, + "source": [ + "## インタンスへの保存\n", + "\n", + "{py:class}`~jijmodeling.Problem.NamedExpr` の `save_in_ommx` 引数に `True` を設定することで、以下の条件を満たす場合に限り、その式を OMMX インスタンスに保存することができます。\n", + "\n", + "1. 取りうる値がスカラーである式\n", + "2. 取りうる値がスカラーである式の配列\n", + "3. 取りうる値がスカラーである式の辞書\n", + "\n", + "具体的には、以下のような式が OMMX インスタンスに保存できます。" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "eb75269d", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:43.865210Z", + "iopub.status.busy": "2026-03-24T02:04:43.865074Z", + "iopub.status.idle": "2026-03-24T02:04:43.911678Z", + "shell.execute_reply": "2026-03-24T02:04:43.911374Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Scalar}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[5;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}scalar&=\\sum _{\\vec{\\imath }}{{{\\left(x\\right)}}_{\\vec{\\imath }}}&\\quad &\\in \\left\\{0, 1\\right\\}\\\\&&&\\text{\\texttt{save\\_{}in\\_{}ommx=True}}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Scalar\", sense=MINIMIZE, objective=0, constraints=[])" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 取りうる値がスカラーである式(例: バイナリ変数の和)\n", + "problem = jm.Problem(\"Scalar\")\n", + "x = problem.BinaryVar(\"x\", shape=(5,))\n", + "S = problem.NamedExpr(\"scalar\", x.sum(), save_in_ommx=True)\n", + "problem" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "f7b3b6f6", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:43.912811Z", + "iopub.status.busy": "2026-03-24T02:04:43.912747Z", + "iopub.status.idle": "2026-03-24T02:04:44.067702Z", + "shell.execute_reply": "2026-03-24T02:04:44.067275Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Tensor of Scalars}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}y&\\in \\mathop{\\mathrm{Array}}\\left[5;\\mathbb{Z}\\right]\\;\\left(0\\leq {y}_{i}\\leq 10\\right)&\\quad &1\\text{-dim integer variable}\\\\z&\\in \\mathop{\\mathrm{Array}}\\left[5;\\mathbb{Z}\\right]\\;\\left(0\\leq {z}_{i}\\leq 10\\right)&\\quad &1\\text{-dim integer variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}tensor\\_{}of\\_{}scalars&=y-z&\\quad &\\in \\mathop{\\mathrm{Array}}\\left[5;\\mathbb{Z}\\right]\\\\&&&\\text{\\texttt{save\\_{}in\\_{}ommx=True}}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Tensor of Scalars\", sense=MINIMIZE, objective=0, constraints=[])" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 取りうる値がスカラーである式の配列(例: 整数変数の配列の差)\n", + "problem = jm.Problem(\"Tensor of Scalars\")\n", + "y = problem.IntegerVar(\"y\", shape=(5,), lower_bound=0, upper_bound=10)\n", + "z = problem.IntegerVar(\"z\", shape=(5,), lower_bound=0, upper_bound=10)\n", + "T = problem.NamedExpr(\"tensor_of_scalars\", y - z, save_in_ommx=True)\n", + "problem" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "de572788", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.068809Z", + "iopub.status.busy": "2026-03-24T02:04:44.068747Z", + "iopub.status.idle": "2026-03-24T02:04:44.182892Z", + "shell.execute_reply": "2026-03-24T02:04:44.182488Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Dict of Scalars}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}w&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{K};\\mathbb{R}\\right]\\;\\left(0\\leq {w}_{i}\\leq 10\\right)&\\quad &\\text{a dictionary of }\\text{continuous}\\text{ variables with key }K\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{K};\\mathbb{R}\\right]&\\quad &\\text{A total dictionary of placeholders with keys }\\mathrm{K}\\text{, values in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Category Labels:}\\\\&\\qquad \\begin{array}{rl}\n", + "K&\\text{Category Label}\\end{array}\n", + "\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}dict\\_{}of\\_{}scalars&=a\\cdot w&\\quad &\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{K};\\mathbb{R}\\right]\\\\&&&\\text{\\texttt{save\\_{}in\\_{}ommx=True}}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Dict of Scalars\", sense=MINIMIZE, objective=0, constraints=[])" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 取りうる値がスカラーである式の辞書(例: プレースホルダと実数変数の辞書の積)\n", + "problem = jm.Problem(\"Dict of Scalars\")\n", + "K = problem.CategoryLabel(\"K\")\n", + "a = problem.Float(\"a\", dict_keys=K)\n", + "w = problem.ContinuousVar(\"w\", dict_keys=K, lower_bound=0, upper_bound=10)\n", + "U = problem.NamedExpr(\"dict_of_scalars\", a * w, save_in_ommx=True)\n", + "problem" + ] + }, + { + "cell_type": "markdown", + "id": "d5304b1d", + "metadata": {}, + "source": [ + "一方で、以下のような式は OMMX インスタンスに保存できません。" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "e269beca", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.185843Z", + "iopub.status.busy": "2026-03-24T02:04:44.185711Z", + "iopub.status.idle": "2026-03-24T02:04:44.193369Z", + "shell.execute_reply": "2026-03-24T02:04:44.193003Z" + } + }, + "outputs": [], + "source": [ + "problem = jm.Problem(\"Errornous Problem\")" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "0e6ecc43", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.194486Z", + "iopub.status.busy": "2026-03-24T02:04:44.194424Z", + "iopub.status.idle": "2026-03-24T02:04:44.217104Z", + "shell.execute_reply": "2026-03-24T02:04:44.216777Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Named expression `comparison' has type `Comparison[int!, int!]' which cannot be stored as an OMMX NamedFunction (only scalar, tensor-of-scalars, and dict-of-scalars are supported)\n" + ] + } + ], + "source": [ + "# 比較式は保存できない\n", + "a = problem.IntegerVar(\"a\", lower_bound=0, upper_bound=10)\n", + "try:\n", + " problem.NamedExpr(\"comparison\", a == 2, save_in_ommx=True)\n", + "except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "54225607", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.218549Z", + "iopub.status.busy": "2026-03-24T02:04:44.218465Z", + "iopub.status.idle": "2026-03-24T02:04:44.234275Z", + "shell.execute_reply": "2026-03-24T02:04:44.233610Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Named expression `category_labels' has type `Set[CategoryLabel(\"L\")]' which cannot be stored as an OMMX NamedFunction (only scalar, tensor-of-scalars, and dict-of-scalars are supported)\n" + ] + } + ], + "source": [ + "# カテゴリラベルは保存できない\n", + "L = problem.CategoryLabel(\"L\")\n", + "try:\n", + " problem.NamedExpr(\"category_labels\", L, save_in_ommx=True)\n", + "except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "6b752e2b", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.236620Z", + "iopub.status.busy": "2026-03-24T02:04:44.236540Z", + "iopub.status.idle": "2026-03-24T02:04:44.260785Z", + "shell.execute_reply": "2026-03-24T02:04:44.260296Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Named expression `array_of_array' has type `Array[5; Array[5; binary!]]' which cannot be stored as an OMMX NamedFunction (only scalar, tensor-of-scalars, and dict-of-scalars are supported)\n" + ] + } + ], + "source": [ + "# rows() は配列の配列を返すので保存できない\n", + "x = problem.BinaryVar(\"M\", shape=(5, 5))\n", + "try:\n", + " problem.NamedExpr(\"array_of_array\", x.rows(), save_in_ommx=True)\n", + "except Exception as e:\n", + " print(e)" + ] + }, + { + "cell_type": "markdown", + "id": "3bf31df5", + "metadata": {}, + "source": [ + ":::{tip}\n", + "これらの OMMX インスタンスに保存できない式についても、 `save_in_ommx=False`(あるいは、未指定)にすれば `NamedExpr` として宣言することができます。 \n", + ":::" + ] + }, + { + "cell_type": "markdown", + "id": "24618a29", + "metadata": {}, + "source": [ + "では、特定の式を OMMX インスタンスに保存して求解後にその式の値を評価する例を見てみましょう。ナップサック問題において、目的関数であるアイテムの価値の合計だけでなく、アイテムの総重量を知りたいというケースを考えます。" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "defa81a9", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.262455Z", + "iopub.status.busy": "2026-03-24T02:04:44.262374Z", + "iopub.status.idle": "2026-03-24T02:04:44.523826Z", + "shell.execute_reply": "2026-03-24T02:04:44.523286Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\begin{array}{rl}\n", + "\\text{Problem}\\colon &\\text{Knapsack}\\\\\\displaystyle \\max &\\displaystyle \\sum _{i=0}^{N-1}{{v}_{i}\\cdot {x}_{i}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", + "\\text{Weight}&\\quad \\displaystyle total\\_{}weight\\leq W\\end{aligned}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\&&&\\text{$x_i = 1$ if item i is put in the knapsack}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[N;\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{value of each item}\\\\&&&\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\&&&\\text{maximum weight capacity of the knapsack}\\\\&&&\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\&&&\\text{weight of each item}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N},\\text{Length of w}\\\\&&&\\\\total\\_{}weight&=\\sum _{i=0}^{N-1}{{w}_{i}\\cdot {x}_{i}}&\\quad &\\in \\mathbb{R},\\text{Total weight of items in the knapsack}\\\\&&&\\text{\\texttt{save\\_{}in\\_{}ommx=True}}\\\\\\end{alignedat}\\end{array}\n", + "$$" + ], + "text/plain": [ + "Problem(name=\"Knapsack\", sense=MAXIMIZE, objective=sum(N.map(lambda (i: natural): v[i] * x[i])), constraints={Weight: [Constraint(name=\"Weight\", sense=LESS_THAN_EQUAL, left=total_weight, right=W, shape=Scalar(Float)),],})" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "@jm.Problem.define(\"Knapsack\", sense=jm.ProblemSense.MAXIMIZE)\n", + "def knapsack_weight(problem: jm.DecoratedProblem):\n", + " W = problem.Float(description=\"maximum weight capacity of the knapsack\")\n", + " w = problem.Float(ndim=1, description=\"weight of each item\")\n", + " N = problem.NamedExpr(w.len_at(0), description=\"Length of w\")\n", + " v = problem.Float(shape=(N,), description=\"value of each item\")\n", + " x = problem.BinaryVar(\n", + " shape=(N,), description=\"$x_i = 1$ if item i is put in the knapsack\"\n", + " )\n", + " total_weight = problem.NamedExpr(\n", + " jm.sum(w[i] * x[i] for i in N),\n", + " description=\"Total weight of items in the knapsack\",\n", + " save_in_ommx=True,\n", + " )\n", + "\n", + " problem += jm.sum(v[i] * x[i] for i in N)\n", + " problem += problem.Constraint(\"Weight\", total_weight <= W)\n", + "\n", + "\n", + "knapsack_weight" + ] + }, + { + "cell_type": "markdown", + "id": "6704c1ac", + "metadata": {}, + "source": [ + "上記のコードでは、総重量の式に `total_weight` という名前をつけ、`save_in_ommx=True` により OMMX インスタンスの保存を有効にしています。さて、この数理モデルをコンパイルして OMMX インスタンスを生成してみましょう。" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "9c8d7f15", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.525216Z", + "iopub.status.busy": "2026-03-24T02:04:44.525127Z", + "iopub.status.idle": "2026-03-24T02:04:44.907968Z", + "shell.execute_reply": "2026-03-24T02:04:44.906899Z" + } + }, + "outputs": [], + "source": [ + "instance = knapsack_weight.eval(knapsack_instance_data)" + ] + }, + { + "cell_type": "markdown", + "id": "87b94eda", + "metadata": {}, + "source": [ + "OMMX インスタンスに保存された式は、 {py:meth}`ommx.v1.Instance.named_functions` や {py:meth}`ommx.v1.Instance.named_functions_df` プロパティで確認することができます。" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "19f45fef", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.909993Z", + "iopub.status.busy": "2026-03-24T02:04:44.909890Z", + "iopub.status.idle": "2026-03-24T02:04:44.921316Z", + "shell.execute_reply": "2026-03-24T02:04:44.920680Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
typefunctionused_idsnamesubscriptsdescriptionparameters.subscripts
id
0LinearFunction(11*x0 + 15*x1 + 20*x2 + 35*x3 + 10*x4...{0, 1, 2, 3, 4, 5}total_weight[]Total weight of items in the knapsack[]
\n", + "
" + ], + "text/plain": [ + " type function \\\n", + "id \n", + "0 Linear Function(11*x0 + 15*x1 + 20*x2 + 35*x3 + 10*x4... \n", + "\n", + " used_ids name subscripts \\\n", + "id \n", + "0 {0, 1, 2, 3, 4, 5} total_weight [] \n", + "\n", + " description parameters.subscripts \n", + "id \n", + "0 Total weight of items in the knapsack [] " + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "instance.named_functions_df" + ] + }, + { + "cell_type": "markdown", + "id": "cd6d1c6e", + "metadata": {}, + "source": [ + ":::{tip}\n", + "OMMX インスタンスに保存された式に対応する NamedFunction の ID を得るには、{py:meth}`Compiler.get_named_function_id_by_name() ` メソッドを利用してください。\n", + ":::" + ] + }, + { + "cell_type": "markdown", + "id": "13fa58c6", + "metadata": {}, + "source": [ + "それでは、この OMMX インスタンスを OpenJij で解き、得られた解における `total_weight` の値を確認してみましょう。" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "f78cf116", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:44.922518Z", + "iopub.status.busy": "2026-03-24T02:04:44.922450Z", + "iopub.status.idle": "2026-03-24T02:04:45.521929Z", + "shell.execute_reply": "2026-03-24T02:04:45.521624Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
valueused_idsnamesubscriptsdescriptionparameters.subscripts
id
046.0{0, 1, 2, 3, 4, 5}total_weight[]Total weight of items in the knapsack[]
\n", + "
" + ], + "text/plain": [ + " value used_ids name subscripts \\\n", + "id \n", + "0 46.0 {0, 1, 2, 3, 4, 5} total_weight [] \n", + "\n", + " description parameters.subscripts \n", + "id \n", + "0 Total weight of items in the knapsack [] " + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from ommx_openjij_adapter import OMMXOpenJijSAAdapter\n", + "\n", + "solution = OMMXOpenJijSAAdapter.solve(\n", + " instance,\n", + " num_reads=100,\n", + " num_sweeps=10,\n", + " uniform_penalty_weight=1.6,\n", + ")\n", + "\n", + "solution.named_functions_df" + ] + }, + { + "cell_type": "markdown", + "id": "8ea878e2", + "metadata": {}, + "source": [ + "確かに OMMX インスタンスに保存した式 `total_weight` の値を評価することができました。\n", + "このような用法以外にも、特定の式を OMMX インスタンスに保存する機能は、加重方式の多目的最適化を扱う場合などに利用できる便利なものとなっています。" + ] + } + ], + "metadata": { + "jupytext": { + "default_lexer": "ipython3" + }, + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/ja/advanced/serialize.ipynb b/docs/ja/advanced/serialize.ipynb new file mode 100644 index 00000000..c889da90 --- /dev/null +++ b/docs/ja/advanced/serialize.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "4c9e7601-a3f2-496b-88a0-88e76bd18e7c", + "metadata": {}, + "source": [ + "# 数理モデルのシリアライズ\n", + "\n", + "JijModeling で作られた数理モデルは、[Protobuf](https://protobuf.dev) で簡単にシリアライズできます。具体的には、{py:func}`jijmodeling.to_protobuf`関数か`Problem.to_protobuf `メソッドを使えばシリアライズできます。" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "b5807c3d-8bd3-4d3e-92bd-6cfa802cd625", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:46.910294Z", + "iopub.status.busy": "2026-03-24T02:04:46.910240Z", + "iopub.status.idle": "2026-03-24T02:04:46.952123Z", + "shell.execute_reply": "2026-03-24T02:04:46.951739Z" + } + }, + "outputs": [], + "source": [ + "import jijmodeling as jm\n", + "\n", + "problem = jm.Problem(\"my problem\")\n", + "N = problem.Placeholder(\"N\", dtype=jm.DataType.NATURAL)\n", + "x = problem.BinaryVar(\"x\", shape=(N,))\n", + "problem += x.sum()\n", + "\n", + "serialized = problem.to_protobuf()" + ] + }, + { + "cell_type": "markdown", + "id": "cd5e556f-94d3-4d72-a088-eb86bc0d01f2", + "metadata": {}, + "source": [ + "デシリアライズは、{py:func}`jijmodeling.from_protobuf` か{py:meth}`Problem.from_protobuf `で行えます。" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "fb7345c2-2252-4c3a-ae46-9e6318a4fa9a", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:46.953331Z", + "iopub.status.busy": "2026-03-24T02:04:46.953275Z", + "iopub.status.idle": "2026-03-24T02:04:46.958699Z", + "shell.execute_reply": "2026-03-24T02:04:46.958422Z" + } + }, + "outputs": [], + "source": [ + "deserialized = jm.from_protobuf(serialized)" + ] + } + ], + "metadata": { + "jupytext": { + "default_lexer": "ipython3" + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/ja/basics/expressions.ipynb b/docs/ja/basics/expressions.ipynb index 8b75ef06..3d02d8d3 100644 --- a/docs/ja/basics/expressions.ipynb +++ b/docs/ja/basics/expressions.ipynb @@ -25,10 +25,10 @@ "id": "a065d0ee", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:14.644892Z", - "iopub.status.busy": "2026-02-26T05:59:14.644844Z", - "iopub.status.idle": "2026-02-26T05:59:14.649691Z", - "shell.execute_reply": "2026-02-26T05:59:14.649388Z" + "iopub.execute_input": "2026-03-24T02:04:31.021717Z", + "iopub.status.busy": "2026-03-24T02:04:31.021117Z", + "iopub.status.idle": "2026-03-24T02:04:31.087860Z", + "shell.execute_reply": "2026-03-24T02:04:31.085039Z" } }, "outputs": [], @@ -57,10 +57,10 @@ "id": "beaddc39", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:14.650758Z", - "iopub.status.busy": "2026-02-26T05:59:14.650706Z", - "iopub.status.idle": "2026-02-26T05:59:14.727719Z", - "shell.execute_reply": "2026-02-26T05:59:14.725811Z" + "iopub.execute_input": "2026-03-24T02:04:31.204323Z", + "iopub.status.busy": "2026-03-24T02:04:31.204108Z", + "iopub.status.idle": "2026-03-24T02:04:31.456503Z", + "shell.execute_reply": "2026-03-24T02:04:31.454952Z" }, "label": "test-problem" }, @@ -177,10 +177,10 @@ "id": "e73538ae", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:14.730366Z", - "iopub.status.busy": "2026-02-26T05:59:14.730297Z", - "iopub.status.idle": "2026-02-26T05:59:14.749387Z", - "shell.execute_reply": "2026-02-26T05:59:14.748411Z" + "iopub.execute_input": "2026-03-24T02:04:31.459948Z", + "iopub.status.busy": "2026-03-24T02:04:31.459712Z", + "iopub.status.idle": "2026-03-24T02:04:31.493888Z", + "shell.execute_reply": "2026-03-24T02:04:31.492863Z" } }, "outputs": [ @@ -220,10 +220,10 @@ "id": "b525d6c0", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:14.751338Z", - "iopub.status.busy": "2026-02-26T05:59:14.751279Z", - "iopub.status.idle": "2026-02-26T05:59:14.765764Z", - "shell.execute_reply": "2026-02-26T05:59:14.764420Z" + "iopub.execute_input": "2026-03-24T02:04:31.496510Z", + "iopub.status.busy": "2026-03-24T02:04:31.496297Z", + "iopub.status.idle": "2026-03-24T02:04:31.510912Z", + "shell.execute_reply": "2026-03-24T02:04:31.510357Z" } }, "outputs": [ @@ -233,13 +233,13 @@ "text": [ "Traceback (most recent last):\n", " while inferring the type of expression `x + Located { inner: \"hoge\", src_span: NoSrcSpan }',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/2391251849.py\", line 3, col 19-29\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/2391251849.py\", line 3, col 19-29\n", " while inferring the type of expression `x + Located { inner: \"hoge\", src_span: NoSrcSpan }',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/2391251849.py\", line 3, col 19-29\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/2391251849.py\", line 3, col 19-29\n", " while checking if types `binary!' and `Literal[\"hoge\"]' can be combined with numeric operator `Add',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/2391251849.py\", line 3, col 19-29\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/2391251849.py\", line 3, col 19-29\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/2391251849.py\", line 3, col 19-29:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/2391251849.py\", line 3, col 19-29:\n", "\n", " 3 | problem.infer(x + \"hoge\")\n", " ^^^^^^^^^^\n", @@ -270,7 +270,7 @@ "\n", "| 型名 | 説明 |\n", "| --- | --- |\n", - "| `ExpressionLike` | {py:class}`~jijmodeling.Expression` に変換することができる型を表す。 {py:class}`~jijmodeling.Expression` 自身の他、{py:class}`~jijmodeling.Placeholder`, {py:class}`~jijmodeling.DecisionVar`, {py:class}`~jijmodeling.DependentVar`や、Python の数値、文字列、それらからなるタプル、リスト・辞書・Numpy配列などが文脈に応じて使えます。 |\n", + "| `ExpressionLike` | {py:class}`~jijmodeling.Expression` に変換することができる型を表す。 {py:class}`~jijmodeling.Expression` 自身の他、{py:class}`~jijmodeling.Placeholder`, {py:class}`~jijmodeling.DecisionVar`, {py:class}`~jijmodeling.NamedExpr`や、Python の数値、文字列、それらからなるタプル、リスト・辞書・Numpy配列などが文脈に応じて使えます。 |\n", "| `ExpressoinFunction` | 一つ以上の {py:class}`~jijmodeling.Expression` オブジェクトを取り、 {py:class}`~jijmodeling.Expression` を返す関数。Pythonの型ヒントの仕組み上、最大5つの引数までしか列挙していませんが、実際には引数の個数に上限はありません。 |\n", "\n", ":::\n", @@ -312,10 +312,10 @@ "id": "5de5e593", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:14.768366Z", - "iopub.status.busy": "2026-02-26T05:59:14.768195Z", - "iopub.status.idle": "2026-02-26T05:59:15.015045Z", - "shell.execute_reply": "2026-02-26T05:59:15.014696Z" + "iopub.execute_input": "2026-03-24T02:04:31.513259Z", + "iopub.status.busy": "2026-03-24T02:04:31.512999Z", + "iopub.status.idle": "2026-03-24T02:04:31.831159Z", + "shell.execute_reply": "2026-03-24T02:04:31.830325Z" } }, "outputs": [ @@ -371,10 +371,10 @@ "id": "3aa8e74d", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.016133Z", - "iopub.status.busy": "2026-02-26T05:59:15.016049Z", - "iopub.status.idle": "2026-02-26T05:59:15.024568Z", - "shell.execute_reply": "2026-02-26T05:59:15.024216Z" + "iopub.execute_input": "2026-03-24T02:04:31.833669Z", + "iopub.status.busy": "2026-03-24T02:04:31.833435Z", + "iopub.status.idle": "2026-03-24T02:04:31.843551Z", + "shell.execute_reply": "2026-03-24T02:04:31.843202Z" } }, "outputs": [ @@ -402,10 +402,10 @@ "id": "f7348dfe", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.025482Z", - "iopub.status.busy": "2026-02-26T05:59:15.025423Z", - "iopub.status.idle": "2026-02-26T05:59:15.046322Z", - "shell.execute_reply": "2026-02-26T05:59:15.046024Z" + "iopub.execute_input": "2026-03-24T02:04:31.844709Z", + "iopub.status.busy": "2026-03-24T02:04:31.844654Z", + "iopub.status.idle": "2026-03-24T02:04:31.874483Z", + "shell.execute_reply": "2026-03-24T02:04:31.874088Z" } }, "outputs": [ @@ -433,10 +433,10 @@ "id": "200cbd4b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.047218Z", - "iopub.status.busy": "2026-02-26T05:59:15.047162Z", - "iopub.status.idle": "2026-02-26T05:59:15.062273Z", - "shell.execute_reply": "2026-02-26T05:59:15.061986Z" + "iopub.execute_input": "2026-03-24T02:04:31.875609Z", + "iopub.status.busy": "2026-03-24T02:04:31.875546Z", + "iopub.status.idle": "2026-03-24T02:04:31.894764Z", + "shell.execute_reply": "2026-03-24T02:04:31.894331Z" } }, "outputs": [ @@ -464,10 +464,10 @@ "id": "e9405fa6", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.063174Z", - "iopub.status.busy": "2026-02-26T05:59:15.063127Z", - "iopub.status.idle": "2026-02-26T05:59:15.084061Z", - "shell.execute_reply": "2026-02-26T05:59:15.083795Z" + "iopub.execute_input": "2026-03-24T02:04:31.895944Z", + "iopub.status.busy": "2026-03-24T02:04:31.895852Z", + "iopub.status.idle": "2026-03-24T02:04:31.923431Z", + "shell.execute_reply": "2026-03-24T02:04:31.923081Z" } }, "outputs": [ @@ -495,10 +495,10 @@ "id": "1dff7e02", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.085078Z", - "iopub.status.busy": "2026-02-26T05:59:15.085031Z", - "iopub.status.idle": "2026-02-26T05:59:15.099437Z", - "shell.execute_reply": "2026-02-26T05:59:15.099120Z" + "iopub.execute_input": "2026-03-24T02:04:31.924550Z", + "iopub.status.busy": "2026-03-24T02:04:31.924469Z", + "iopub.status.idle": "2026-03-24T02:04:31.944181Z", + "shell.execute_reply": "2026-03-24T02:04:31.943471Z" } }, "outputs": [ @@ -534,10 +534,10 @@ "id": "7a5b888f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.100325Z", - "iopub.status.busy": "2026-02-26T05:59:15.100268Z", - "iopub.status.idle": "2026-02-26T05:59:15.108132Z", - "shell.execute_reply": "2026-02-26T05:59:15.107892Z" + "iopub.execute_input": "2026-03-24T02:04:31.949457Z", + "iopub.status.busy": "2026-03-24T02:04:31.949222Z", + "iopub.status.idle": "2026-03-24T02:04:31.964785Z", + "shell.execute_reply": "2026-03-24T02:04:31.963941Z" } }, "outputs": [ @@ -547,13 +547,13 @@ "text": [ "Traceback (most recent last):\n", " while inferring the type of expression `S * y',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/3719066850.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/3719066850.py\", line 3, col 19-24\n", " while inferring the type of expression `S * y',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/3719066850.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/3719066850.py\", line 3, col 19-24\n", " while checking if types `TotalDict[N; float]' and `Array[N, M; int!]' can be combined with numeric operator `Mul',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/3719066850.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/3719066850.py\", line 3, col 19-24\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/3719066850.py\", line 3, col 19-24:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/3719066850.py\", line 3, col 19-24:\n", "\n", " 3 | problem.infer(S * y)\n", " ^^^^^\n", @@ -576,10 +576,10 @@ "id": "7bf01863", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.108959Z", - "iopub.status.busy": "2026-02-26T05:59:15.108910Z", - "iopub.status.idle": "2026-02-26T05:59:15.116506Z", - "shell.execute_reply": "2026-02-26T05:59:15.116257Z" + "iopub.execute_input": "2026-03-24T02:04:31.966503Z", + "iopub.status.busy": "2026-03-24T02:04:31.966416Z", + "iopub.status.idle": "2026-03-24T02:04:31.978720Z", + "shell.execute_reply": "2026-03-24T02:04:31.977829Z" } }, "outputs": [ @@ -589,13 +589,13 @@ "text": [ "Traceback (most recent last):\n", " while inferring the type of expression `y + z',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/3550267328.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/3550267328.py\", line 3, col 19-24\n", " while inferring the type of expression `y + z',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/3550267328.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/3550267328.py\", line 3, col 19-24\n", " while checking if types `Array[N, M; int!]' and `Array[N, M, N; float!]' can be combined with numeric operator `Add',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/3550267328.py\", line 3, col 19-24\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/3550267328.py\", line 3, col 19-24\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_22956/3550267328.py\", line 3, col 19-24:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_45473/3550267328.py\", line 3, col 19-24:\n", "\n", " 3 | problem.infer(y + z)\n", " ^^^^^\n", @@ -651,10 +651,10 @@ "id": "19d6caee", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.117398Z", - "iopub.status.busy": "2026-02-26T05:59:15.117354Z", - "iopub.status.idle": "2026-02-26T05:59:15.137919Z", - "shell.execute_reply": "2026-02-26T05:59:15.137622Z" + "iopub.execute_input": "2026-03-24T02:04:31.980904Z", + "iopub.status.busy": "2026-03-24T02:04:31.980793Z", + "iopub.status.idle": "2026-03-24T02:04:32.009101Z", + "shell.execute_reply": "2026-03-24T02:04:32.008669Z" } }, "outputs": [ @@ -682,10 +682,10 @@ "id": "0829b0d0", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.138853Z", - "iopub.status.busy": "2026-02-26T05:59:15.138800Z", - "iopub.status.idle": "2026-02-26T05:59:15.146942Z", - "shell.execute_reply": "2026-02-26T05:59:15.146630Z" + "iopub.execute_input": "2026-03-24T02:04:32.010430Z", + "iopub.status.busy": "2026-03-24T02:04:32.010366Z", + "iopub.status.idle": "2026-03-24T02:04:32.022376Z", + "shell.execute_reply": "2026-03-24T02:04:32.021783Z" } }, "outputs": [ @@ -713,10 +713,10 @@ "id": "98865e29", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.147781Z", - "iopub.status.busy": "2026-02-26T05:59:15.147734Z", - "iopub.status.idle": "2026-02-26T05:59:15.181363Z", - "shell.execute_reply": "2026-02-26T05:59:15.181019Z" + "iopub.execute_input": "2026-03-24T02:04:32.023477Z", + "iopub.status.busy": "2026-03-24T02:04:32.023417Z", + "iopub.status.idle": "2026-03-24T02:04:32.063664Z", + "shell.execute_reply": "2026-03-24T02:04:32.063191Z" } }, "outputs": [ @@ -778,10 +778,10 @@ "id": "6e97e0ff", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.182232Z", - "iopub.status.busy": "2026-02-26T05:59:15.182183Z", - "iopub.status.idle": "2026-02-26T05:59:15.238781Z", - "shell.execute_reply": "2026-02-26T05:59:15.238449Z" + "iopub.execute_input": "2026-03-24T02:04:32.064961Z", + "iopub.status.busy": "2026-03-24T02:04:32.064902Z", + "iopub.status.idle": "2026-03-24T02:04:32.135412Z", + "shell.execute_reply": "2026-03-24T02:04:32.134755Z" } }, "outputs": [ @@ -833,6 +833,7 @@ ":::\n", "\n", "一部の型の値は自動的に集合へと変換されます。たとえば、多次元配列は、要素を行優先順で走査する集合に、自然数$N$は集合 $\\{0, 1, \\ldots, N-1\\}$ に、カテゴリーラベル `L` はコンパイル時に与えられる`L`の値全体の集合へと自動的に変換されます。\n", + "また、JijModeling 2.3.1 から Python 組込みの {py:class}`range() ` 関数に対応する、{py:func}`jijmodeling.range` 関数も提供されており、自然数の等差数列からなる集合を定義することができます。\n", "\n", ":::{admonition} JijModeling 1 系統からの変更点:配列の「集合」としての振る舞い\n", ":class: caution\n", @@ -874,10 +875,10 @@ "id": "17eb39a1", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.239766Z", - "iopub.status.busy": "2026-02-26T05:59:15.239714Z", - "iopub.status.idle": "2026-02-26T05:59:15.310635Z", - "shell.execute_reply": "2026-02-26T05:59:15.310311Z" + "iopub.execute_input": "2026-03-24T02:04:32.136689Z", + "iopub.status.busy": "2026-03-24T02:04:32.136610Z", + "iopub.status.idle": "2026-03-24T02:04:32.225585Z", + "shell.execute_reply": "2026-03-24T02:04:32.225253Z" } }, "outputs": [ @@ -928,10 +929,10 @@ "id": "dffc0a7b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.311644Z", - "iopub.status.busy": "2026-02-26T05:59:15.311592Z", - "iopub.status.idle": "2026-02-26T05:59:15.328806Z", - "shell.execute_reply": "2026-02-26T05:59:15.328506Z" + "iopub.execute_input": "2026-03-24T02:04:32.226702Z", + "iopub.status.busy": "2026-03-24T02:04:32.226644Z", + "iopub.status.idle": "2026-03-24T02:04:32.247109Z", + "shell.execute_reply": "2026-03-24T02:04:32.246635Z" } }, "outputs": [ @@ -971,10 +972,10 @@ "id": "15434b93", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.329785Z", - "iopub.status.busy": "2026-02-26T05:59:15.329730Z", - "iopub.status.idle": "2026-02-26T05:59:15.396489Z", - "shell.execute_reply": "2026-02-26T05:59:15.396131Z" + "iopub.execute_input": "2026-03-24T02:04:32.248315Z", + "iopub.status.busy": "2026-03-24T02:04:32.248250Z", + "iopub.status.idle": "2026-03-24T02:04:32.326263Z", + "shell.execute_reply": "2026-03-24T02:04:32.325891Z" } }, "outputs": [ @@ -1018,10 +1019,10 @@ "id": "0112b897", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.397480Z", - "iopub.status.busy": "2026-02-26T05:59:15.397427Z", - "iopub.status.idle": "2026-02-26T05:59:15.465234Z", - "shell.execute_reply": "2026-02-26T05:59:15.464876Z" + "iopub.execute_input": "2026-03-24T02:04:32.327381Z", + "iopub.status.busy": "2026-03-24T02:04:32.327327Z", + "iopub.status.idle": "2026-03-24T02:04:32.407739Z", + "shell.execute_reply": "2026-03-24T02:04:32.407284Z" } }, "outputs": [ @@ -1073,10 +1074,10 @@ "id": "84a0a84c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.466131Z", - "iopub.status.busy": "2026-02-26T05:59:15.466080Z", - "iopub.status.idle": "2026-02-26T05:59:15.564243Z", - "shell.execute_reply": "2026-02-26T05:59:15.563847Z" + "iopub.execute_input": "2026-03-24T02:04:32.409030Z", + "iopub.status.busy": "2026-03-24T02:04:32.408972Z", + "iopub.status.idle": "2026-03-24T02:04:32.537563Z", + "shell.execute_reply": "2026-03-24T02:04:32.536101Z" } }, "outputs": [ @@ -1122,10 +1123,10 @@ "id": "1e520da7", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.565285Z", - "iopub.status.busy": "2026-02-26T05:59:15.565226Z", - "iopub.status.idle": "2026-02-26T05:59:15.654120Z", - "shell.execute_reply": "2026-02-26T05:59:15.653731Z" + "iopub.execute_input": "2026-03-24T02:04:32.540122Z", + "iopub.status.busy": "2026-03-24T02:04:32.539880Z", + "iopub.status.idle": "2026-03-24T02:04:32.789053Z", + "shell.execute_reply": "2026-03-24T02:04:32.785953Z" } }, "outputs": [ @@ -1174,10 +1175,10 @@ "id": "28b8bad3", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.655001Z", - "iopub.status.busy": "2026-02-26T05:59:15.654945Z", - "iopub.status.idle": "2026-02-26T05:59:15.760369Z", - "shell.execute_reply": "2026-02-26T05:59:15.760073Z" + "iopub.execute_input": "2026-03-24T02:04:32.794215Z", + "iopub.status.busy": "2026-03-24T02:04:32.793767Z", + "iopub.status.idle": "2026-03-24T02:04:33.220395Z", + "shell.execute_reply": "2026-03-24T02:04:33.219529Z" } }, "outputs": [ @@ -1224,10 +1225,10 @@ "id": "385cb7b1", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.761437Z", - "iopub.status.busy": "2026-02-26T05:59:15.761385Z", - "iopub.status.idle": "2026-02-26T05:59:15.853406Z", - "shell.execute_reply": "2026-02-26T05:59:15.853088Z" + "iopub.execute_input": "2026-03-24T02:04:33.222404Z", + "iopub.status.busy": "2026-03-24T02:04:33.222261Z", + "iopub.status.idle": "2026-03-24T02:04:33.563555Z", + "shell.execute_reply": "2026-03-24T02:04:33.561832Z" } }, "outputs": [ @@ -1274,10 +1275,10 @@ "id": "3362f83d", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.854373Z", - "iopub.status.busy": "2026-02-26T05:59:15.854316Z", - "iopub.status.idle": "2026-02-26T05:59:15.985613Z", - "shell.execute_reply": "2026-02-26T05:59:15.985237Z" + "iopub.execute_input": "2026-03-24T02:04:33.580391Z", + "iopub.status.busy": "2026-03-24T02:04:33.580170Z", + "iopub.status.idle": "2026-03-24T02:04:34.019243Z", + "shell.execute_reply": "2026-03-24T02:04:34.018524Z" } }, "outputs": [ @@ -1329,10 +1330,10 @@ "id": "7c2e2ab9", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:15.986690Z", - "iopub.status.busy": "2026-02-26T05:59:15.986636Z", - "iopub.status.idle": "2026-02-26T05:59:16.094226Z", - "shell.execute_reply": "2026-02-26T05:59:16.093866Z" + "iopub.execute_input": "2026-03-24T02:04:34.021942Z", + "iopub.status.busy": "2026-03-24T02:04:34.021733Z", + "iopub.status.idle": "2026-03-24T02:04:34.275517Z", + "shell.execute_reply": "2026-03-24T02:04:34.274631Z" } }, "outputs": [ @@ -1379,10 +1380,10 @@ "id": "2027a720", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:16.095224Z", - "iopub.status.busy": "2026-02-26T05:59:16.095170Z", - "iopub.status.idle": "2026-02-26T05:59:16.162162Z", - "shell.execute_reply": "2026-02-26T05:59:16.161871Z" + "iopub.execute_input": "2026-03-24T02:04:34.278299Z", + "iopub.status.busy": "2026-03-24T02:04:34.277933Z", + "iopub.status.idle": "2026-03-24T02:04:34.368643Z", + "shell.execute_reply": "2026-03-24T02:04:34.367875Z" } }, "outputs": [ diff --git a/docs/ja/basics/instance_generation.ipynb b/docs/ja/basics/instance_generation.ipynb index a4eac55d..3184d81e 100644 --- a/docs/ja/basics/instance_generation.ipynb +++ b/docs/ja/basics/instance_generation.ipynb @@ -30,10 +30,10 @@ "id": "2fbc556e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:16.809460Z", - "iopub.status.busy": "2026-02-26T05:59:16.809406Z", - "iopub.status.idle": "2026-02-26T05:59:17.144732Z", - "shell.execute_reply": "2026-02-26T05:59:17.144357Z" + "iopub.execute_input": "2026-03-24T02:04:17.722025Z", + "iopub.status.busy": "2026-03-24T02:04:17.721838Z", + "iopub.status.idle": "2026-03-24T02:04:18.093380Z", + "shell.execute_reply": "2026-03-24T02:04:18.092879Z" } }, "outputs": [ @@ -109,10 +109,10 @@ "id": "df329286", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:17.145811Z", - "iopub.status.busy": "2026-02-26T05:59:17.145728Z", - "iopub.status.idle": "2026-02-26T05:59:17.147954Z", - "shell.execute_reply": "2026-02-26T05:59:17.147665Z" + "iopub.execute_input": "2026-03-24T02:04:18.094670Z", + "iopub.status.busy": "2026-03-24T02:04:18.094567Z", + "iopub.status.idle": "2026-03-24T02:04:18.096930Z", + "shell.execute_reply": "2026-03-24T02:04:18.096592Z" } }, "outputs": [], @@ -161,10 +161,10 @@ "id": "3688cb57", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:17.148944Z", - "iopub.status.busy": "2026-02-26T05:59:17.148885Z", - "iopub.status.idle": "2026-02-26T05:59:17.668041Z", - "shell.execute_reply": "2026-02-26T05:59:17.667657Z" + "iopub.execute_input": "2026-03-24T02:04:18.098095Z", + "iopub.status.busy": "2026-03-24T02:04:18.098029Z", + "iopub.status.idle": "2026-03-24T02:04:19.247847Z", + "shell.execute_reply": "2026-03-24T02:04:19.247578Z" } }, "outputs": [ @@ -246,10 +246,10 @@ "id": "6988c9e0", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:17.669081Z", - "iopub.status.busy": "2026-02-26T05:59:17.668997Z", - "iopub.status.idle": "2026-02-26T05:59:17.673563Z", - "shell.execute_reply": "2026-02-26T05:59:17.673223Z" + "iopub.execute_input": "2026-03-24T02:04:19.248932Z", + "iopub.status.busy": "2026-03-24T02:04:19.248836Z", + "iopub.status.idle": "2026-03-24T02:04:19.254342Z", + "shell.execute_reply": "2026-03-24T02:04:19.254093Z" } }, "outputs": [ @@ -453,10 +453,10 @@ "id": "ecc3b474", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:17.674449Z", - "iopub.status.busy": "2026-02-26T05:59:17.674398Z", - "iopub.status.idle": "2026-02-26T05:59:17.676071Z", - "shell.execute_reply": "2026-02-26T05:59:17.675785Z" + "iopub.execute_input": "2026-03-24T02:04:19.255357Z", + "iopub.status.busy": "2026-03-24T02:04:19.255305Z", + "iopub.status.idle": "2026-03-24T02:04:19.257207Z", + "shell.execute_reply": "2026-03-24T02:04:19.256957Z" } }, "outputs": [ @@ -489,10 +489,10 @@ "id": "fbfe4e07", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:17.676851Z", - "iopub.status.busy": "2026-02-26T05:59:17.676804Z", - "iopub.status.idle": "2026-02-26T05:59:18.037414Z", - "shell.execute_reply": "2026-02-26T05:59:18.036889Z" + "iopub.execute_input": "2026-03-24T02:04:19.258170Z", + "iopub.status.busy": "2026-03-24T02:04:19.258115Z", + "iopub.status.idle": "2026-03-24T02:04:19.633389Z", + "shell.execute_reply": "2026-03-24T02:04:19.632966Z" } }, "outputs": [], @@ -540,10 +540,10 @@ "id": "4cd5670d", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:18.038590Z", - "iopub.status.busy": "2026-02-26T05:59:18.038530Z", - "iopub.status.idle": "2026-02-26T05:59:18.059678Z", - "shell.execute_reply": "2026-02-26T05:59:18.059378Z" + "iopub.execute_input": "2026-03-24T02:04:19.634599Z", + "iopub.status.busy": "2026-03-24T02:04:19.634535Z", + "iopub.status.idle": "2026-03-24T02:04:19.657061Z", + "shell.execute_reply": "2026-03-24T02:04:19.656707Z" } }, "outputs": [ @@ -607,10 +607,10 @@ "id": "6695be16", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:18.060855Z", - "iopub.status.busy": "2026-02-26T05:59:18.060796Z", - "iopub.status.idle": "2026-02-26T05:59:18.132853Z", - "shell.execute_reply": "2026-02-26T05:59:18.132493Z" + "iopub.execute_input": "2026-03-24T02:04:19.658220Z", + "iopub.status.busy": "2026-03-24T02:04:19.658157Z", + "iopub.status.idle": "2026-03-24T02:04:19.759410Z", + "shell.execute_reply": "2026-03-24T02:04:19.759069Z" } }, "outputs": [ diff --git a/docs/ja/basics/modeling.ipynb b/docs/ja/basics/modeling.ipynb index 8b5370d0..4fb2d210 100644 --- a/docs/ja/basics/modeling.ipynb +++ b/docs/ja/basics/modeling.ipynb @@ -17,10 +17,10 @@ "id": "9fd7135f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:18.881255Z", - "iopub.status.busy": "2026-02-26T05:59:18.881097Z", - "iopub.status.idle": "2026-02-26T05:59:18.886586Z", - "shell.execute_reply": "2026-02-26T05:59:18.886098Z" + "iopub.execute_input": "2026-03-24T02:04:22.183004Z", + "iopub.status.busy": "2026-03-24T02:04:22.182943Z", + "iopub.status.idle": "2026-03-24T02:04:22.188766Z", + "shell.execute_reply": "2026-03-24T02:04:22.188482Z" } }, "outputs": [], @@ -53,10 +53,10 @@ "id": "4183f019", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:18.888255Z", - "iopub.status.busy": "2026-02-26T05:59:18.888172Z", - "iopub.status.idle": "2026-02-26T05:59:19.061055Z", - "shell.execute_reply": "2026-02-26T05:59:19.059668Z" + "iopub.execute_input": "2026-03-24T02:04:22.190098Z", + "iopub.status.busy": "2026-03-24T02:04:22.190042Z", + "iopub.status.idle": "2026-03-24T02:04:22.311617Z", + "shell.execute_reply": "2026-03-24T02:04:22.311221Z" } }, "outputs": [ @@ -115,10 +115,10 @@ "id": "742666cc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:19.063196Z", - "iopub.status.busy": "2026-02-26T05:59:19.062908Z", - "iopub.status.idle": "2026-02-26T05:59:19.091988Z", - "shell.execute_reply": "2026-02-26T05:59:19.090858Z" + "iopub.execute_input": "2026-03-24T02:04:22.312593Z", + "iopub.status.busy": "2026-03-24T02:04:22.312541Z", + "iopub.status.idle": "2026-03-24T02:04:22.337986Z", + "shell.execute_reply": "2026-03-24T02:04:22.337551Z" } }, "outputs": [ @@ -160,10 +160,10 @@ "id": "c0381225", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:19.100258Z", - "iopub.status.busy": "2026-02-26T05:59:19.099745Z", - "iopub.status.idle": "2026-02-26T05:59:19.122561Z", - "shell.execute_reply": "2026-02-26T05:59:19.122151Z" + "iopub.execute_input": "2026-03-24T02:04:22.339052Z", + "iopub.status.busy": "2026-03-24T02:04:22.338997Z", + "iopub.status.idle": "2026-03-24T02:04:22.360171Z", + "shell.execute_reply": "2026-03-24T02:04:22.359757Z" } }, "outputs": [ @@ -198,6 +198,12 @@ "既存の項が置き換えられたのではなく、$y$ が加算され $x + y$ が新たな目的関数となっていることが分かります。\n", "目的関数の項を削除したい場合、目的関数の項の一覧を(Python の)リストなどで持っておき、あとからそれを使って目的関数を設定するなどするとよいでしょう。\n", "\n", + ":::{admonition} 目的関数から項を「引く」操作\n", + ":class: tip\n", + "\n", + "JijModeling 2.3.1 以降では、{py:class}`~jijmodeling.Problem` に対して {py:meth}`-= ` 演算子を使うことで、数値型の {py:class}`~jijmodeling.Expression` オブジェクトを目的関数から「引く」こともできます。\n", + ":::\n", + "\n", "## 制約条件の設定\n", "\n", "制約条件の追加も同様に {py:meth}`+= ` 演算子を使って行います。\n", @@ -225,10 +231,10 @@ "id": "897c3ce3", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:19.123822Z", - "iopub.status.busy": "2026-02-26T05:59:19.123753Z", - "iopub.status.idle": "2026-02-26T05:59:19.233419Z", - "shell.execute_reply": "2026-02-26T05:59:19.233079Z" + "iopub.execute_input": "2026-03-24T02:04:22.361156Z", + "iopub.status.busy": "2026-03-24T02:04:22.361104Z", + "iopub.status.idle": "2026-03-24T02:04:22.480471Z", + "shell.execute_reply": "2026-03-24T02:04:22.480123Z" } }, "outputs": [ @@ -272,6 +278,12 @@ ":class: important\n", "\n", "制約条件を追加する際には、必ず {py:meth}`+= ` 演算子を使って追加してください。単純に {py:meth}`Problem.Constraint() ` を呼び出しただけでは、制約条件はモデルに追加されません。\n", + ":::\n", + "\n", + ":::{admonition} 制約条件の削除\n", + ":class: important\n", + "\n", + "現時点において、モデルから制約条件を削除する方法は提供されていません。特に、{py:func}`-= ` 演算子を使ってモデルから制約条件を「引く」ことはできませんので注意してください。\n", ":::" ] }, @@ -312,10 +324,10 @@ "id": "bcaea850", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:19.234521Z", - "iopub.status.busy": "2026-02-26T05:59:19.234461Z", - "iopub.status.idle": "2026-02-26T05:59:19.584190Z", - "shell.execute_reply": "2026-02-26T05:59:19.583844Z" + "iopub.execute_input": "2026-03-24T02:04:22.481601Z", + "iopub.status.busy": "2026-03-24T02:04:22.481541Z", + "iopub.status.idle": "2026-03-24T02:04:22.865508Z", + "shell.execute_reply": "2026-03-24T02:04:22.865057Z" } }, "outputs": [ @@ -324,7 +336,7 @@ "text/latex": [ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{TSP, Decorated}\\\\\\displaystyle \\min &\\displaystyle \\sum _{t=0}^{\\#C-1}{\\sum _{i\\in C}{\\sum _{j\\in C}{{d}_{i,j}\\cdot {x}_{t,i}\\cdot {x}_{\\left(t+1\\right)\\bmod \\#C,j}}}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", - "\\text{one city}&\\quad \\displaystyle \\sum _{i\\in C}{{x}_{t,i}}=1\\quad \\forall t\\;\\text{s.t.}\\;t\\in \\#C\\\\\\text{one time}&\\quad \\displaystyle \\sum _{t\\in \\#C}{{x}_{t,i}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in C\\end{aligned}\n", + "\\text{one city}&\\quad \\displaystyle \\sum _{i\\in C}{{x}_{t,i}}=1\\quad \\forall t\\;\\text{s.t.}\\;t\\in \\left\\{0,\\ldots ,\\#C-1\\right\\}\\\\\\text{one time}&\\quad \\displaystyle \\sum _{t=0}^{\\#C-1}{{x}_{t,i}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in C\\end{aligned}\n", "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\#C\\times C;\\left\\{0, 1\\right\\}\\right]&\\quad &\\text{a dictionary of }\\text{binary}\\text{ variables with key }\\#C\\times C\\\\&&&\\text{$x_{t,i} = 1$ if City $i$ is visited at time $t$}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}d&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{C}\\times \\mathrm{C};\\mathbb{R}\\right]&\\quad &\\text{A total dictionary of placeholders with keys }\\left(\\mathrm{C},\\mathrm{C}\\right)\\text{, values in }\\mathbb{R}\\\\&&&\\text{distance between cities}\\\\\\end{alignedat}\\\\&\\\\&\\text{Category Labels:}\\\\&\\qquad \\begin{array}{rl}\n", "C&\\text{Labels of Cities}\\end{array}\n", "\\end{array}\n", @@ -379,10 +391,10 @@ "id": "3824401e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:19.586068Z", - "iopub.status.busy": "2026-02-26T05:59:19.585972Z", - "iopub.status.idle": "2026-02-26T05:59:19.871509Z", - "shell.execute_reply": "2026-02-26T05:59:19.871210Z" + "iopub.execute_input": "2026-03-24T02:04:22.866574Z", + "iopub.status.busy": "2026-03-24T02:04:22.866516Z", + "iopub.status.idle": "2026-03-24T02:04:23.241303Z", + "shell.execute_reply": "2026-03-24T02:04:23.240727Z" } }, "outputs": [ @@ -391,7 +403,7 @@ "text/latex": [ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{TSP, Decorated}\\\\\\displaystyle \\min &\\displaystyle \\sum _{t=0}^{\\#C-1}{\\sum _{i\\in C}{\\sum _{j\\in C}{{d}_{i,j}\\cdot {x}_{t,i}\\cdot {x}_{\\left(t+1\\right)\\bmod \\#C,j}}}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", - "\\text{one city}&\\quad \\displaystyle \\sum _{i\\in C}{{x}_{t,i}}=1\\quad \\forall t\\;\\text{s.t.}\\;t\\in \\#C\\\\\\text{one time}&\\quad \\displaystyle \\sum _{t\\in \\#C}{{x}_{t,i}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in C\\end{aligned}\n", + "\\text{one city}&\\quad \\displaystyle \\sum _{i\\in C}{{x}_{t,i}}=1\\quad \\forall t\\;\\text{s.t.}\\;t\\in \\left\\{0,\\ldots ,\\#C-1\\right\\}\\\\\\text{one time}&\\quad \\displaystyle \\sum _{t=0}^{\\#C-1}{{x}_{t,i}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in C\\end{aligned}\n", "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\#C\\times C;\\left\\{0, 1\\right\\}\\right]&\\quad &\\text{a dictionary of }\\text{binary}\\text{ variables with key }\\#C\\times C\\\\&&&\\text{$x_{t,i} = 1$ if City $i$ is visited at time $t$}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}d&\\in \\mathop{\\mathrm{TotalDict}}\\left[\\mathrm{C}\\times \\mathrm{C};\\mathbb{R}\\right]&\\quad &\\text{A total dictionary of placeholders with keys }\\left(\\mathrm{C},\\mathrm{C}\\right)\\text{, values in }\\mathbb{R}\\\\&&&\\text{distance between cities}\\\\\\end{alignedat}\\\\&\\\\&\\text{Category Labels:}\\\\&\\qquad \\begin{array}{rl}\n", "C&\\text{Labels of Cities}\\end{array}\n", "\\end{array}\n", @@ -455,10 +467,10 @@ "id": "563e6dfe", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:19.872728Z", - "iopub.status.busy": "2026-02-26T05:59:19.872661Z", - "iopub.status.idle": "2026-02-26T05:59:20.088089Z", - "shell.execute_reply": "2026-02-26T05:59:20.087772Z" + "iopub.execute_input": "2026-03-24T02:04:23.243100Z", + "iopub.status.busy": "2026-03-24T02:04:23.242948Z", + "iopub.status.idle": "2026-03-24T02:04:23.759638Z", + "shell.execute_reply": "2026-03-24T02:04:23.758654Z" } }, "outputs": [ @@ -472,7 +484,7 @@ "$$" ], "text/plain": [ - "Problem(name=\"TSP, Decorated\", sense=MINIMIZE, objective=sum(N.flat_map(lambda (t: natural): N.map(lambda (i: natural): (t, i))).flat_map(lambda ((t, i): Tuple[natural, natural]): N.map(lambda (j: natural): (t, i, j))).map(lambda ((t, i, j): Tuple[natural, natural, natural]): d[i, j] * x[t, i] * x[(t + 1) % N, j])), constraints={one city: [Constraint(name=\"one city\", sense=EQUAL, left=x.sum(1), right=1, shape=TensorLikeVsScalar { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/1513282866.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/1513282866.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Binary }, src_span: NoSrcSpan } }), scalar: Binary }),],one time: [Constraint(name=\"one time\", sense=EQUAL, left=x.sum(0), right=1, shape=TensorLikeVsScalar { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/1513282866.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/1513282866.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Binary }, src_span: NoSrcSpan } }), scalar: Binary }),],})" + "Problem(name=\"TSP, Decorated\", sense=MINIMIZE, objective=sum(N.flat_map(lambda (t: natural): N.map(lambda (i: natural): (t, i))).flat_map(lambda ((t, i): Tuple[natural, natural]): N.map(lambda (j: natural): (t, i, j))).map(lambda ((t, i, j): Tuple[natural, natural, natural]): d[i, j] * x[t, i] * x[(t + 1) % N, j])), constraints={one city: [Constraint(name=\"one city\", sense=EQUAL, left=x.sum(1), right=1, shape=TensorLikeVsScalar { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/1513282866.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/1513282866.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Binary }, src_span: NoSrcSpan } }), scalar: Binary }),],one time: [Constraint(name=\"one time\", sense=EQUAL, left=x.sum(0), right=1, shape=TensorLikeVsScalar { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/1513282866.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/1513282866.py\", start: SrcLoc { line: 4, column: 8 }, end: SrcLoc { line: 6, column: 5 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Binary }, src_span: NoSrcSpan } }), scalar: Binary }),],})" ] }, "execution_count": 8, @@ -517,10 +529,10 @@ "id": "464f8394", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:20.089133Z", - "iopub.status.busy": "2026-02-26T05:59:20.089075Z", - "iopub.status.idle": "2026-02-26T05:59:20.101748Z", - "shell.execute_reply": "2026-02-26T05:59:20.101499Z" + "iopub.execute_input": "2026-03-24T02:04:23.761621Z", + "iopub.status.busy": "2026-03-24T02:04:23.761508Z", + "iopub.status.idle": "2026-03-24T02:04:23.784763Z", + "shell.execute_reply": "2026-03-24T02:04:23.783190Z" } }, "outputs": [ @@ -568,10 +580,10 @@ "id": "2a324e3f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:20.102781Z", - "iopub.status.busy": "2026-02-26T05:59:20.102722Z", - "iopub.status.idle": "2026-02-26T05:59:20.294517Z", - "shell.execute_reply": "2026-02-26T05:59:20.294200Z" + "iopub.execute_input": "2026-03-24T02:04:23.786767Z", + "iopub.status.busy": "2026-03-24T02:04:23.786691Z", + "iopub.status.idle": "2026-03-24T02:04:24.101294Z", + "shell.execute_reply": "2026-03-24T02:04:24.100547Z" } }, "outputs": [ @@ -621,10 +633,10 @@ "id": "6fad67a9", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:20.295579Z", - "iopub.status.busy": "2026-02-26T05:59:20.295520Z", - "iopub.status.idle": "2026-02-26T05:59:20.734097Z", - "shell.execute_reply": "2026-02-26T05:59:20.733648Z" + "iopub.execute_input": "2026-03-24T02:04:24.102725Z", + "iopub.status.busy": "2026-03-24T02:04:24.102644Z", + "iopub.status.idle": "2026-03-24T02:04:26.951388Z", + "shell.execute_reply": "2026-03-24T02:04:26.950336Z" } }, "outputs": [ @@ -764,10 +776,10 @@ "id": "6d36675b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:20.735282Z", - "iopub.status.busy": "2026-02-26T05:59:20.735173Z", - "iopub.status.idle": "2026-02-26T05:59:20.756289Z", - "shell.execute_reply": "2026-02-26T05:59:20.756002Z" + "iopub.execute_input": "2026-03-24T02:04:26.956946Z", + "iopub.status.busy": "2026-03-24T02:04:26.956617Z", + "iopub.status.idle": "2026-03-24T02:04:27.008328Z", + "shell.execute_reply": "2026-03-24T02:04:27.006957Z" } }, "outputs": [ @@ -777,9 +789,9 @@ "text": [ "Traceback (most recent last):\n", " while evaluating problem `Problem(name=\"Possibly Overlapping Constraints\", sense=MINIMIZE, objective=0, constraints={constr: [Constraint(name=\"constr\", , lambda i: x[i] >= 1, domain=set(N)),Constraint(name=\"constr\", , lambda i: x[i] <= 2, domain=set(M)),],})',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/316836703.py\", line 1, col 2-55\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/316836703.py\", line 1, col 2-55\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/316836703.py\", line 1, col 2-55:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/316836703.py\", line 1, col 2-55:\n", "\n", " 1 | @jm.Problem.define(\"Possibly Overlapping Constraints\")\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", @@ -811,10 +823,10 @@ "id": "0fc6cb95", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:20.757272Z", - "iopub.status.busy": "2026-02-26T05:59:20.757224Z", - "iopub.status.idle": "2026-02-26T05:59:20.796579Z", - "shell.execute_reply": "2026-02-26T05:59:20.796220Z" + "iopub.execute_input": "2026-03-24T02:04:27.014057Z", + "iopub.status.busy": "2026-03-24T02:04:27.013741Z", + "iopub.status.idle": "2026-03-24T02:04:27.106031Z", + "shell.execute_reply": "2026-03-24T02:04:27.104721Z" } }, "outputs": [ @@ -824,18 +836,18 @@ "text": [ "Traceback (most recent last):\n", " while adding constraint 'constr',\n", - " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/2812696639.py\", line 7, col 9-56\n", + " defined at File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/2812696639.py\", line 7, col 9-56\n", "\n", - "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/2812696639.py\", line 7, col 9-56:\n", + "File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/2812696639.py\", line 7, col 9-56:\n", "\n", " 7 | problem += problem.Constraint(\"constr\", x <= 2)\n", " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", "\n", "Constraint 'constr' has conflicting definition!\n", " existing: Constraint(name=\"constr\", sense=GREATER_THAN_EQUAL, left=x, right=1, shape=Scalar(Integer))\n", - " defined at: File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/2812696639.py\", line 6, col 20-56\n", + " defined at: File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/2812696639.py\", line 6, col 20-56\n", " new: Constraint(name=\"constr\", sense=LESS_THAN_EQUAL, left=x, right=2, shape=Scalar(Integer))\n", - " defined at: File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23269/2812696639.py\", line 7, col 20-56\n" + " defined at: File \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_44964/2812696639.py\", line 7, col 20-56\n" ] } ], diff --git a/docs/ja/basics/problem.ipynb b/docs/ja/basics/problem.ipynb index 3df67d3a..b087dc9b 100644 --- a/docs/ja/basics/problem.ipynb +++ b/docs/ja/basics/problem.ipynb @@ -22,10 +22,10 @@ "id": "165d3368", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:22.196551Z", - "iopub.status.busy": "2026-02-26T05:59:22.196469Z", - "iopub.status.idle": "2026-02-26T05:59:22.203485Z", - "shell.execute_reply": "2026-02-26T05:59:22.203040Z" + "iopub.execute_input": "2026-03-24T02:04:39.481235Z", + "iopub.status.busy": "2026-03-24T02:04:39.481151Z", + "iopub.status.idle": "2026-03-24T02:04:39.486579Z", + "shell.execute_reply": "2026-03-24T02:04:39.486251Z" } }, "outputs": [], @@ -50,10 +50,10 @@ "id": "10c85d99", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:22.204719Z", - "iopub.status.busy": "2026-02-26T05:59:22.204649Z", - "iopub.status.idle": "2026-02-26T05:59:22.238101Z", - "shell.execute_reply": "2026-02-26T05:59:22.237679Z" + "iopub.execute_input": "2026-03-24T02:04:39.487662Z", + "iopub.status.busy": "2026-03-24T02:04:39.487606Z", + "iopub.status.idle": "2026-03-24T02:04:39.516261Z", + "shell.execute_reply": "2026-03-24T02:04:39.515799Z" } }, "outputs": [], @@ -82,10 +82,10 @@ "id": "a04e9459", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:22.239321Z", - "iopub.status.busy": "2026-02-26T05:59:22.239257Z", - "iopub.status.idle": "2026-02-26T05:59:22.256844Z", - "shell.execute_reply": "2026-02-26T05:59:22.256494Z" + "iopub.execute_input": "2026-03-24T02:04:39.517575Z", + "iopub.status.busy": "2026-03-24T02:04:39.517510Z", + "iopub.status.idle": "2026-03-24T02:04:39.536172Z", + "shell.execute_reply": "2026-03-24T02:04:39.535834Z" } }, "outputs": [ @@ -127,10 +127,10 @@ "id": "797e7f58", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:22.257873Z", - "iopub.status.busy": "2026-02-26T05:59:22.257818Z", - "iopub.status.idle": "2026-02-26T05:59:22.276701Z", - "shell.execute_reply": "2026-02-26T05:59:22.276416Z" + "iopub.execute_input": "2026-03-24T02:04:39.537333Z", + "iopub.status.busy": "2026-03-24T02:04:39.537273Z", + "iopub.status.idle": "2026-03-24T02:04:39.557293Z", + "shell.execute_reply": "2026-03-24T02:04:39.556897Z" } }, "outputs": [ @@ -194,10 +194,10 @@ "id": "ca78cfdb", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:22.277803Z", - "iopub.status.busy": "2026-02-26T05:59:22.277740Z", - "iopub.status.idle": "2026-02-26T05:59:22.279645Z", - "shell.execute_reply": "2026-02-26T05:59:22.279382Z" + "iopub.execute_input": "2026-03-24T02:04:39.558405Z", + "iopub.status.busy": "2026-03-24T02:04:39.558346Z", + "iopub.status.idle": "2026-03-24T02:04:39.560278Z", + "shell.execute_reply": "2026-03-24T02:04:39.559963Z" } }, "outputs": [ @@ -234,10 +234,10 @@ "id": "168be19a", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:22.280570Z", - "iopub.status.busy": "2026-02-26T05:59:22.280518Z", - "iopub.status.idle": "2026-02-26T05:59:22.306021Z", - "shell.execute_reply": "2026-02-26T05:59:22.305697Z" + "iopub.execute_input": "2026-03-24T02:04:39.561288Z", + "iopub.status.busy": "2026-03-24T02:04:39.561235Z", + "iopub.status.idle": "2026-03-24T02:04:39.587958Z", + "shell.execute_reply": "2026-03-24T02:04:39.587593Z" } }, "outputs": [ @@ -280,10 +280,10 @@ "id": "ee0af68e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:22.306981Z", - "iopub.status.busy": "2026-02-26T05:59:22.306927Z", - "iopub.status.idle": "2026-02-26T05:59:22.339069Z", - "shell.execute_reply": "2026-02-26T05:59:22.338447Z" + "iopub.execute_input": "2026-03-24T02:04:39.589019Z", + "iopub.status.busy": "2026-03-24T02:04:39.588961Z", + "iopub.status.idle": "2026-03-24T02:04:39.614115Z", + "shell.execute_reply": "2026-03-24T02:04:39.613797Z" } }, "outputs": [ diff --git a/docs/ja/basics/variables.ipynb b/docs/ja/basics/variables.ipynb index 048f79d0..ea5727ef 100644 --- a/docs/ja/basics/variables.ipynb +++ b/docs/ja/basics/variables.ipynb @@ -17,10 +17,10 @@ "id": "e89bdd5d", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.116104Z", - "iopub.status.busy": "2026-02-26T05:59:23.115766Z", - "iopub.status.idle": "2026-02-26T05:59:23.132588Z", - "shell.execute_reply": "2026-02-26T05:59:23.127045Z" + "iopub.execute_input": "2026-03-24T02:04:36.723530Z", + "iopub.status.busy": "2026-03-24T02:04:36.723439Z", + "iopub.status.idle": "2026-03-24T02:04:36.733676Z", + "shell.execute_reply": "2026-03-24T02:04:36.731211Z" } }, "outputs": [], @@ -89,10 +89,10 @@ "id": "86f46b5b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.137749Z", - "iopub.status.busy": "2026-02-26T05:59:23.137569Z", - "iopub.status.idle": "2026-02-26T05:59:23.253874Z", - "shell.execute_reply": "2026-02-26T05:59:23.253487Z" + "iopub.execute_input": "2026-03-24T02:04:36.740727Z", + "iopub.status.busy": "2026-03-24T02:04:36.739493Z", + "iopub.status.idle": "2026-03-24T02:04:36.928549Z", + "shell.execute_reply": "2026-03-24T02:04:36.928169Z" } }, "outputs": [ @@ -150,10 +150,10 @@ "id": "de5af628", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.254908Z", - "iopub.status.busy": "2026-02-26T05:59:23.254850Z", - "iopub.status.idle": "2026-02-26T05:59:23.309520Z", - "shell.execute_reply": "2026-02-26T05:59:23.309151Z" + "iopub.execute_input": "2026-03-24T02:04:36.929716Z", + "iopub.status.busy": "2026-03-24T02:04:36.929655Z", + "iopub.status.idle": "2026-03-24T02:04:36.992198Z", + "shell.execute_reply": "2026-03-24T02:04:36.991756Z" } }, "outputs": [ @@ -242,10 +242,10 @@ "id": "150009c4", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.310516Z", - "iopub.status.busy": "2026-02-26T05:59:23.310463Z", - "iopub.status.idle": "2026-02-26T05:59:23.361462Z", - "shell.execute_reply": "2026-02-26T05:59:23.361089Z" + "iopub.execute_input": "2026-03-24T02:04:36.993239Z", + "iopub.status.busy": "2026-03-24T02:04:36.993177Z", + "iopub.status.idle": "2026-03-24T02:04:37.051547Z", + "shell.execute_reply": "2026-03-24T02:04:37.051276Z" } }, "outputs": [ @@ -287,10 +287,10 @@ "id": "076c2f07", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.362447Z", - "iopub.status.busy": "2026-02-26T05:59:23.362389Z", - "iopub.status.idle": "2026-02-26T05:59:23.416390Z", - "shell.execute_reply": "2026-02-26T05:59:23.416015Z" + "iopub.execute_input": "2026-03-24T02:04:37.052839Z", + "iopub.status.busy": "2026-03-24T02:04:37.052773Z", + "iopub.status.idle": "2026-03-24T02:04:37.120017Z", + "shell.execute_reply": "2026-03-24T02:04:37.119744Z" } }, "outputs": [ @@ -347,10 +347,10 @@ "id": "243ddb11", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.417375Z", - "iopub.status.busy": "2026-02-26T05:59:23.417318Z", - "iopub.status.idle": "2026-02-26T05:59:23.419073Z", - "shell.execute_reply": "2026-02-26T05:59:23.418833Z" + "iopub.execute_input": "2026-03-24T02:04:37.121349Z", + "iopub.status.busy": "2026-03-24T02:04:37.121288Z", + "iopub.status.idle": "2026-03-24T02:04:37.123423Z", + "shell.execute_reply": "2026-03-24T02:04:37.123083Z" } }, "outputs": [ @@ -375,10 +375,10 @@ "id": "f3fb46c2", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.419956Z", - "iopub.status.busy": "2026-02-26T05:59:23.419907Z", - "iopub.status.idle": "2026-02-26T05:59:23.421594Z", - "shell.execute_reply": "2026-02-26T05:59:23.421283Z" + "iopub.execute_input": "2026-03-24T02:04:37.124388Z", + "iopub.status.busy": "2026-03-24T02:04:37.124335Z", + "iopub.status.idle": "2026-03-24T02:04:37.126529Z", + "shell.execute_reply": "2026-03-24T02:04:37.126217Z" } }, "outputs": [ @@ -495,10 +495,10 @@ "id": "4fd8cbae", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.422401Z", - "iopub.status.busy": "2026-02-26T05:59:23.422347Z", - "iopub.status.idle": "2026-02-26T05:59:23.454285Z", - "shell.execute_reply": "2026-02-26T05:59:23.453929Z" + "iopub.execute_input": "2026-03-24T02:04:37.127487Z", + "iopub.status.busy": "2026-03-24T02:04:37.127434Z", + "iopub.status.idle": "2026-03-24T02:04:37.168360Z", + "shell.execute_reply": "2026-03-24T02:04:37.168075Z" } }, "outputs": [ @@ -552,10 +552,10 @@ "id": "472b0803", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.455178Z", - "iopub.status.busy": "2026-02-26T05:59:23.455126Z", - "iopub.status.idle": "2026-02-26T05:59:23.496096Z", - "shell.execute_reply": "2026-02-26T05:59:23.495806Z" + "iopub.execute_input": "2026-03-24T02:04:37.169857Z", + "iopub.status.busy": "2026-03-24T02:04:37.169783Z", + "iopub.status.idle": "2026-03-24T02:04:37.243817Z", + "shell.execute_reply": "2026-03-24T02:04:37.243087Z" } }, "outputs": [ @@ -653,10 +653,10 @@ "id": "1c058d80", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.497047Z", - "iopub.status.busy": "2026-02-26T05:59:23.496995Z", - "iopub.status.idle": "2026-02-26T05:59:23.543598Z", - "shell.execute_reply": "2026-02-26T05:59:23.543311Z" + "iopub.execute_input": "2026-03-24T02:04:37.246136Z", + "iopub.status.busy": "2026-03-24T02:04:37.246053Z", + "iopub.status.idle": "2026-03-24T02:04:37.305174Z", + "shell.execute_reply": "2026-03-24T02:04:37.304725Z" } }, "outputs": [ @@ -712,10 +712,10 @@ "id": "c45d2550", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.544736Z", - "iopub.status.busy": "2026-02-26T05:59:23.544677Z", - "iopub.status.idle": "2026-02-26T05:59:23.588689Z", - "shell.execute_reply": "2026-02-26T05:59:23.588329Z" + "iopub.execute_input": "2026-03-24T02:04:37.306437Z", + "iopub.status.busy": "2026-03-24T02:04:37.306356Z", + "iopub.status.idle": "2026-03-24T02:04:37.359687Z", + "shell.execute_reply": "2026-03-24T02:04:37.359330Z" } }, "outputs": [ @@ -771,10 +771,10 @@ "id": "e456d0b6", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.589644Z", - "iopub.status.busy": "2026-02-26T05:59:23.589590Z", - "iopub.status.idle": "2026-02-26T05:59:23.630100Z", - "shell.execute_reply": "2026-02-26T05:59:23.629823Z" + "iopub.execute_input": "2026-03-24T02:04:37.360749Z", + "iopub.status.busy": "2026-03-24T02:04:37.360693Z", + "iopub.status.idle": "2026-03-24T02:04:37.406949Z", + "shell.execute_reply": "2026-03-24T02:04:37.406569Z" } }, "outputs": [ @@ -910,10 +910,10 @@ "id": "687f3eb0", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.631238Z", - "iopub.status.busy": "2026-02-26T05:59:23.631181Z", - "iopub.status.idle": "2026-02-26T05:59:23.648809Z", - "shell.execute_reply": "2026-02-26T05:59:23.648482Z" + "iopub.execute_input": "2026-03-24T02:04:37.408953Z", + "iopub.status.busy": "2026-03-24T02:04:37.408727Z", + "iopub.status.idle": "2026-03-24T02:04:37.431143Z", + "shell.execute_reply": "2026-03-24T02:04:37.430632Z" } }, "outputs": [ @@ -957,10 +957,10 @@ "id": "bd19e62f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.649766Z", - "iopub.status.busy": "2026-02-26T05:59:23.649715Z", - "iopub.status.idle": "2026-02-26T05:59:23.667790Z", - "shell.execute_reply": "2026-02-26T05:59:23.667438Z" + "iopub.execute_input": "2026-03-24T02:04:37.432274Z", + "iopub.status.busy": "2026-03-24T02:04:37.432214Z", + "iopub.status.idle": "2026-03-24T02:04:37.457460Z", + "shell.execute_reply": "2026-03-24T02:04:37.457030Z" } }, "outputs": [ @@ -1025,10 +1025,10 @@ "id": "ef6bbbbb", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.669092Z", - "iopub.status.busy": "2026-02-26T05:59:23.669037Z", - "iopub.status.idle": "2026-02-26T05:59:23.711901Z", - "shell.execute_reply": "2026-02-26T05:59:23.711491Z" + "iopub.execute_input": "2026-03-24T02:04:37.458865Z", + "iopub.status.busy": "2026-03-24T02:04:37.458792Z", + "iopub.status.idle": "2026-03-24T02:04:37.515284Z", + "shell.execute_reply": "2026-03-24T02:04:37.514683Z" } }, "outputs": [ @@ -1113,10 +1113,10 @@ "id": "c79c1ab2", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.712852Z", - "iopub.status.busy": "2026-02-26T05:59:23.712797Z", - "iopub.status.idle": "2026-02-26T05:59:23.769318Z", - "shell.execute_reply": "2026-02-26T05:59:23.768898Z" + "iopub.execute_input": "2026-03-24T02:04:37.520720Z", + "iopub.status.busy": "2026-03-24T02:04:37.520356Z", + "iopub.status.idle": "2026-03-24T02:04:37.599372Z", + "shell.execute_reply": "2026-03-24T02:04:37.598929Z" } }, "outputs": [ @@ -1170,10 +1170,10 @@ "id": "9ff00f79", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:23.770308Z", - "iopub.status.busy": "2026-02-26T05:59:23.770237Z", - "iopub.status.idle": "2026-02-26T05:59:23.809385Z", - "shell.execute_reply": "2026-02-26T05:59:23.809048Z" + "iopub.execute_input": "2026-03-24T02:04:37.600608Z", + "iopub.status.busy": "2026-03-24T02:04:37.600524Z", + "iopub.status.idle": "2026-03-24T02:04:37.662096Z", + "shell.execute_reply": "2026-03-24T02:04:37.661200Z" } }, "outputs": [ diff --git a/docs/ja/introduction.ipynb b/docs/ja/introduction.ipynb index 800d551d..d580362d 100644 --- a/docs/ja/introduction.ipynb +++ b/docs/ja/introduction.ipynb @@ -71,10 +71,10 @@ "id": "74189d5c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:24.471691Z", - "iopub.status.busy": "2026-02-26T05:59:24.471485Z", - "iopub.status.idle": "2026-02-26T05:59:24.804672Z", - "shell.execute_reply": "2026-02-26T05:59:24.804316Z" + "iopub.execute_input": "2026-03-24T02:04:15.205105Z", + "iopub.status.busy": "2026-03-24T02:04:15.205042Z", + "iopub.status.idle": "2026-03-24T02:04:16.572981Z", + "shell.execute_reply": "2026-03-24T02:04:16.572590Z" } }, "outputs": [ @@ -144,10 +144,10 @@ "id": "9eba20ff", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:24.806747Z", - "iopub.status.busy": "2026-02-26T05:59:24.806665Z", - "iopub.status.idle": "2026-02-26T05:59:24.841666Z", - "shell.execute_reply": "2026-02-26T05:59:24.841347Z" + "iopub.execute_input": "2026-03-24T02:04:16.574176Z", + "iopub.status.busy": "2026-03-24T02:04:16.574107Z", + "iopub.status.idle": "2026-03-24T02:04:16.605709Z", + "shell.execute_reply": "2026-03-24T02:04:16.605332Z" } }, "outputs": [], @@ -172,10 +172,10 @@ "id": "f3a2b9c7", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:24.842852Z", - "iopub.status.busy": "2026-02-26T05:59:24.842797Z", - "iopub.status.idle": "2026-02-26T05:59:24.882947Z", - "shell.execute_reply": "2026-02-26T05:59:24.882530Z" + "iopub.execute_input": "2026-03-24T02:04:16.606904Z", + "iopub.status.busy": "2026-03-24T02:04:16.606845Z", + "iopub.status.idle": "2026-03-24T02:04:16.646075Z", + "shell.execute_reply": "2026-03-24T02:04:16.645787Z" } }, "outputs": [], @@ -217,17 +217,17 @@ "id": "94580011", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:24.884070Z", - "iopub.status.busy": "2026-02-26T05:59:24.884013Z", - "iopub.status.idle": "2026-02-26T05:59:24.885886Z", - "shell.execute_reply": "2026-02-26T05:59:24.885611Z" + "iopub.execute_input": "2026-03-24T02:04:16.647281Z", + "iopub.status.busy": "2026-03-24T02:04:16.647225Z", + "iopub.status.idle": "2026-03-24T02:04:16.649129Z", + "shell.execute_reply": "2026-03-24T02:04:16.648825Z" } }, "outputs": [ { "data": { "text/plain": [ - "'2.2.0'" + "'2.3.1'" ] }, "execution_count": 4, diff --git a/docs/ja/quickstart/openjij.ipynb b/docs/ja/quickstart/openjij.ipynb index af4908df..aee9b398 100644 --- a/docs/ja/quickstart/openjij.ipynb +++ b/docs/ja/quickstart/openjij.ipynb @@ -94,10 +94,10 @@ "id": "32b82373", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:25.577435Z", - "iopub.status.busy": "2026-02-26T05:59:25.577383Z", - "iopub.status.idle": "2026-02-26T05:59:25.825914Z", - "shell.execute_reply": "2026-02-26T05:59:25.825552Z" + "iopub.execute_input": "2026-03-24T02:05:06.962341Z", + "iopub.status.busy": "2026-03-24T02:05:06.962258Z", + "iopub.status.idle": "2026-03-24T02:05:07.169469Z", + "shell.execute_reply": "2026-03-24T02:05:07.168917Z" } }, "outputs": [ @@ -169,10 +169,10 @@ "id": "65d15a95", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:25.827120Z", - "iopub.status.busy": "2026-02-26T05:59:25.827054Z", - "iopub.status.idle": "2026-02-26T05:59:25.829097Z", - "shell.execute_reply": "2026-02-26T05:59:25.828677Z" + "iopub.execute_input": "2026-03-24T02:05:07.170703Z", + "iopub.status.busy": "2026-03-24T02:05:07.170637Z", + "iopub.status.idle": "2026-03-24T02:05:07.172767Z", + "shell.execute_reply": "2026-03-24T02:05:07.172304Z" } }, "outputs": [], @@ -201,10 +201,10 @@ "id": "dc31f40f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:25.830077Z", - "iopub.status.busy": "2026-02-26T05:59:25.830021Z", - "iopub.status.idle": "2026-02-26T05:59:26.358169Z", - "shell.execute_reply": "2026-02-26T05:59:26.357745Z" + "iopub.execute_input": "2026-03-24T02:05:07.173836Z", + "iopub.status.busy": "2026-03-24T02:05:07.173767Z", + "iopub.status.idle": "2026-03-24T02:05:08.081426Z", + "shell.execute_reply": "2026-03-24T02:05:08.080927Z" } }, "outputs": [], @@ -238,10 +238,10 @@ "id": "a715a29a", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:26.359323Z", - "iopub.status.busy": "2026-02-26T05:59:26.359245Z", - "iopub.status.idle": "2026-02-26T05:59:26.606043Z", - "shell.execute_reply": "2026-02-26T05:59:26.605709Z" + "iopub.execute_input": "2026-03-24T02:05:08.082681Z", + "iopub.status.busy": "2026-03-24T02:05:08.082558Z", + "iopub.status.idle": "2026-03-24T02:05:08.459229Z", + "shell.execute_reply": "2026-03-24T02:05:08.458766Z" } }, "outputs": [], @@ -272,10 +272,10 @@ "id": "19debd1b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:26.607234Z", - "iopub.status.busy": "2026-02-26T05:59:26.607144Z", - "iopub.status.idle": "2026-02-26T05:59:26.612084Z", - "shell.execute_reply": "2026-02-26T05:59:26.611824Z" + "iopub.execute_input": "2026-03-24T02:05:08.460468Z", + "iopub.status.busy": "2026-03-24T02:05:08.460373Z", + "iopub.status.idle": "2026-03-24T02:05:08.470105Z", + "shell.execute_reply": "2026-03-24T02:05:08.469582Z" } }, "outputs": [ @@ -316,7 +316,7 @@ " 0\n", " x\n", " [0]\n", - " 0.0\n", + " 1.0\n", " \n", " \n", " 1\n", @@ -340,7 +340,7 @@ " 4\n", " x\n", " [4]\n", - " 1.0\n", + " 0.0\n", " \n", " \n", " 5\n", @@ -355,11 +355,11 @@ "text/plain": [ " name subscripts value\n", "id \n", - "0 x [0] 0.0\n", + "0 x [0] 1.0\n", "1 x [1] 0.0\n", "2 x [2] 0.0\n", "3 x [3] 1.0\n", - "4 x [4] 1.0\n", + "4 x [4] 0.0\n", "5 x [5] 0.0" ] }, diff --git a/docs/ja/quickstart/scip.ipynb b/docs/ja/quickstart/scip.ipynb index f5bde6e0..424ad008 100644 --- a/docs/ja/quickstart/scip.ipynb +++ b/docs/ja/quickstart/scip.ipynb @@ -94,10 +94,10 @@ "id": "cf6f5d6e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:27.356932Z", - "iopub.status.busy": "2026-02-26T05:59:27.356874Z", - "iopub.status.idle": "2026-02-26T05:59:27.654968Z", - "shell.execute_reply": "2026-02-26T05:59:27.654547Z" + "iopub.execute_input": "2026-03-24T02:05:09.855622Z", + "iopub.status.busy": "2026-03-24T02:05:09.855545Z", + "iopub.status.idle": "2026-03-24T02:05:10.036882Z", + "shell.execute_reply": "2026-03-24T02:05:10.036496Z" } }, "outputs": [ @@ -169,10 +169,10 @@ "id": "4fbe5bb8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:27.656079Z", - "iopub.status.busy": "2026-02-26T05:59:27.656013Z", - "iopub.status.idle": "2026-02-26T05:59:27.657758Z", - "shell.execute_reply": "2026-02-26T05:59:27.657456Z" + "iopub.execute_input": "2026-03-24T02:05:10.038214Z", + "iopub.status.busy": "2026-03-24T02:05:10.038151Z", + "iopub.status.idle": "2026-03-24T02:05:10.040028Z", + "shell.execute_reply": "2026-03-24T02:05:10.039702Z" } }, "outputs": [], @@ -201,10 +201,10 @@ "id": "42561c0b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:27.658736Z", - "iopub.status.busy": "2026-02-26T05:59:27.658684Z", - "iopub.status.idle": "2026-02-26T05:59:28.224669Z", - "shell.execute_reply": "2026-02-26T05:59:28.224284Z" + "iopub.execute_input": "2026-03-24T02:05:10.040949Z", + "iopub.status.busy": "2026-03-24T02:05:10.040896Z", + "iopub.status.idle": "2026-03-24T02:05:10.651143Z", + "shell.execute_reply": "2026-03-24T02:05:10.650790Z" } }, "outputs": [], @@ -238,10 +238,10 @@ "id": "557ed3a4", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:28.226030Z", - "iopub.status.busy": "2026-02-26T05:59:28.225925Z", - "iopub.status.idle": "2026-02-26T05:59:28.290428Z", - "shell.execute_reply": "2026-02-26T05:59:28.290119Z" + "iopub.execute_input": "2026-03-24T02:05:10.652545Z", + "iopub.status.busy": "2026-03-24T02:05:10.652442Z", + "iopub.status.idle": "2026-03-24T02:05:10.722754Z", + "shell.execute_reply": "2026-03-24T02:05:10.722390Z" } }, "outputs": [ @@ -276,10 +276,10 @@ "id": "a5afa9c8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:28.291428Z", - "iopub.status.busy": "2026-02-26T05:59:28.291347Z", - "iopub.status.idle": "2026-02-26T05:59:28.296269Z", - "shell.execute_reply": "2026-02-26T05:59:28.295937Z" + "iopub.execute_input": "2026-03-24T02:05:10.723995Z", + "iopub.status.busy": "2026-03-24T02:05:10.723897Z", + "iopub.status.idle": "2026-03-24T02:05:10.729677Z", + "shell.execute_reply": "2026-03-24T02:05:10.729303Z" } }, "outputs": [ diff --git a/docs/ja/references/cheat_sheet.ipynb b/docs/ja/references/cheat_sheet.ipynb index c5edc114..ad2e07e0 100644 --- a/docs/ja/references/cheat_sheet.ipynb +++ b/docs/ja/references/cheat_sheet.ipynb @@ -14,10 +14,10 @@ "id": "d4a18618", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.015781Z", - "iopub.status.busy": "2026-02-26T05:59:29.015731Z", - "iopub.status.idle": "2026-02-26T05:59:29.021796Z", - "shell.execute_reply": "2026-02-26T05:59:29.021290Z" + "iopub.execute_input": "2026-03-24T02:05:01.429331Z", + "iopub.status.busy": "2026-03-24T02:05:01.429269Z", + "iopub.status.idle": "2026-03-24T02:05:01.438422Z", + "shell.execute_reply": "2026-03-24T02:05:01.438044Z" } }, "outputs": [], @@ -49,10 +49,10 @@ "id": "79e10997", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.023980Z", - "iopub.status.busy": "2026-02-26T05:59:29.023809Z", - "iopub.status.idle": "2026-02-26T05:59:29.090631Z", - "shell.execute_reply": "2026-02-26T05:59:29.089696Z" + "iopub.execute_input": "2026-03-24T02:05:01.440036Z", + "iopub.status.busy": "2026-03-24T02:05:01.439958Z", + "iopub.status.idle": "2026-03-24T02:05:01.544052Z", + "shell.execute_reply": "2026-03-24T02:05:01.543307Z" } }, "outputs": [ @@ -95,10 +95,10 @@ "id": "0b287866", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.092602Z", - "iopub.status.busy": "2026-02-26T05:59:29.092477Z", - "iopub.status.idle": "2026-02-26T05:59:29.136186Z", - "shell.execute_reply": "2026-02-26T05:59:29.135565Z" + "iopub.execute_input": "2026-03-24T02:05:01.545904Z", + "iopub.status.busy": "2026-03-24T02:05:01.545790Z", + "iopub.status.idle": "2026-03-24T02:05:01.613176Z", + "shell.execute_reply": "2026-03-24T02:05:01.611337Z" } }, "outputs": [ @@ -150,10 +150,10 @@ "id": "ed7db663", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.137625Z", - "iopub.status.busy": "2026-02-26T05:59:29.137557Z", - "iopub.status.idle": "2026-02-26T05:59:29.189925Z", - "shell.execute_reply": "2026-02-26T05:59:29.189525Z" + "iopub.execute_input": "2026-03-24T02:05:01.615861Z", + "iopub.status.busy": "2026-03-24T02:05:01.615567Z", + "iopub.status.idle": "2026-03-24T02:05:01.693506Z", + "shell.execute_reply": "2026-03-24T02:05:01.693054Z" } }, "outputs": [ @@ -161,7 +161,7 @@ "data": { "text/latex": [ "$$\\begin{array}{rl}\n", - "\\text{Problem}\\colon &\\text{WeightedSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(a\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\text{Problem}\\colon &\\text{WeightedSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(a\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -176,7 +176,7 @@ "source": [ "problem = jm.Problem(\"WeightedSum\")\n", "a = problem.Float(\"a\", ndim=1)\n", - "N = problem.DependentVar(\"N\", a.len_at(0))\n", + "N = problem.NamedExpr(\"N\", a.len_at(0))\n", "x = problem.BinaryVar(\"x\", shape=(N,))\n", "problem += jm.sum(a * x)\n", "\n", @@ -197,10 +197,10 @@ "id": "45474fb8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.190985Z", - "iopub.status.busy": "2026-02-26T05:59:29.190924Z", - "iopub.status.idle": "2026-02-26T05:59:29.244008Z", - "shell.execute_reply": "2026-02-26T05:59:29.243597Z" + "iopub.execute_input": "2026-03-24T02:05:01.695344Z", + "iopub.status.busy": "2026-03-24T02:05:01.695262Z", + "iopub.status.idle": "2026-03-24T02:05:01.753298Z", + "shell.execute_reply": "2026-03-24T02:05:01.752745Z" } }, "outputs": [ @@ -208,7 +208,7 @@ "data": { "text/latex": [ "$$\\begin{array}{rl}\n", - "\\text{Problem}\\colon &\\text{WeightedSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(a\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\text{Problem}\\colon &\\text{WeightedSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(a\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -224,7 +224,7 @@ "@jm.Problem.define(\"WeightedSum\")\n", "def problem(problem: jm.DecoratedProblem):\n", " a = problem.Float(ndim=1)\n", - " N = problem.DependentVar(a.len_at(0))\n", + " N = problem.NamedExpr(a.len_at(0))\n", " x = problem.BinaryVar(shape=(N,))\n", " problem += (a * x).sum()\n", "\n", @@ -253,10 +253,10 @@ "id": "08771e03", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.245118Z", - "iopub.status.busy": "2026-02-26T05:59:29.245056Z", - "iopub.status.idle": "2026-02-26T05:59:29.309261Z", - "shell.execute_reply": "2026-02-26T05:59:29.308945Z" + "iopub.execute_input": "2026-03-24T02:05:01.755210Z", + "iopub.status.busy": "2026-03-24T02:05:01.755126Z", + "iopub.status.idle": "2026-03-24T02:05:01.878464Z", + "shell.execute_reply": "2026-03-24T02:05:01.877614Z" } }, "outputs": [ @@ -300,10 +300,10 @@ "id": "eff6ac1d", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.310315Z", - "iopub.status.busy": "2026-02-26T05:59:29.310256Z", - "iopub.status.idle": "2026-02-26T05:59:29.377783Z", - "shell.execute_reply": "2026-02-26T05:59:29.377414Z" + "iopub.execute_input": "2026-03-24T02:05:01.880046Z", + "iopub.status.busy": "2026-03-24T02:05:01.879916Z", + "iopub.status.idle": "2026-03-24T02:05:01.973491Z", + "shell.execute_reply": "2026-03-24T02:05:01.973065Z" } }, "outputs": [ @@ -356,10 +356,10 @@ "id": "3088b3ca", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.378855Z", - "iopub.status.busy": "2026-02-26T05:59:29.378796Z", - "iopub.status.idle": "2026-02-26T05:59:29.449488Z", - "shell.execute_reply": "2026-02-26T05:59:29.449204Z" + "iopub.execute_input": "2026-03-24T02:05:01.974620Z", + "iopub.status.busy": "2026-03-24T02:05:01.974558Z", + "iopub.status.idle": "2026-03-24T02:05:02.056888Z", + "shell.execute_reply": "2026-03-24T02:05:02.056548Z" } }, "outputs": [ @@ -403,10 +403,10 @@ "id": "547a6ead", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.450536Z", - "iopub.status.busy": "2026-02-26T05:59:29.450480Z", - "iopub.status.idle": "2026-02-26T05:59:29.531512Z", - "shell.execute_reply": "2026-02-26T05:59:29.531069Z" + "iopub.execute_input": "2026-03-24T02:05:02.058019Z", + "iopub.status.busy": "2026-03-24T02:05:02.057960Z", + "iopub.status.idle": "2026-03-24T02:05:02.140216Z", + "shell.execute_reply": "2026-03-24T02:05:02.139888Z" } }, "outputs": [ @@ -459,10 +459,10 @@ "id": "cfdecd72", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.532621Z", - "iopub.status.busy": "2026-02-26T05:59:29.532561Z", - "iopub.status.idle": "2026-02-26T05:59:29.663083Z", - "shell.execute_reply": "2026-02-26T05:59:29.662796Z" + "iopub.execute_input": "2026-03-24T02:05:02.141314Z", + "iopub.status.busy": "2026-03-24T02:05:02.141259Z", + "iopub.status.idle": "2026-03-24T02:05:02.322713Z", + "shell.execute_reply": "2026-03-24T02:05:02.321830Z" } }, "outputs": [ @@ -509,10 +509,10 @@ "id": "28c3c3b5", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.664292Z", - "iopub.status.busy": "2026-02-26T05:59:29.664230Z", - "iopub.status.idle": "2026-02-26T05:59:29.798568Z", - "shell.execute_reply": "2026-02-26T05:59:29.798223Z" + "iopub.execute_input": "2026-03-24T02:05:02.323836Z", + "iopub.status.busy": "2026-03-24T02:05:02.323757Z", + "iopub.status.idle": "2026-03-24T02:05:02.477603Z", + "shell.execute_reply": "2026-03-24T02:05:02.477115Z" } }, "outputs": [ @@ -565,10 +565,10 @@ "id": "1d285a01", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.799668Z", - "iopub.status.busy": "2026-02-26T05:59:29.799609Z", - "iopub.status.idle": "2026-02-26T05:59:29.896672Z", - "shell.execute_reply": "2026-02-26T05:59:29.896296Z" + "iopub.execute_input": "2026-03-24T02:05:02.478786Z", + "iopub.status.busy": "2026-03-24T02:05:02.478725Z", + "iopub.status.idle": "2026-03-24T02:05:02.587107Z", + "shell.execute_reply": "2026-03-24T02:05:02.586705Z" } }, "outputs": [ @@ -614,10 +614,10 @@ "id": "7d1c8a03", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:29.897803Z", - "iopub.status.busy": "2026-02-26T05:59:29.897745Z", - "iopub.status.idle": "2026-02-26T05:59:30.002070Z", - "shell.execute_reply": "2026-02-26T05:59:30.001724Z" + "iopub.execute_input": "2026-03-24T02:05:02.588091Z", + "iopub.status.busy": "2026-03-24T02:05:02.588039Z", + "iopub.status.idle": "2026-03-24T02:05:02.740181Z", + "shell.execute_reply": "2026-03-24T02:05:02.739815Z" } }, "outputs": [ @@ -669,10 +669,10 @@ "id": "75703ca2", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.003316Z", - "iopub.status.busy": "2026-02-26T05:59:30.003253Z", - "iopub.status.idle": "2026-02-26T05:59:30.086588Z", - "shell.execute_reply": "2026-02-26T05:59:30.086191Z" + "iopub.execute_input": "2026-03-24T02:05:02.741675Z", + "iopub.status.busy": "2026-03-24T02:05:02.741453Z", + "iopub.status.idle": "2026-03-24T02:05:02.901239Z", + "shell.execute_reply": "2026-03-24T02:05:02.900893Z" } }, "outputs": [ @@ -680,7 +680,7 @@ "data": { "text/latex": [ "$$\\begin{array}{rl}\n", - "\\text{Problem}\\colon &\\text{DependentSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{i=0}^{M-1}{\\sum _{j=0}^{{a}_{i}-1}{{x}_{j}}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\text{Problem}\\colon &\\text{DependentSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{i=0}^{M-1}{\\sum _{j=0}^{{a}_{i}-1}{{x}_{j}}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -697,7 +697,7 @@ "N = problem.Natural(\"N\")\n", "x = problem.BinaryVar(\"x\", shape=(N,))\n", "a = problem.Natural(\"a\", ndim=1)\n", - "M = problem.DependentVar(\"M\", a.len_at(0))\n", + "M = problem.NamedExpr(\"M\", a.len_at(0))\n", "problem += jm.sum(jm.flat_map(lambda i: a[i].map(lambda j: x[j]), M))\n", "\n", "problem" @@ -717,10 +717,10 @@ "id": "0c4e9205", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.087672Z", - "iopub.status.busy": "2026-02-26T05:59:30.087615Z", - "iopub.status.idle": "2026-02-26T05:59:30.200381Z", - "shell.execute_reply": "2026-02-26T05:59:30.199994Z" + "iopub.execute_input": "2026-03-24T02:05:02.904014Z", + "iopub.status.busy": "2026-03-24T02:05:02.903914Z", + "iopub.status.idle": "2026-03-24T02:05:03.021032Z", + "shell.execute_reply": "2026-03-24T02:05:03.020218Z" } }, "outputs": [ @@ -728,7 +728,7 @@ "data": { "text/latex": [ "$$\\begin{array}{rl}\n", - "\\text{Problem}\\colon &\\text{DependentSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{i=0}^{M-1}{\\sum _{j\\in {a}_{i}}{{x}_{j}}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\text{Problem}\\colon &\\text{DependentSum}\\\\\\displaystyle \\min &\\displaystyle \\sum _{i=0}^{M-1}{\\sum _{j\\in {a}_{i}}{{x}_{j}}}\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}a&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(a,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -746,7 +746,7 @@ " N = problem.Natural()\n", " x = problem.BinaryVar(shape=(N,))\n", " a = problem.Natural(ndim=1)\n", - " M = problem.DependentVar(a.len_at(0))\n", + " M = problem.NamedExpr(a.len_at(0))\n", " problem += jm.sum(x[j] for i in M for j in a[i])\n", "\n", "problem" @@ -775,10 +775,10 @@ "id": "fc24d108", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.201359Z", - "iopub.status.busy": "2026-02-26T05:59:30.201303Z", - "iopub.status.idle": "2026-02-26T05:59:30.266458Z", - "shell.execute_reply": "2026-02-26T05:59:30.266150Z" + "iopub.execute_input": "2026-03-24T02:05:03.022220Z", + "iopub.status.busy": "2026-03-24T02:05:03.022147Z", + "iopub.status.idle": "2026-03-24T02:05:03.106428Z", + "shell.execute_reply": "2026-03-24T02:05:03.106052Z" } }, "outputs": [ @@ -823,10 +823,10 @@ "id": "dc6c8635", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.267474Z", - "iopub.status.busy": "2026-02-26T05:59:30.267418Z", - "iopub.status.idle": "2026-02-26T05:59:30.336507Z", - "shell.execute_reply": "2026-02-26T05:59:30.336201Z" + "iopub.execute_input": "2026-03-24T02:05:03.107498Z", + "iopub.status.busy": "2026-03-24T02:05:03.107440Z", + "iopub.status.idle": "2026-03-24T02:05:03.193860Z", + "shell.execute_reply": "2026-03-24T02:05:03.193469Z" } }, "outputs": [ @@ -880,10 +880,10 @@ "id": "e94c1845", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.337603Z", - "iopub.status.busy": "2026-02-26T05:59:30.337549Z", - "iopub.status.idle": "2026-02-26T05:59:30.404505Z", - "shell.execute_reply": "2026-02-26T05:59:30.404173Z" + "iopub.execute_input": "2026-03-24T02:05:03.196589Z", + "iopub.status.busy": "2026-03-24T02:05:03.196463Z", + "iopub.status.idle": "2026-03-24T02:05:03.301828Z", + "shell.execute_reply": "2026-03-24T02:05:03.301368Z" } }, "outputs": [ @@ -929,10 +929,10 @@ "id": "cf2136d1", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.405508Z", - "iopub.status.busy": "2026-02-26T05:59:30.405449Z", - "iopub.status.idle": "2026-02-26T05:59:30.485659Z", - "shell.execute_reply": "2026-02-26T05:59:30.485265Z" + "iopub.execute_input": "2026-03-24T02:05:03.303543Z", + "iopub.status.busy": "2026-03-24T02:05:03.303449Z", + "iopub.status.idle": "2026-03-24T02:05:03.405151Z", + "shell.execute_reply": "2026-03-24T02:05:03.404690Z" } }, "outputs": [ @@ -987,10 +987,10 @@ "id": "34f681bc", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.486669Z", - "iopub.status.busy": "2026-02-26T05:59:30.486614Z", - "iopub.status.idle": "2026-02-26T05:59:30.576494Z", - "shell.execute_reply": "2026-02-26T05:59:30.576080Z" + "iopub.execute_input": "2026-03-24T02:05:03.406238Z", + "iopub.status.busy": "2026-03-24T02:05:03.406175Z", + "iopub.status.idle": "2026-03-24T02:05:03.532199Z", + "shell.execute_reply": "2026-03-24T02:05:03.529504Z" } }, "outputs": [ @@ -1000,11 +1000,11 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{2D K-Hot}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{2d k-hot}&\\quad \\displaystyle x.\\mathop{\\mathtt{sum}}\\left(\\mathtt{axis}=\\left[1\\right]\\right)=K\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N\\times M;\\left\\{0, 1\\right\\}\\right]&\\quad &2\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}K&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\M&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(K,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N\\times M;\\left\\{0, 1\\right\\}\\right]&\\quad &2\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}K&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\M&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(K,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ - "Problem(name=\"2D K-Hot\", sense=MINIMIZE, objective=0, constraints={2d k-hot: [Constraint(name=\"2d k-hot\", sense=EQUAL, left=x.sum(1), right=K, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: None, subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23976/3312631698.py\", start: SrcLoc { line: 5, column: 4 }, end: SrcLoc { line: 5, column: 40 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23976/3312631698.py\", start: SrcLoc { line: 5, column: 4 }, end: SrcLoc { line: 5, column: 40 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Natural }, src_span: NoSrcSpan } }), scalar: Natural }),],})" + "Problem(name=\"2D K-Hot\", sense=MINIMIZE, objective=0, constraints={2d k-hot: [Constraint(name=\"2d k-hot\", sense=EQUAL, left=x.sum(1), right=K, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: None, subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47001/1184867636.py\", start: SrcLoc { line: 5, column: 4 }, end: SrcLoc { line: 5, column: 40 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47001/1184867636.py\", start: SrcLoc { line: 5, column: 4 }, end: SrcLoc { line: 5, column: 40 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Natural }, src_span: NoSrcSpan } }), scalar: Natural }),],})" ] }, "execution_count": 20, @@ -1015,7 +1015,7 @@ "source": [ "problem = jm.Problem(\"2D K-Hot\")\n", "K = problem.Natural(\"K\", ndim=1)\n", - "N = problem.DependentVar(\"N\", K.len_at(0))\n", + "N = problem.NamedExpr(\"N\", K.len_at(0))\n", "M = problem.Natural(\"M\")\n", "x = problem.BinaryVar(\"x\", shape=(N, M))\n", "problem += problem.Constraint(\"2d k-hot\", x.sum(axis=1) == K)\n", @@ -1037,10 +1037,10 @@ "id": "3abc03a3", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.577469Z", - "iopub.status.busy": "2026-02-26T05:59:30.577415Z", - "iopub.status.idle": "2026-02-26T05:59:30.674575Z", - "shell.execute_reply": "2026-02-26T05:59:30.674182Z" + "iopub.execute_input": "2026-03-24T02:05:03.536814Z", + "iopub.status.busy": "2026-03-24T02:05:03.536639Z", + "iopub.status.idle": "2026-03-24T02:05:03.647317Z", + "shell.execute_reply": "2026-03-24T02:05:03.646932Z" } }, "outputs": [ @@ -1050,11 +1050,11 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{2D K-Hot}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{2d k-hot}&\\quad \\displaystyle x.\\mathop{\\mathtt{sum}}\\left(\\mathtt{axis}=\\left[1\\right]\\right)=K\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N\\times M;\\left\\{0, 1\\right\\}\\right]&\\quad &2\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}K&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\M&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(K,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N\\times M;\\left\\{0, 1\\right\\}\\right]&\\quad &2\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}K&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\M&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(K,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ - "Problem(name=\"2D K-Hot\", sense=MINIMIZE, objective=0, constraints={2d k-hot: [Constraint(name=\"2d k-hot\", sense=EQUAL, left=x.sum(1), right=K, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: None, subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23976/313414419.py\", start: SrcLoc { line: 6, column: 8 }, end: SrcLoc { line: 6, column: 39 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23976/313414419.py\", start: SrcLoc { line: 6, column: 8 }, end: SrcLoc { line: 6, column: 39 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Natural }, src_span: NoSrcSpan } }), scalar: Natural }),],})" + "Problem(name=\"2D K-Hot\", sense=MINIMIZE, objective=0, constraints={2d k-hot: [Constraint(name=\"2d k-hot\", sense=EQUAL, left=x.sum(1), right=K, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: None, subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47001/1629874504.py\", start: SrcLoc { line: 6, column: 8 }, end: SrcLoc { line: 6, column: 39 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47001/1629874504.py\", start: SrcLoc { line: 6, column: 8 }, end: SrcLoc { line: 6, column: 39 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Natural }, src_span: NoSrcSpan } }), scalar: Natural }),],})" ] }, "execution_count": 21, @@ -1066,7 +1066,7 @@ "@jm.Problem.define(\"2D K-Hot\")\n", "def problem(problem: jm.DecoratedProblem):\n", " K = problem.Natural(ndim=1)\n", - " N = problem.DependentVar(K.len_at(0))\n", + " N = problem.NamedExpr(K.len_at(0))\n", " M = problem.Natural()\n", " x = problem.BinaryVar(shape=(N, M))\n", " problem += problem.Constraint(\"2d k-hot\", x.sum(axis=1) == K)\n", @@ -1096,10 +1096,10 @@ "id": "25789023", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.676559Z", - "iopub.status.busy": "2026-02-26T05:59:30.676395Z", - "iopub.status.idle": "2026-02-26T05:59:30.816518Z", - "shell.execute_reply": "2026-02-26T05:59:30.816195Z" + "iopub.execute_input": "2026-03-24T02:05:03.648461Z", + "iopub.status.busy": "2026-03-24T02:05:03.648398Z", + "iopub.status.idle": "2026-03-24T02:05:03.820160Z", + "shell.execute_reply": "2026-03-24T02:05:03.819817Z" } }, "outputs": [ @@ -1109,7 +1109,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{KHotOverSet}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{k-hot\\_{}constraint}&\\quad \\displaystyle \\sum _{i\\in {C}_{a}}{{x}_{i}}={K}_{a}\\quad \\forall a\\;\\text{s.t.}\\;a\\in \\left\\{0,\\ldots ,M-1\\right\\}\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1125,7 +1125,7 @@ "problem = jm.Problem(\"KHotOverSet\")\n", "N = problem.Natural(\"N\")\n", "C = problem.Natural(\"C\", jagged=True, ndim=2)\n", - "M = problem.DependentVar(\"M\", C.len_at(0))\n", + "M = problem.NamedExpr(\"M\", C.len_at(0))\n", "K = problem.Natural(\"K\", shape=(M,))\n", "x = problem.BinaryVar(\"x\", shape=(N,))\n", "problem += problem.Constraint(\n", @@ -1149,10 +1149,10 @@ "id": "cf7c27cd", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.817522Z", - "iopub.status.busy": "2026-02-26T05:59:30.817470Z", - "iopub.status.idle": "2026-02-26T05:59:30.968662Z", - "shell.execute_reply": "2026-02-26T05:59:30.968236Z" + "iopub.execute_input": "2026-03-24T02:05:03.821411Z", + "iopub.status.busy": "2026-03-24T02:05:03.821356Z", + "iopub.status.idle": "2026-03-24T02:05:04.007530Z", + "shell.execute_reply": "2026-03-24T02:05:04.007215Z" } }, "outputs": [ @@ -1162,7 +1162,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{KHotOverSet}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{k-hot\\_{}constraint}&\\quad \\displaystyle \\sum _{i\\in {C}_{a}}{{x}_{i}}={K}_{a}\\quad \\forall a\\;\\text{s.t.}\\;a\\in \\left\\{0,\\ldots ,M-1\\right\\}\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1179,7 +1179,7 @@ "def problem(problem: jm.DecoratedProblem):\n", " N = problem.Natural()\n", " C = problem.Natural(jagged=True, ndim=2)\n", - " M = problem.DependentVar(C.len_at(0))\n", + " M = problem.NamedExpr(C.len_at(0))\n", " K = problem.Natural(shape=(M,))\n", " x = problem.BinaryVar(shape=(N,))\n", " problem += problem.Constraint(\n", @@ -1211,10 +1211,10 @@ "id": "c404bee8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:30.969897Z", - "iopub.status.busy": "2026-02-26T05:59:30.969835Z", - "iopub.status.idle": "2026-02-26T05:59:31.052506Z", - "shell.execute_reply": "2026-02-26T05:59:31.052191Z" + "iopub.execute_input": "2026-03-24T02:05:04.008611Z", + "iopub.status.busy": "2026-03-24T02:05:04.008548Z", + "iopub.status.idle": "2026-03-24T02:05:04.102020Z", + "shell.execute_reply": "2026-03-24T02:05:04.101644Z" } }, "outputs": [ @@ -1224,7 +1224,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{LinearInequality}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{weight}&\\quad \\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(w\\cdot x\\right)}}_{\\vec{\\imath }}}\\leq W\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1239,7 +1239,7 @@ "source": [ "problem = jm.Problem(\"LinearInequality\")\n", "w = problem.Float(\"w\", ndim=1)\n", - "N = problem.DependentVar(\"N\", w.len_at(0))\n", + "N = problem.NamedExpr(\"N\", w.len_at(0))\n", "W = problem.Float(\"W\")\n", "x = problem.BinaryVar(\"x\", shape=(N,))\n", "problem += problem.Constraint(\"weight\", (w * x).sum() <= W)\n", @@ -1261,10 +1261,10 @@ "id": "3d6ef1a1", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:31.053566Z", - "iopub.status.busy": "2026-02-26T05:59:31.053508Z", - "iopub.status.idle": "2026-02-26T05:59:31.141137Z", - "shell.execute_reply": "2026-02-26T05:59:31.140797Z" + "iopub.execute_input": "2026-03-24T02:05:04.103112Z", + "iopub.status.busy": "2026-03-24T02:05:04.103050Z", + "iopub.status.idle": "2026-03-24T02:05:04.201445Z", + "shell.execute_reply": "2026-03-24T02:05:04.200875Z" } }, "outputs": [ @@ -1274,7 +1274,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{LinearInequality}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{weight}&\\quad \\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(w\\cdot x\\right)}}_{\\vec{\\imath }}}\\leq W\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(w,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1290,7 +1290,7 @@ "@jm.Problem.define(\"LinearInequality\")\n", "def problem(problem: jm.DecoratedProblem):\n", " w = problem.Float(ndim=1)\n", - " N = problem.DependentVar(w.len_at(0))\n", + " N = problem.NamedExpr(w.len_at(0))\n", " W = problem.Float()\n", " x = problem.BinaryVar(shape=(N,))\n", " problem += problem.Constraint(\"weight\", (w * x).sum() <= W)\n", @@ -1320,10 +1320,10 @@ "id": "33bd2f32", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:31.142152Z", - "iopub.status.busy": "2026-02-26T05:59:31.142100Z", - "iopub.status.idle": "2026-02-26T05:59:31.287558Z", - "shell.execute_reply": "2026-02-26T05:59:31.287296Z" + "iopub.execute_input": "2026-03-24T02:05:04.202936Z", + "iopub.status.busy": "2026-03-24T02:05:04.202858Z", + "iopub.status.idle": "2026-03-24T02:05:04.379090Z", + "shell.execute_reply": "2026-03-24T02:05:04.378607Z" } }, "outputs": [ @@ -1337,7 +1337,7 @@ "$$" ], "text/plain": [ - "Problem(name=\"SOS-1\", sense=MINIMIZE, objective=0, constraints={Big-M: [Constraint(name=\"Big-M\", sense=LESS_THAN_EQUAL, left=a, right=M * x, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23976/1199227916.py\", start: SrcLoc { line: 2, column: 4 }, end: SrcLoc { line: 2, column: 24 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23976/1199227916.py\", start: SrcLoc { line: 2, column: 4 }, end: SrcLoc { line: 2, column: 24 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Float }, src_span: NoSrcSpan } }), scalar: Float }),],SOS1: [Constraint(name=\"SOS1\", sense=LESS_THAN_EQUAL, left=sum(x), right=1, shape=Scalar(Binary)),],})" + "Problem(name=\"SOS-1\", sense=MINIMIZE, objective=0, constraints={Big-M: [Constraint(name=\"Big-M\", sense=LESS_THAN_EQUAL, left=a, right=M * x, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47001/1199227916.py\", start: SrcLoc { line: 2, column: 4 }, end: SrcLoc { line: 2, column: 24 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47001/1199227916.py\", start: SrcLoc { line: 2, column: 4 }, end: SrcLoc { line: 2, column: 24 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Float }, src_span: NoSrcSpan } }), scalar: Float }),],SOS1: [Constraint(name=\"SOS1\", sense=LESS_THAN_EQUAL, left=sum(x), right=1, shape=Scalar(Binary)),],})" ] }, "execution_count": 26, @@ -1371,10 +1371,10 @@ "id": "9f91dea8", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:31.288724Z", - "iopub.status.busy": "2026-02-26T05:59:31.288673Z", - "iopub.status.idle": "2026-02-26T05:59:31.441155Z", - "shell.execute_reply": "2026-02-26T05:59:31.440785Z" + "iopub.execute_input": "2026-03-24T02:05:04.380332Z", + "iopub.status.busy": "2026-03-24T02:05:04.380263Z", + "iopub.status.idle": "2026-03-24T02:05:04.585189Z", + "shell.execute_reply": "2026-03-24T02:05:04.584802Z" } }, "outputs": [ @@ -1388,7 +1388,7 @@ "$$" ], "text/plain": [ - "Problem(name=\"SOS-1\", sense=MINIMIZE, objective=0, constraints={Big-M: [Constraint(name=\"Big-M\", sense=LESS_THAN_EQUAL, left=a, right=M * x, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23976/3596302424.py\", start: SrcLoc { line: 3, column: 8 }, end: SrcLoc { line: 3, column: 25 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_23976/3596302424.py\", start: SrcLoc { line: 3, column: 8 }, end: SrcLoc { line: 3, column: 25 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Float }, src_span: NoSrcSpan } }), scalar: Float }),],SOS1: [Constraint(name=\"SOS1\", sense=LESS_THAN_EQUAL, left=sum(x), right=1, shape=Scalar(Binary)),],})" + "Problem(name=\"SOS-1\", sense=MINIMIZE, objective=0, constraints={Big-M: [Constraint(name=\"Big-M\", sense=LESS_THAN_EQUAL, left=a, right=M * x, shape=SameTensorLike { spec: Tensor(TensorSpec { shape: [Specified(Located { inner: RangeNat { upper_bound: Located { inner: FVar { name: \"N\", ext: WithType { type_: Scalar { mode: Static, kind: Natural }, inner: LaTeXMetadata { custom_latex: None, set_style: Some(SetStyle { element: None, kind: Natural }), subscript_styles: [] } } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47001/3596302424.py\", start: SrcLoc { line: 3, column: 8 }, end: SrcLoc { line: 3, column: 25 } }) } }, src_span: Real(RealSrcSpan { filename: \"/var/folders/mg/mg6st30d18s7pxjjrk6pkxym0000gn/T/ipykernel_47001/3596302424.py\", start: SrcLoc { line: 3, column: 8 }, end: SrcLoc { line: 3, column: 25 } }) })], element: Located { inner: Scalar { mode: Dynamic, kind: Float }, src_span: NoSrcSpan } }), scalar: Float }),],SOS1: [Constraint(name=\"SOS1\", sense=LESS_THAN_EQUAL, left=sum(x), right=1, shape=Scalar(Binary)),],})" ] }, "execution_count": 27, @@ -1431,10 +1431,10 @@ "id": "a62ab168", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:31.442220Z", - "iopub.status.busy": "2026-02-26T05:59:31.442162Z", - "iopub.status.idle": "2026-02-26T05:59:31.665234Z", - "shell.execute_reply": "2026-02-26T05:59:31.664863Z" + "iopub.execute_input": "2026-03-24T02:05:04.586397Z", + "iopub.status.busy": "2026-03-24T02:05:04.586340Z", + "iopub.status.idle": "2026-03-24T02:05:04.868405Z", + "shell.execute_reply": "2026-03-24T02:05:04.867931Z" } }, "outputs": [ @@ -1489,10 +1489,10 @@ "id": "a86d8c29", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:31.666216Z", - "iopub.status.busy": "2026-02-26T05:59:31.666160Z", - "iopub.status.idle": "2026-02-26T05:59:31.914547Z", - "shell.execute_reply": "2026-02-26T05:59:31.914287Z" + "iopub.execute_input": "2026-03-24T02:05:04.869562Z", + "iopub.status.busy": "2026-03-24T02:05:04.869487Z", + "iopub.status.idle": "2026-03-24T02:05:05.200776Z", + "shell.execute_reply": "2026-03-24T02:05:05.200293Z" } }, "outputs": [ diff --git a/docs/ja/references/migration_guide_to_jijmodeling2.ipynb b/docs/ja/references/migration_guide_to_jijmodeling2.ipynb index f7d8e0e5..2ccb871f 100644 --- a/docs/ja/references/migration_guide_to_jijmodeling2.ipynb +++ b/docs/ja/references/migration_guide_to_jijmodeling2.ipynb @@ -56,7 +56,7 @@ " * 実数値:`problem.Float()`\n", " - これらの利用により意図がより明確になり、また正確な型チェックによる精度の高いエラーメッセージが得られるようになります。高度なケース(タプルなどのカスタム`dtype`)にのみ`Placeholder`を使用してください。\n", "\n", - "7. **従属変数の導入**:新たに導入された`problem.DependentVar(..)`宣言により、頻出する部分式を従属変数として束縛・再利用できるようになりました。これにより、従来の JijModeling で`with_latex()`や`latex=...`で定義された$\\LaTeX$上の変数の定義がわからなくなる問題が解消されます。\n", + "7. **従属変数の導入**:新たに導入された`problem.NamedExpr(..)`や`problem.NamedExpr(..)`宣言により、頻出する部分式を名前つき式として束縛・再利用できるようになりました。これにより、従来の JijModeling で`with_latex()`や`latex=...`で定義された$\\LaTeX$上の変数の定義がわからなくなる問題が解消されます。\n", "\n", "8. **新しいデータ型**: JijModeling 2 では辞書型とカテゴリーラベル型が追加されました!\n", " - 従来 Jagged Array で書いていた多くのケースが、辞書を使ってより簡潔に記述できるようになりました!\n", @@ -126,10 +126,10 @@ "id": "5c1c13b4", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:32.553737Z", - "iopub.status.busy": "2026-02-26T05:59:32.553670Z", - "iopub.status.idle": "2026-02-26T05:59:33.026632Z", - "shell.execute_reply": "2026-02-26T05:59:33.026340Z" + "iopub.execute_input": "2026-03-24T02:04:55.169692Z", + "iopub.status.busy": "2026-03-24T02:04:55.169605Z", + "iopub.status.idle": "2026-03-24T02:04:55.620482Z", + "shell.execute_reply": "2026-03-24T02:04:55.619991Z" } }, "outputs": [ @@ -195,10 +195,10 @@ "id": "d1f405cd", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:33.027905Z", - "iopub.status.busy": "2026-02-26T05:59:33.027813Z", - "iopub.status.idle": "2026-02-26T05:59:33.532246Z", - "shell.execute_reply": "2026-02-26T05:59:33.531893Z" + "iopub.execute_input": "2026-03-24T02:04:55.621608Z", + "iopub.status.busy": "2026-03-24T02:04:55.621531Z", + "iopub.status.idle": "2026-03-24T02:04:56.272954Z", + "shell.execute_reply": "2026-03-24T02:04:56.272500Z" } }, "outputs": [ @@ -375,10 +375,10 @@ "id": "5ef8c8b3", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:33.533487Z", - "iopub.status.busy": "2026-02-26T05:59:33.533394Z", - "iopub.status.idle": "2026-02-26T05:59:33.535343Z", - "shell.execute_reply": "2026-02-26T05:59:33.535022Z" + "iopub.execute_input": "2026-03-24T02:04:56.274019Z", + "iopub.status.busy": "2026-03-24T02:04:56.273898Z", + "iopub.status.idle": "2026-03-24T02:04:56.276712Z", + "shell.execute_reply": "2026-03-24T02:04:56.275995Z" } }, "outputs": [ @@ -411,10 +411,10 @@ "id": "9ae594ce", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:33.536299Z", - "iopub.status.busy": "2026-02-26T05:59:33.536247Z", - "iopub.status.idle": "2026-02-26T05:59:33.854661Z", - "shell.execute_reply": "2026-02-26T05:59:33.854283Z" + "iopub.execute_input": "2026-03-24T02:04:56.282239Z", + "iopub.status.busy": "2026-03-24T02:04:56.281653Z", + "iopub.status.idle": "2026-03-24T02:04:56.679808Z", + "shell.execute_reply": "2026-03-24T02:04:56.679395Z" } }, "outputs": [], @@ -718,10 +718,10 @@ "id": "1e9ca71e", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:33.856008Z", - "iopub.status.busy": "2026-02-26T05:59:33.855946Z", - "iopub.status.idle": "2026-02-26T05:59:33.918048Z", - "shell.execute_reply": "2026-02-26T05:59:33.917701Z" + "iopub.execute_input": "2026-03-24T02:04:56.680935Z", + "iopub.status.busy": "2026-03-24T02:04:56.680879Z", + "iopub.status.idle": "2026-03-24T02:04:56.764686Z", + "shell.execute_reply": "2026-03-24T02:04:56.764308Z" } }, "outputs": [ @@ -792,10 +792,10 @@ "id": "66868142", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:33.919076Z", - "iopub.status.busy": "2026-02-26T05:59:33.919020Z", - "iopub.status.idle": "2026-02-26T05:59:34.000810Z", - "shell.execute_reply": "2026-02-26T05:59:34.000471Z" + "iopub.execute_input": "2026-03-24T02:04:56.766601Z", + "iopub.status.busy": "2026-03-24T02:04:56.766493Z", + "iopub.status.idle": "2026-03-24T02:04:56.888085Z", + "shell.execute_reply": "2026-03-24T02:04:56.887705Z" } }, "outputs": [ @@ -860,10 +860,10 @@ "id": "3a042c35", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:34.001853Z", - "iopub.status.busy": "2026-02-26T05:59:34.001796Z", - "iopub.status.idle": "2026-02-26T05:59:34.088384Z", - "shell.execute_reply": "2026-02-26T05:59:34.088019Z" + "iopub.execute_input": "2026-03-24T02:04:56.889056Z", + "iopub.status.busy": "2026-03-24T02:04:56.888999Z", + "iopub.status.idle": "2026-03-24T02:04:56.989045Z", + "shell.execute_reply": "2026-03-24T02:04:56.988765Z" } }, "outputs": [ @@ -928,10 +928,10 @@ "id": "73042539", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:34.089430Z", - "iopub.status.busy": "2026-02-26T05:59:34.089369Z", - "iopub.status.idle": "2026-02-26T05:59:34.175634Z", - "shell.execute_reply": "2026-02-26T05:59:34.175325Z" + "iopub.execute_input": "2026-03-24T02:04:56.990163Z", + "iopub.status.busy": "2026-03-24T02:04:56.990097Z", + "iopub.status.idle": "2026-03-24T02:04:57.107395Z", + "shell.execute_reply": "2026-03-24T02:04:57.106889Z" } }, "outputs": [ @@ -988,10 +988,10 @@ "id": "77c29124", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:34.176619Z", - "iopub.status.busy": "2026-02-26T05:59:34.176565Z", - "iopub.status.idle": "2026-02-26T05:59:34.288169Z", - "shell.execute_reply": "2026-02-26T05:59:34.287806Z" + "iopub.execute_input": "2026-03-24T02:04:57.109068Z", + "iopub.status.busy": "2026-03-24T02:04:57.108950Z", + "iopub.status.idle": "2026-03-24T02:04:57.259231Z", + "shell.execute_reply": "2026-03-24T02:04:57.258498Z" } }, "outputs": [ @@ -1056,10 +1056,10 @@ "id": "26009ba5", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:34.289156Z", - "iopub.status.busy": "2026-02-26T05:59:34.289099Z", - "iopub.status.idle": "2026-02-26T05:59:34.428703Z", - "shell.execute_reply": "2026-02-26T05:59:34.428278Z" + "iopub.execute_input": "2026-03-24T02:04:57.261020Z", + "iopub.status.busy": "2026-03-24T02:04:57.260913Z", + "iopub.status.idle": "2026-03-24T02:04:57.431214Z", + "shell.execute_reply": "2026-03-24T02:04:57.430925Z" } }, "outputs": [ @@ -1109,10 +1109,10 @@ "id": "18aba181", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:34.429642Z", - "iopub.status.busy": "2026-02-26T05:59:34.429584Z", - "iopub.status.idle": "2026-02-26T05:59:34.550545Z", - "shell.execute_reply": "2026-02-26T05:59:34.550183Z" + "iopub.execute_input": "2026-03-24T02:04:57.433370Z", + "iopub.status.busy": "2026-03-24T02:04:57.433244Z", + "iopub.status.idle": "2026-03-24T02:04:57.572388Z", + "shell.execute_reply": "2026-03-24T02:04:57.572079Z" } }, "outputs": [ @@ -1162,10 +1162,10 @@ "id": "4ed5b544", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:34.551678Z", - "iopub.status.busy": "2026-02-26T05:59:34.551614Z", - "iopub.status.idle": "2026-02-26T05:59:35.028663Z", - "shell.execute_reply": "2026-02-26T05:59:35.028299Z" + "iopub.execute_input": "2026-03-24T02:04:57.573609Z", + "iopub.status.busy": "2026-03-24T02:04:57.573545Z", + "iopub.status.idle": "2026-03-24T02:04:58.125109Z", + "shell.execute_reply": "2026-03-24T02:04:58.124647Z" } }, "outputs": [ @@ -1264,10 +1264,10 @@ "id": "1480ae56", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:35.029680Z", - "iopub.status.busy": "2026-02-26T05:59:35.029623Z", - "iopub.status.idle": "2026-02-26T05:59:35.467537Z", - "shell.execute_reply": "2026-02-26T05:59:35.467173Z" + "iopub.execute_input": "2026-03-24T02:04:58.126253Z", + "iopub.status.busy": "2026-03-24T02:04:58.126188Z", + "iopub.status.idle": "2026-03-24T02:04:58.627107Z", + "shell.execute_reply": "2026-03-24T02:04:58.626640Z" } }, "outputs": [], @@ -1325,10 +1325,10 @@ "id": "7ba11d75", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:35.469308Z", - "iopub.status.busy": "2026-02-26T05:59:35.469245Z", - "iopub.status.idle": "2026-02-26T05:59:35.553005Z", - "shell.execute_reply": "2026-02-26T05:59:35.552667Z" + "iopub.execute_input": "2026-03-24T02:04:58.628501Z", + "iopub.status.busy": "2026-03-24T02:04:58.628434Z", + "iopub.status.idle": "2026-03-24T02:04:58.730997Z", + "shell.execute_reply": "2026-03-24T02:04:58.730627Z" } }, "outputs": [ @@ -1391,10 +1391,10 @@ "id": "568c762c", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:35.554105Z", - "iopub.status.busy": "2026-02-26T05:59:35.554048Z", - "iopub.status.idle": "2026-02-26T05:59:35.721945Z", - "shell.execute_reply": "2026-02-26T05:59:35.721577Z" + "iopub.execute_input": "2026-03-24T02:04:58.732526Z", + "iopub.status.busy": "2026-03-24T02:04:58.732445Z", + "iopub.status.idle": "2026-03-24T02:04:58.943372Z", + "shell.execute_reply": "2026-03-24T02:04:58.942971Z" } }, "outputs": [ @@ -1404,7 +1404,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{KHotOverSet}\\\\\\displaystyle \\min &\\displaystyle 0\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{k-hot\\_{}constraint}&\\quad \\displaystyle \\sum _{i\\in {C}_{a}}{{x}_{i}}={K}_{a}\\quad \\forall a\\;\\text{s.t.}\\;a\\in \\left\\{0,\\ldots ,M-1\\right\\}\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}C&\\in \\mathop{\\mathrm{JaggedArray}}\\left[(-)\\times (-);\\mathbb{N}\\right]&\\quad &2\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\K&\\in \\mathop{\\mathrm{Array}}\\left[M;\\mathbb{N}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{N}\\\\N&\\in \\mathbb{N}&\\quad &\\text{A scalar placeholder in }\\mathbb{N}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}M&=\\mathop{\\mathtt{len\\_{}at}}\\left(C,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1423,7 +1423,7 @@ "def _(problem: jm.DecoratedProblem):\n", " N = problem.Length()\n", " C = problem.Natural(jagged=True, ndim=2)\n", - " M = problem.DependentVar(C.len_at(0))\n", + " M = problem.NamedExpr(C.len_at(0))\n", " K = problem.Placeholder(dtype=jm.DataType.NATURAL, shape=(M,))\n", " x = problem.BinaryVar(shape=(N,))\n", " \n", @@ -1473,10 +1473,10 @@ "id": "2decc57b", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:35.722971Z", - "iopub.status.busy": "2026-02-26T05:59:35.722915Z", - "iopub.status.idle": "2026-02-26T05:59:36.168847Z", - "shell.execute_reply": "2026-02-26T05:59:36.168479Z" + "iopub.execute_input": "2026-03-24T02:04:58.944556Z", + "iopub.status.busy": "2026-03-24T02:04:58.944496Z", + "iopub.status.idle": "2026-03-24T02:04:59.455793Z", + "shell.execute_reply": "2026-03-24T02:04:59.455480Z" } }, "outputs": [ @@ -1486,7 +1486,7 @@ "$$\\begin{array}{rl}\n", "\\text{Problem}\\colon &\\text{CompilerDemo}\\\\\\displaystyle \\max &\\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(v\\cdot x\\right)}}_{\\vec{\\imath }}}\\\\&\\\\\\text{s.t.}&\\\\&\\begin{aligned}\n", "\\text{weight}&\\quad \\displaystyle \\sum _{\\vec{\\imath }}{{{\\left(w\\cdot x\\right)}}_{\\vec{\\imath }}}\\leq W\\end{aligned}\n", - "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Dependent Variables:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(v,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", + "\\\\&\\\\\\text{where}&\\\\&\\text{Decision Variables:}\\\\&\\qquad \\begin{alignedat}{2}x&\\in \\mathop{\\mathrm{Array}}\\left[N;\\left\\{0, 1\\right\\}\\right]&\\quad &1\\text{-dim binary variable}\\\\\\end{alignedat}\\\\&\\\\&\\text{Placeholders:}\\\\&\\qquad \\begin{alignedat}{2}v&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\W&\\in \\mathbb{R}&\\quad &\\text{A scalar placeholder in }\\mathbb{R}\\\\w&\\in \\mathop{\\mathrm{Array}}\\left[(-);\\mathbb{R}\\right]&\\quad &1\\text{-dimensional array of placeholders with elements in }\\mathbb{R}\\\\\\end{alignedat}\\\\&\\\\&\\text{Named Expressions:}\\\\&\\qquad \\begin{alignedat}{2}N&=\\mathop{\\mathtt{len\\_{}at}}\\left(v,0\\right)&\\quad &\\in \\mathbb{N}\\\\\\end{alignedat}\\end{array}\n", "$$" ], "text/plain": [ @@ -1513,7 +1513,7 @@ "def _(problem: jm.DecoratedProblem):\n", " v = problem.Placeholder(dtype=jm.DataType.FLOAT, ndim=1)\n", " w = problem.Placeholder(dtype=jm.DataType.FLOAT, ndim=1)\n", - " N = problem.DependentVar(v.len_at(0))\n", + " N = problem.NamedExpr(v.len_at(0))\n", " W = problem.Float()\n", " x = problem.BinaryVar(shape=(N,))\n", "\n", @@ -1778,10 +1778,10 @@ "id": "d50b156f", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:36.170096Z", - "iopub.status.busy": "2026-02-26T05:59:36.170036Z", - "iopub.status.idle": "2026-02-26T05:59:36.288450Z", - "shell.execute_reply": "2026-02-26T05:59:36.288043Z" + "iopub.execute_input": "2026-03-24T02:04:59.457088Z", + "iopub.status.busy": "2026-03-24T02:04:59.457034Z", + "iopub.status.idle": "2026-03-24T02:04:59.590593Z", + "shell.execute_reply": "2026-03-24T02:04:59.590182Z" } }, "outputs": [ @@ -1825,10 +1825,10 @@ "id": "7da928f9", "metadata": { "execution": { - "iopub.execute_input": "2026-02-26T05:59:36.289412Z", - "iopub.status.busy": "2026-02-26T05:59:36.289356Z", - "iopub.status.idle": "2026-02-26T05:59:36.385386Z", - "shell.execute_reply": "2026-02-26T05:59:36.385038Z" + "iopub.execute_input": "2026-03-24T02:04:59.591623Z", + "iopub.status.busy": "2026-03-24T02:04:59.591562Z", + "iopub.status.idle": "2026-03-24T02:04:59.696371Z", + "shell.execute_reply": "2026-03-24T02:04:59.695995Z" } }, "outputs": [ diff --git a/docs/ja/releases/jijmodeling-2.3.1.ipynb b/docs/ja/releases/jijmodeling-2.3.1.ipynb new file mode 100644 index 00000000..dd2bffd1 --- /dev/null +++ b/docs/ja/releases/jijmodeling-2.3.1.ipynb @@ -0,0 +1,197 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "d8041c08", + "metadata": {}, + "source": [ + "# JijModeling 2.3.1 リリースノート" + ] + }, + { + "cell_type": "markdown", + "id": "0f5adc22", + "metadata": {}, + "source": [ + "## 機能強化" + ] + }, + { + "cell_type": "markdown", + "id": "32897aa5", + "metadata": {}, + "source": [ + "### `jm.range` 関数の追加\n", + "\n", + "{py:class}`~jijmodeling.Expression` を使用した値シーケンスを表する関数、 {py:func}`jijmodeling.range` を追加しました。使い方は基本的に python 組み込みの {py:class}`range() ` と似ています。\n", + "\n", + "例は以下の通りです:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "2bd607d2", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:50.765075Z", + "iopub.status.busy": "2026-03-24T02:04:50.764920Z", + "iopub.status.idle": "2026-03-24T02:04:50.999405Z", + "shell.execute_reply": "2026-03-24T02:04:50.998271Z" + } + }, + "outputs": [], + "source": [ + "import jijmodeling as jm\n", + "\n", + "\n", + "@jm.Problem.define(\"RangeProblem\")\n", + "def problem(problem: jm.DecoratedProblem):\n", + " S = problem.Natural()\n", + " F = problem.Natural()\n", + " N = problem.Natural()\n", + " x = problem.BinaryVar(shape=(10,))\n", + " problem += jm.sum(x[i] for i in jm.range(S, F, N))" + ] + }, + { + "cell_type": "markdown", + "id": "43d611c5", + "metadata": {}, + "source": [ + "### `Problem`の`-=`演算子で目的関数更新の対応 \n", + "\n", + "{py:class}`~jijmodeling.Problem` に `-=` 演算子を追加しました。 `-=` を使って目的関数から項を引くことができます。\n", + "\n", + "`+=` とは異なり、 `-=` で制約条件を削除することはできません。" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "c1621d4c", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:51.004701Z", + "iopub.status.busy": "2026-03-24T02:04:51.003648Z", + "iopub.status.idle": "2026-03-24T02:04:51.062955Z", + "shell.execute_reply": "2026-03-24T02:04:51.062226Z" + } + }, + "outputs": [], + "source": [ + "problem = jm.Problem(\"problem\")\n", + "x = problem.ContinuousVar(\"x\", lower_bound=0, upper_bound=5)\n", + "y = problem.ContinuousVar(\"y\", lower_bound=0, upper_bound=5)\n", + "\n", + "problem += x\n", + "problem -= y\n", + "assert jm.is_same(problem.objective, x - y)" + ] + }, + { + "cell_type": "markdown", + "id": "ff8462e4", + "metadata": {}, + "source": [ + "### `DependentVar` が `NamedExpr` に\n", + "\n", + "JijModeling 2.3 以前では、依存変数を表す `DependentVar` クラスが存在していました。\n", + "名前の印象に反し、この機能は Placeholder の長さなど決定変数に依存しないような値を定義するためにも用いることができました。\n", + "この状況は混乱を招く恐れがあるため、 `DependentVar` クラスは廃止され、同様の機能を提供する {py:class}`~jijmodeling.NamedExpr` クラスが定義されました。今後は {py:class}`~jijmodeling.NamedExpr` をご利用ください。\n", + "\n", + "詳細については {doc}`../advanced/named_expr` を御参照ください。\n", + "\n", + "## バグ修正" + ] + }, + { + "cell_type": "markdown", + "id": "6ad782c9", + "metadata": {}, + "source": [ + "### 修正:スライス記法内にバグ束縛変数が現れられるように\n", + "\n", + "スライス記法内の束縛変数の扱いを修正し、内包表記や制約の添え字で束縛された変数がスライス記法内で正しく扱われるようになりました。\n", + "\n", + "### 修正:添え字つき制約内での自然数上の総和・所属関係の $\\LaTeX$ 出力の修正\n", + "\n", + "これまでの実装では、添え字つき制約の定義域が自然数であったり、総和の範囲が自然数であったりした場合、以下のように所属関係が $\\in$ を使って出力されていました:\n", + "\n", + "$$\n", + "\\text{c1}:\\quad\\sum _{j\\in {N}_{1}}{{x}_{i,j}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in {N}_{0}\n", + "$$\n", + "\n", + "本リリースから、目的関数や単独の制約の場合と同様、以下のように自然な出力が行われるようになりました:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "5170f328", + "metadata": { + "execution": { + "iopub.execute_input": "2026-03-24T02:04:51.068442Z", + "iopub.status.busy": "2026-03-24T02:04:51.068344Z", + "iopub.status.idle": "2026-03-24T02:04:51.273244Z", + "shell.execute_reply": "2026-03-24T02:04:51.272603Z" + } + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$$\\text{c1}\\colon \\quad \\sum _{j=0}^{{N}_{1}-1}{{x}_{i,j}}=1\\quad \\forall i\\;\\text{s.t.}\\;i\\in \\left\\{0,\\ldots ,{N}_{0}-1\\right\\}$$" + ], + "text/plain": [ + "Constraint(name=\"c1\", , lambda i: sum(N[1].map(lambda (j: natural): x[i, j])) == 1, domain=set(N[0]))" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problem = jm.Problem(\"P\")\n", + "N = problem.Natural(\"N\", shape=2)\n", + "x = problem.BinaryVar(\"x\", shape=(N[0], N[1]))\n", + "problem.Constraint(\"c1\", lambda i: jm.sum(N[1], lambda j: x[i, j]) == 1, domain=N[0])" + ] + }, + { + "cell_type": "markdown", + "id": "c96ec495", + "metadata": {}, + "source": [ + "### 修正:未使用のプレースホルダーがある場合のランダムインスタンス生成で発生する復旧不能エラー\n", + "\n", + "問題定義に未使用のプレースホルダーが含まれていた場合、ランダムインスタンス生成時に panic が発生する不具合を修正しました。" + ] + } + ], + "metadata": { + "jupytext": { + "default_lexer": "ipython3" + }, + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/markdowns/en/advanced/generation.md b/markdowns/en/advanced/generation.md new file mode 100644 index 00000000..0a387ff6 --- /dev/null +++ b/markdowns/en/advanced/generation.md @@ -0,0 +1,143 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.19.1 +kernelspec: + display_name: Python 3 (ipykernel) + language: python + name: python3 +--- + +# Using random instance generation + +{py:class}`~jijmodeling.Problem` provides methods to generate randomized sets of instance data, based on the problem's schema (its placeholders). This tutorial will go over all the different instance generation options. + +There are two methods: +- {py:meth}`Problem.generate_random_dataset` returns the data as a dictionary, like one you'd pass to {py:meth}`Problem.eval` as the instance data. +- {py:meth}`Problem.generate_random_instance` generates data in the same way, but returns the compiled problem as an OMMX instance. It's the same as using `generate_random_dataset` and then passing the returned dictionary to {py:meth}`Problem.eval`. + +Both of these methods accept the same generation parameters: `default`, `options`, and `seed`. Meanwhile, `generate_random_instance` accepts additional options that are passed along to `Problem.eval`: `prune_unused_dec_vars` and `constraint_detection`, etc. + +`seed` is simply the seed value used to initialize the random number generator. Use it when you want the generated instance to be reproducible. + +`default` and `options` specify how values should be generated for your random instance. `options` accepts a dictionary that allows you to specify value ranges for each {py:class}`~jijmodeing.Placeholder` in your problem, while `default` is the fallback parameter. Anything that is not present in `options` will refer to `default` to determine how its values should be generated. + +Neither of these is _required_. You don't need to set `default` if specifying `options` for every placeholder, and just setting `default` can be enough to generate a basic instance. However, note that generated instances are not guaranteed to be feasible, that depends entirely on the problem and parameters set. + +Let's go over how to specify these parameters for different kinds of problems. + +## Setting `default` and `options` + +Our generation parameters `default` and `options` can be specified in several different ways, namely: + +- A fixed value (just a number). +- A Python `range`. +- The object returned by one the many functions in the {py:mod}`jijmodeling.generation` submodule. +- Ranges defined with tuples and dictionaries. Refer to the API docs for {py:meth}`~jijmodeling.Problem.generate_random_dataset` for more details on how to use these. + +When using a fixed value, the placeholder will be set to that number. When using ranges (be they built-in python ranges, the ones from {py:mod}`jijmodeling.generation`, or defined by tuples/dictionaries), those will serve the boundary for generating random values. + +Let's look at a very simple problem to see how these are used. + +```{code-cell} ipython3 +import jijmodeling as jm + +problem = jm.Problem("my problem") +x = problem.BinaryVar("x") +A = problem.Natural("A") +B = problem.Natural("B") +problem += A * x + B + +problem.generate_random_dataset(default={"value": range(1, 10)}) +``` + +In the above example, we don't use `options`, so we look to `default` when generating values for `A` and `B`. Both then get their own random value from within the default range. + +In this case we used a regular Python range, which are naturally `[closed, open)`, meaning the lower boundary is included, but the higher is excluded. (eg. `range(1,4)` is 1, 2 or 3, but not 4) The ranges provided in {py:mod}`jijmodeling.generation` provide additional options for defining ranges, like {py:func}`jijmodeling.generation.open` (neither of the bounds is included) or {py:func}`jijmodeling.generation.at_least` (include lower bound, infinty as upper bound). Python ranges are equivalent to {py:func}`jijmodeling.generation.closed_open`. + +Generated values will conform to types. That is, if you have a Natural Placeholder, only natural numbers will be generated for it, even if you use a range parameter including a negative number like `(-10, 10)`. + +Now, if we want to specify different ranges for `A` and `B`, we must pass a dictionary to `options`. Keys must match a placeholder's name, and values must be dictionaries specifying the options for that specific placeholder. In this scalar case, the only relevant option is `value`. We'll discuss other options that may go in the dictionary in future sections. + +```{code-cell} ipython3 +problem.generate_random_dataset(default={"value": range(1, 10)}, options={"A": {"value": range(50, 100)}}) +``` + +In the above example, we give `"A"` its own value range through `options`. Since we didn't specify `"B"`, `default` is still used for its values. We can also set both in `options`: + +```{code-cell} ipython3 +problem.generate_random_dataset(options = {"A": {"value": range(50, 100)}, "B": {"value": range(1, 10)}}) +``` + +## Array placeholders + +With array placeholders, values can be specified in much the same way as scalars. If the placeholder's `shape` is well defined, an array (potentially multi-dimensional) of values will be generated matching the shape, all within the `value` range (or `default`, if `value` isn't specified for this placeholder). + +```{code-cell} ipython3 +problem = jm.Problem("my problem") +# here we use a literal value for simplicity, but `shape` itself could be defined with a placeholder. +x = problem.BinaryVar("x", shape=10) +A = problem.Natural("A", shape=10) +problem += jm.sum(10, lambda i: A[i] * x[i]) + +problem.generate_random_dataset(options={"A": {"value": range(1,10)}}) +``` + +If the placeholder's `shape` isn't fully defined, we should specify how many elements the array should have to be able to generate the instance data. To do that, we add a `size` parameter to the options dictionary. As `size` defines the length of the array, it must be a natural numbers, but like `value`, we still accept ranges -- meaning a random number of elements can be generated. + +```{code-cell} ipython3 +problem = jm.Problem("my problem") +A = problem.Float("A", ndim=1) +N = A.len_at(0) +x = problem.BinaryVar("x", shape=(N,)) + +problem += jm.sum(N, lambda i: A[i] * x[i]) + +problem.generate_random_dataset( + options={ + "A": {"value": range(-10, 10), "size": range(1,10),} + }, +) +``` + +When a placeholder has a partially defined `shape` (such as `(None, 10)`, etc.), `size` will be referenced to generate the number of elements for each dimension without a predefined value. Specifying `size` for an array placeholder with a well-defined shape has no effect; the `shape` information takes priority. + ++++ + +## Dictionary placeholders + +For dictionary-like Placeholders keyed by `CategoryLabel`s, you _must_ define the keys that go in those category labels through `options`. The most explicit way of doing so, is by using a `keys` parameter. For example, if your problem has a category label `C`, this will define "X", "Y", and "Z" as the three valid keys: + +```python +{ "C": {"keys": ["X", "Y", "Z"]} } +``` + +So each dictionary placeholder keyed by `C` will generate a value for each of the "X", "Y" and "Z" keys. Value ranges work the same way as array and scalar placeholders: they can be passed through `options`for each placeholder separately, or you can use `default`. + +However, if the actual strings don't matter for the instance you're generating, you can also use `size` (with either a fixed value or a range). In that case, we will generate a number arbitrary strings fitting that parameter. + +```python +{ "C": {"size": 5 } } +{ "C": {"size": range(3, 10)}} +``` + +As said above, values will be generated for each key in each dictionary-like placeholder. This is still true for _partial_ dictionaries: by default, all keys are used. To limit the amount of keys used in a partial placeholder, we additionally pass either `keys` or `size` as part of that placeholder's entry in `options` to define a subset. + +For example, let's assume we have a partial dictionary placeholder `D`, keyed by the category label `C`: + +```python +{ "C": {"keys": ["X", "Y", "Z"]}, "D": {"keys": ["X", "Y"], "value": range(10, 100)} } } +``` + +The above only works when you've defined the category label values using `keys`, and you must guarantee that it's a valid subset. + +On the other hand, using `size` in the partial dictionary's options, we can specify that a random selection must be made from the valid keys (no matter how they were specified): +```python +# either 1 or 2 keys will be picked at random: +{ "C": {"keys": ["X", "Y", "Z"]}, "D": {"size": range(1, 3), "value": range(10, 100)} } } +# 1, 2, 3, or 4 keys will be picked at random: +{ "C": {"size": range(3, 10)}, "D": {"size": range(1, 5), "value": range(10, 100)} } } +``` diff --git a/markdowns/en/advanced/named_expr.md b/markdowns/en/advanced/named_expr.md new file mode 100644 index 00000000..6265f7cd --- /dev/null +++ b/markdowns/en/advanced/named_expr.md @@ -0,0 +1,252 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.19.1 +kernelspec: + display_name: .venv + language: python + name: python3 +--- + +# Naming Expressions and Saving Them in Instances + +JijModeling provides the {py:class}`~jijmodeling.NamedExpr` class to represent named expressions. +Like decision variables and placeholders, it can be declared using the {py:meth}`Problem.NamedExpr() ` method. +{py:meth}`Problem.NamedExpr() ` accepts the following arguments: + +| Argument | Type | Description | +| :-- | :--: | :-- | +| `name` | `str` | The name of the named expression. Optional in the Decorator API. | +| `definition` | Required. {py:data}`~jijmodeling.ExpressionLike` | The definition of the named expression. You can pass JijModeling expression objects or any object that can be converted into an expression, such as Python numbers, strings, tuples, lists, dictionaries, and NumPy arrays. | +| `description` | `Optional[str]` | Optional. A description of the named expression. It is used in mathematical output and in expressions saved to OMMX. | +| `latex` | `Optional[str]` | Optional. A $\LaTeX$ representation of the named expression. It is used when rendering mathematical output. | +| `save_in_ommx` | `bool` | Optional, default `False`. If set to `True`, and the conditions described later are satisfied, the expression is saved in the OMMX instance as an {py:class}`ommx.v1.NamedFunction`. | + +{py:class}`~jijmodeling.NamedExpr` has the following two main use cases: + +1. Give a specific expression a name to make the $\LaTeX$ output easier to read +2. Save a specific expression in an OMMX instance and evaluate its value after solving + +This document explains these uses of {py:class}`~jijmodeling.NamedExpr` with concrete examples. + ++++ + +# Naming Expressions + +Let us look at an example of naming a specific expression to make the $\LaTeX$ output easier to read. In the knapsack problem, suppose we want to infer the number of items $N$ from the length of the placeholder array $w$ representing the weight of each item, rather than providing $N$ explicitly as instance data. +First, here is a formulation that does not use {py:meth}`~jijmodeling.Problem.NamedExpr`: + +```{code-cell} ipython3 +import jijmodeling as jm + + +@jm.Problem.define("Knapsack (Unnamed)", sense=jm.ProblemSense.MAXIMIZE) +def knapsack_unnamed(problem: jm.DecoratedProblem): + W = problem.Float(description="maximum weight capacity of the knapsack") + w = problem.Float(ndim=1, description="weight of each item") + # Infer N from the length of w. + N = w.len_at(0) + v = problem.Float(shape=(N,), description="value of each item") + x = problem.BinaryVar( + shape=(N,), description="$x_i = 1$ if item i is put in the knapsack" + ) + + problem += jm.sum(v[i] * x[i] for i in N) + problem += problem.Constraint("Weight", jm.sum(w[i] * x[i] for i in N) <= W) + + +knapsack_unnamed +``` + +As you can see from the $\LaTeX$ output, the definition `len_at(w, 0)` for $N$ is expanded inline, which makes the formulation, especially the summation ranges, harder to read. +Now let us define $N$ using {py:meth}`~jijmodeling.Problem.NamedExpr`: + +```{code-cell} ipython3 +@jm.Problem.define("Knapsack", sense=jm.ProblemSense.MAXIMIZE) +def knapsack(problem: jm.DecoratedProblem): + W = problem.Float(description="maximum weight capacity of the knapsack") + w = problem.Float(ndim=1, description="weight of each item") + # Use NamedExpr to give the length of w the name N. + N = problem.NamedExpr(w.len_at(0), description="Length of w") + v = problem.Float(shape=(N,), description="value of each item") + x = problem.BinaryVar( + shape=(N,), description="$x_i = 1$ if item i is put in the knapsack" + ) + + problem += jm.sum(v[i] * x[i] for i in N) + problem += problem.Constraint("Weight", jm.sum(w[i] * x[i] for i in N) <= W) + + +knapsack +``` + +The definition of $N$ now appears in the `Named Expressions` section at the end, while the rest of the formulation displays it simply as $N$, which makes the $\LaTeX$ output easier to read. + ++++ + +Also, although $N$ defined by {py:meth}`~jijmodeling.Problem.NamedExpr` is treated as a kind of variable in the JijModeling model, it is automatically expanded during compilation. Therefore, whether or not you use {py:meth}`~jijmodeling.Problem.NamedExpr` does not change the resulting OMMX instance. + +```{code-cell} ipython3 +knapsack_instance_data = { + "v": [10, 13, 18, 31, 7, 15], + "w": [11, 15, 20, 35, 10, 33], + "W": 47, +} + +instance_named = knapsack.eval(knapsack_instance_data) +instance_unnamed = knapsack_unnamed.eval(knapsack_instance_data) + +assert instance_named.objective.almost_equal(instance_unnamed.objective) +assert instance_named.constraints[0].function.almost_equal( + instance_unnamed.constraints[0].function +) +``` + +:::{tip} +You can inspect the list of {py:class}`~jijmodeling.NamedExpr` objects registered in a model using {py:meth}`jijmodeling.Problem.named_exprs`. +::: + ++++ + +## Saving in Instances + +By setting the `save_in_ommx` argument of {py:class}`~jijmodeling.Problem.NamedExpr` to `True`, you can save an expression in an OMMX instance only when it satisfies one of the following conditions: + +1. An expression whose possible values are scalars +2. An array of expressions whose possible values are scalars +3. A dictionary of expressions whose possible values are scalars + +More concretely, expressions like the following can be saved in an OMMX instance. + +```{code-cell} ipython3 +# An expression whose possible values are scalars +# Example: a sum of binary variables +problem = jm.Problem("Scalar") +x = problem.BinaryVar("x", shape=(5,)) +S = problem.NamedExpr("scalar", x.sum(), save_in_ommx=True) +problem +``` + +```{code-cell} ipython3 +# An array of expressions whose possible values are scalars +# Example: the difference of two arrays of integer variables +problem = jm.Problem("Tensor of Scalars") +y = problem.IntegerVar("y", shape=(5,), lower_bound=0, upper_bound=10) +z = problem.IntegerVar("z", shape=(5,), lower_bound=0, upper_bound=10) +T = problem.NamedExpr("tensor_of_scalars", y - z, save_in_ommx=True) +problem +``` + +```{code-cell} ipython3 +# A dictionary of expressions whose possible values are scalars +# Example: the product of a placeholder dictionary and a real-valued variable dictionary +problem = jm.Problem("Dict of Scalars") +K = problem.CategoryLabel("K") +a = problem.Float("a", dict_keys=K) +w = problem.ContinuousVar("w", dict_keys=K, lower_bound=0, upper_bound=10) +U = problem.NamedExpr("dict_of_scalars", a * w, save_in_ommx=True) +problem +``` + +On the other hand, expressions like the following cannot be saved in an OMMX instance. + +```{code-cell} ipython3 +problem = jm.Problem("Errornous Problem") +``` + +```{code-cell} ipython3 +# Comparison expressions cannot be saved. +a = problem.IntegerVar("a", lower_bound=0, upper_bound=10) +try: + problem.NamedExpr("comparison", a == 2, save_in_ommx=True) +except Exception as e: + print(e) +``` + +```{code-cell} ipython3 +# Category labels cannot be saved. +L = problem.CategoryLabel("L") +try: + problem.NamedExpr("category_labels", L, save_in_ommx=True) +except Exception as e: + print(e) +``` + +```{code-cell} ipython3 +# `rows()` returns an array of arrays, so it cannot be saved. +x = problem.BinaryVar("M", shape=(5, 5)) +try: + problem.NamedExpr("array_of_array", x.rows(), save_in_ommx=True) +except Exception as e: + print(e) +``` + +:::{tip} +Even for expressions that cannot be saved in an OMMX instance, you can still declare them as `NamedExpr` by setting `save_in_ommx=False` or leaving it unspecified. +::: + ++++ + +Now let us look at an example of saving a specific expression in an OMMX instance and evaluating its value after solving. In the knapsack problem, suppose that in addition to the objective value, which is the total value of the selected items, we also want to know the total weight of the items. + +```{code-cell} ipython3 +@jm.Problem.define("Knapsack", sense=jm.ProblemSense.MAXIMIZE) +def knapsack_weight(problem: jm.DecoratedProblem): + W = problem.Float(description="maximum weight capacity of the knapsack") + w = problem.Float(ndim=1, description="weight of each item") + N = problem.NamedExpr(w.len_at(0), description="Length of w") + v = problem.Float(shape=(N,), description="value of each item") + x = problem.BinaryVar( + shape=(N,), description="$x_i = 1$ if item i is put in the knapsack" + ) + total_weight = problem.NamedExpr( + jm.sum(w[i] * x[i] for i in N), + description="Total weight of items in the knapsack", + save_in_ommx=True, + ) + + problem += jm.sum(v[i] * x[i] for i in N) + problem += problem.Constraint("Weight", total_weight <= W) + + +knapsack_weight +``` + +In the code above, we give the total-weight expression the name `total_weight`, and enable saving it in the OMMX instance by setting `save_in_ommx=True`. Now let us compile this model and generate the OMMX instance. + +```{code-cell} ipython3 +instance = knapsack_weight.eval(knapsack_instance_data) +``` + +You can inspect the expressions saved in the OMMX instance via the {py:meth}`ommx.v1.Instance.named_functions` and {py:meth}`ommx.v1.Instance.named_functions_df` properties. + +```{code-cell} ipython3 +instance.named_functions_df +``` + +:::{tip} +To get the `NamedFunction` IDs corresponding to expressions saved in the OMMX instance, use {py:meth}`Compiler.get_named_function_id_by_name() `. +::: + ++++ + +Now let us solve this OMMX instance with OpenJij and inspect the value of `total_weight` in the resulting solution. + +```{code-cell} ipython3 +from ommx_openjij_adapter import OMMXOpenJijSAAdapter + +solution = OMMXOpenJijSAAdapter.solve( + instance, + num_reads=100, + num_sweeps=10, + uniform_penalty_weight=1.6, +) + +solution.named_functions_df +``` + +This confirms that the value of the expression `total_weight` saved in the OMMX instance can be evaluated. +Besides this kind of usage, saving specific expressions in OMMX instances is also useful in cases such as weighted multi-objective optimization. diff --git a/markdowns/en/advanced/serialize.md b/markdowns/en/advanced/serialize.md new file mode 100644 index 00000000..01ac8e9c --- /dev/null +++ b/markdowns/en/advanced/serialize.md @@ -0,0 +1,33 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.19.1 +kernelspec: + display_name: Python 3 (ipykernel) + language: python + name: python3 +--- + +# Serialization + +JijModeling models can be easily serialized to [Protobuf](https://protobuf.dev) using the {py:func}`jijmodeling.to_protobuf` function or the {py:meth}`Problem.to_protobuf ` method. + +```{code-cell} ipython3 +import jijmodeling as jm + +problem = jm.Problem("my problem") +N = problem.Placeholder("N", dtype=jm.DataType.NATURAL) +x = problem.BinaryVar("x", shape=(N,)) +problem += x.sum() + +serialized = problem.to_protobuf() +``` + +To deserialize, use {py:func}`jijmodeling.from_protobuf` or {py:meth}`Problem.from_protobuf `. + +```{code-cell} ipython3 +deserialized = jm.from_protobuf(serialized) +``` diff --git a/markdowns/en/basics/expressions.md b/markdowns/en/basics/expressions.md index f404229e..47be6f45 100644 --- a/markdowns/en/basics/expressions.md +++ b/markdowns/en/basics/expressions.md @@ -154,7 +154,7 @@ Specifically, you can think of them as follows: | Type name | Description | | --- | --- | -| `ExpressionLike` | A type that can be converted to {py:class}`~jijmodeling.Expression`. Depending on the context, this includes {py:class}`~jijmodeling.Expression` itself, {py:class}`~jijmodeling.Placeholder`, {py:class}`~jijmodeling.DecisionVar`, {py:class}`~jijmodeling.DependentVar`, as well as Python numbers, strings, tuples, lists, dictionaries, NumPy arrays, and so on. | +| `ExpressionLike` | A type that can be converted to {py:class}`~jijmodeling.Expression`. Depending on the context, this includes {py:class}`~jijmodeling.Expression` itself, {py:class}`~jijmodeling.Placeholder`, {py:class}`~jijmodeling.DecisionVar`, {py:class}`~jijmodeling.NamedExpr`, as well as Python numbers, strings, tuples, lists, dictionaries, NumPy arrays, and so on. | | `ExpressionFunction` | A function that takes one or more {py:class}`~jijmodeling.Expression` objects and returns a {py:class}`~jijmodeling.Expression`. In Python type hints, only up to 5 arguments are enumerated, but in practice there is no limit on the number of arguments. | ::: @@ -354,6 +354,7 @@ Strictly speaking, JijModeling sets correspond to **streams** or **iterators** i ::: Some values are automatically converted to sets. For example, a multi-dimensional array becomes a set that scans elements in row-major order, a natural number $N$ becomes the set $\{0, 1, \ldots, N-1\}$, and a category label `L` becomes the set of all values of `L` given at compile time. +Also, since JijModeling 2.3.1, the {py:func}`jijmodeling.range` function, corresponding to Python's built-in {py:class}`range() `, is available for defining sets consisting of arithmetic progressions of natural numbers. :::{admonition} Change from JijModeling 1: arrays as "sets" :class: caution diff --git a/markdowns/en/basics/modeling.md b/markdowns/en/basics/modeling.md index 7a5606a2..c31cdad4 100644 --- a/markdowns/en/basics/modeling.md +++ b/markdowns/en/basics/modeling.md @@ -55,6 +55,12 @@ problem You can see that the existing term was not replaced; instead, $y$ was added and the new objective is $x + y$. If you might need to remove objective terms later, keep a list of terms in Python and set the objective from that list when needed. +:::{admonition} Subtracting terms from the objective +:class: tip + +Since JijModeling 2.3.1, you can also "subtract" scalar {py:class}`~jijmodeling.Expression` objects from the objective by using the {py:meth}`-= ` operator on a {py:class}`~jijmodeling.Problem`. +::: + As a more practical example, let's set the objective for the knapsack problem. ```{code-cell} ipython3 @@ -120,6 +126,12 @@ When adding a constraint, always use the {py:meth}`+= ` does not add the constraint to the model. ::: +:::{admonition} Removing constraints +:class: important + +At present, there is no way to remove constraints from a model. In particular, note that you cannot "subtract" constraints from a model using the {py:func}`-= ` operator. +::: + +++ ### Families of constraints diff --git a/markdowns/en/references/cheat_sheet.md b/markdowns/en/references/cheat_sheet.md index 85b3a39e..0eba9e93 100644 --- a/markdowns/en/references/cheat_sheet.md +++ b/markdowns/en/references/cheat_sheet.md @@ -55,7 +55,7 @@ problem ```{code-cell} ipython3 problem = jm.Problem("WeightedSum") a = problem.Float("a", ndim=1) -N = problem.DependentVar("N", a.len_at(0)) +N = problem.NamedExpr("N", a.len_at(0)) x = problem.BinaryVar("x", shape=(N,)) problem += jm.sum(a * x) @@ -68,7 +68,7 @@ problem @jm.Problem.define("WeightedSum") def problem(problem: jm.DecoratedProblem): a = problem.Float(ndim=1) - N = problem.DependentVar(a.len_at(0)) + N = problem.NamedExpr(a.len_at(0)) x = problem.BinaryVar(shape=(N,)) problem += (a * x).sum() @@ -206,7 +206,7 @@ problem = jm.Problem("DependentSum") N = problem.Natural("N") x = problem.BinaryVar("x", shape=(N,)) a = problem.Natural("a", ndim=1) -M = problem.DependentVar("M", a.len_at(0)) +M = problem.NamedExpr("M", a.len_at(0)) problem += jm.sum(jm.flat_map(lambda i: a[i].map(lambda j: x[j]), M)) problem @@ -220,7 +220,7 @@ def problem(problem: jm.DecoratedProblem): N = problem.Natural() x = problem.BinaryVar(shape=(N,)) a = problem.Natural(ndim=1) - M = problem.DependentVar(a.len_at(0)) + M = problem.NamedExpr(a.len_at(0)) problem += jm.sum(x[j] for i in M for j in a[i]) problem @@ -293,7 +293,7 @@ problem ```{code-cell} ipython3 problem = jm.Problem("2D K-Hot") K = problem.Natural("K", ndim=1) -N = problem.DependentVar("N", K.len_at(0)) +N = problem.NamedExpr("N", K.len_at(0)) M = problem.Natural("M") x = problem.BinaryVar("x", shape=(N, M)) problem += problem.Constraint("2d k-hot", x.sum(axis=1) == K) @@ -307,7 +307,7 @@ problem @jm.Problem.define("2D K-Hot") def problem(problem: jm.DecoratedProblem): K = problem.Natural(ndim=1) - N = problem.DependentVar(K.len_at(0)) + N = problem.NamedExpr(K.len_at(0)) M = problem.Natural() x = problem.BinaryVar(shape=(N, M)) problem += problem.Constraint("2d k-hot", x.sum(axis=1) == K) @@ -325,7 +325,7 @@ problem problem = jm.Problem("KHotOverSet") N = problem.Natural("N") C = problem.Natural("C", jagged=True, ndim=2) -M = problem.DependentVar("M", C.len_at(0)) +M = problem.NamedExpr("M", C.len_at(0)) K = problem.Natural("K", shape=(M,)) x = problem.BinaryVar("x", shape=(N,)) problem += problem.Constraint( @@ -342,7 +342,7 @@ problem def problem(problem: jm.DecoratedProblem): N = problem.Natural() C = problem.Natural(jagged=True, ndim=2) - M = problem.DependentVar(C.len_at(0)) + M = problem.NamedExpr(C.len_at(0)) K = problem.Natural(shape=(M,)) x = problem.BinaryVar(shape=(N,)) problem += problem.Constraint( @@ -361,7 +361,7 @@ problem ```{code-cell} ipython3 problem = jm.Problem("LinearInequality") w = problem.Float("w", ndim=1) -N = problem.DependentVar("N", w.len_at(0)) +N = problem.NamedExpr("N", w.len_at(0)) W = problem.Float("W") x = problem.BinaryVar("x", shape=(N,)) problem += problem.Constraint("weight", (w * x).sum() <= W) @@ -375,7 +375,7 @@ problem @jm.Problem.define("LinearInequality") def problem(problem: jm.DecoratedProblem): w = problem.Float(ndim=1) - N = problem.DependentVar(w.len_at(0)) + N = problem.NamedExpr(w.len_at(0)) W = problem.Float() x = problem.BinaryVar(shape=(N,)) problem += problem.Constraint("weight", (w * x).sum() <= W) diff --git a/markdowns/en/references/migration_guide_to_jijmodeling2.md b/markdowns/en/references/migration_guide_to_jijmodeling2.md index 5c4b2e52..096f7bc2 100644 --- a/markdowns/en/references/migration_guide_to_jijmodeling2.md +++ b/markdowns/en/references/migration_guide_to_jijmodeling2.md @@ -61,7 +61,7 @@ JijModeling 2 introduces several key changes that improve usability and safety: * Real: `problem.Float()`. - They produce clearer intent, tighter static type checking, and better error messages. Use `Placeholder` only for advanced cases (tuple / custom `dtype`s). -7. **Introduction of Dependent Variables**: The newly introduced `problem.DependentVar(..)` declaration allows you to bind and reuse frequently appearing sub-expressions as dependent variables. This resolves the issue in traditional JijModeling where definitions of variables in LaTeX (defined with `with_latex()` or `latex=...`) were unclear. +7. **Introduction of Named Expressions**: The newly introduced `problem.NamedExpr(..)` and `problem.NamedExpr(..)` declaration allows you to bind and reuse frequently appearing sub-expressions as named expressions. This resolves the issue in traditional JijModeling where definitions of variables in LaTeX (defined with `with_latex()` or `latex=...`) were unclear. 8. **New Datatypes**: JijModeling 2 now shipped with dictionary and category label types! - Many cases formerly written using jagged arrays can now be written more simply with dictionaries! @@ -788,7 +788,7 @@ problem = jm.Problem("KHotOverSet", sense=jm.ProblemSense.MINIMIZE) def _(problem: jm.DecoratedProblem): N = problem.Length() C = problem.Natural(jagged=True, ndim=2) - M = problem.DependentVar(C.len_at(0)) + M = problem.NamedExpr(C.len_at(0)) K = problem.Placeholder(dtype=jm.DataType.NATURAL, shape=(M,)) x = problem.BinaryVar(shape=(N,)) @@ -834,7 +834,7 @@ problem = jm.Problem("CompilerDemo", sense=jm.ProblemSense.MAXIMIZE) def _(problem: jm.DecoratedProblem): v = problem.Placeholder(dtype=jm.DataType.FLOAT, ndim=1) w = problem.Placeholder(dtype=jm.DataType.FLOAT, ndim=1) - N = problem.DependentVar(v.len_at(0)) + N = problem.NamedExpr(v.len_at(0)) W = problem.Float() x = problem.BinaryVar(shape=(N,)) diff --git a/markdowns/en/releases/jijmodeling-2.3.1.md b/markdowns/en/releases/jijmodeling-2.3.1.md new file mode 100644 index 00000000..7bea273e --- /dev/null +++ b/markdowns/en/releases/jijmodeling-2.3.1.md @@ -0,0 +1,94 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.19.1 +kernelspec: + display_name: .venv + language: python + name: python3 +--- + +# JijModeling 2.3.1 Release Notes + ++++ + +## Feature Enhancements + ++++ + +### Added `jm.range()` + +With the {py:func}`jijmodeling.range()` function you can now represent sequences by using {py:class}`~jijmodeling.Expression`s. Its usage is similar to python's built-in {py:class}`range() `. + +Example usage: + +```{code-cell} ipython3 +import jijmodeling as jm + + +@jm.Problem.define("RangeProblem") +def problem(problem: jm.DecoratedProblem): + S = problem.Natural() + F = problem.Natural() + N = problem.Natural() + x = problem.BinaryVar(shape=(10,)) + problem += jm.sum(x[i] for i in jm.range(S, F, N)) +``` + +### Support `-=` operator to update a `Problem`'s objective function + +You can now use `-=` to add subtracted terms from a {py:class}`~jijmodeling.Problem`'s objective function. + +Unlike `+=`, `-=` does not support removing constraints. + +```{code-cell} ipython3 +problem = jm.Problem("problem") +x = problem.ContinuousVar("x", lower_bound=0, upper_bound=5) +y = problem.ContinuousVar("y", lower_bound=0, upper_bound=5) + +problem += x +problem -= y +assert jm.is_same(problem.objective, x - y) +``` + +### `DependentVar` becomes `NamedExpr` + +Before JijModeling 2.3, there was a `DependentVar` class for representing dependent variables. +Despite the name, this feature could also be used to define values that do not depend on decision variables, such as the length of a Placeholder. +Because this could be confusing, the `DependentVar` class has been replaced by the {py:class}`~jijmodeling.NamedExpr` class, which provides the same functionality. Use {py:class}`~jijmodeling.NamedExpr` instead. + +For details, see {doc}`../advanced/named_expr`. + ++++ + +## Bugfixes + ++++ + +### Bugfix: Proper handling of bound variables in slice notation + +The handling of bound variables in slice notation has been fixed, ensuring that variables bound in comprehensions or constraint indices are correctly handled within slice notation. + +### Bugfix: LaTeX output for sums and membership relations over natural numbers in indexed constraints + +In previous versions, when the domain of an indexed constraint or the range of a summation was over natural numbers, the membership relation was output using $\in$, for example: + +$$ +\text{c1}:\quad\sum _{j\in {N}_{1}}{{x}_{i,j}}=1\quad \forall i\;\text{s.t.}\;i\in {N}_{0} +$$ + +Starting in this release, the output is made natural in the same way as objective functions and standalone constraints: + +```{code-cell} ipython3 +problem = jm.Problem("P") +N = problem.Natural("N", shape=2) +x = problem.BinaryVar("x", shape=(N[0], N[1])) +problem.Constraint("c1", lambda i: jm.sum(N[1], lambda j: x[i, j]) == 1, domain=N[0]) +``` + +### Bugfix: Fixes unrecoverable error in random instance generation under unused placeholder + +We have fixed the bug where the random instance generation panics under the presence of an unused placeholder in the problem definition. diff --git a/markdowns/ja/advanced/generation.md b/markdowns/ja/advanced/generation.md new file mode 100644 index 00000000..e0d79e1f --- /dev/null +++ b/markdowns/ja/advanced/generation.md @@ -0,0 +1,134 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.19.1 +kernelspec: + display_name: Python 3 (ipykernel) + language: python + name: python3 +--- + +# インスタンスのランダム生成の使い方 + +{py:class}`~jijmodeling.Problem`には、 問題のスキーマ(つまり、プレースホルダー)に基づいたインスタンスデータのランダム生成が行えるメソッドがあります。本節では、そのランダム生成における設定などを説明します。 + +メソッドは2つあり、以下の通りになります。 +- {py:meth}`Problem.generate_random_dataset ` は、{py:meth}`Problem.eval` に渡すインスタンスデータを返します。 +- {py:meth}`Problem.generate_random_instance ` は、 同じくデータを生成するが、 OMMX インスタンスとして返します。 `generate_random_dataset`で取得したインスタンスデータをそのまま{py:meth}`Problem.eval`に渡すのと同じです。 + +上記メソッドの生成に関する引数は共通で、`default` と `options` と `seed` の3つです。さらには`generate_random_instance`は`Problem.eval`の引数も対応しています(`prune_unused_dec_vars`、`constraint_detection`など)。 + +`seed`パラメータは、乱数生成の初期化に使われる乱数シードです。インスタンス生成に再現性を求める場合に使えます。 + +`default`と`options`は、インスタンスデータの値の範囲を決めるものです。`options` では、辞書で問題の各{py:class}`~jijmodeing.Placeholder` に対してそれぞれの値の範囲を指定することができます。`default`は、特定の範囲指定がない値のためのデフォルト範囲となります。いずれも必須ではありません。`options`で全プレースホルダーの範囲を指定している場合は`default`を渡す必要がありませんし、`default`だけでシンプルなデータを生成できる場合もあります。しかし、生成されたインスタンスが実行可能解を持つ保証はないので注意してください。 + +実際に引数の指定方法を見ていきましょう。 + +## `default` と `options`の指定方法 + +`default`と`options` は両方とも以下の指定方法を対応としています。 +- 固定値 +- Python 組み込みの`range` +- {py:mod}`jijmodeling.generation` 配下の関数から取得されたオブジェクト +- タプルや辞書などを使った範囲指定。詳細は{py:meth}`~jijmodeling.Problem.generate_random_dataset`の API リファレンスを参照してください + +固定値が指定された場合、その数値がそのままプレースホルダーの値に使われます(ランダムな値は使いません)。 Python の `range` や {py:mod}`jijmodeling.generation` などの範囲が指定された場合、その範囲がランダム生成の境界になります。 + +指定方法の例を見てみましょう。 + +```{code-cell} ipython3 +import jijmodeling as jm + +problem = jm.Problem("my problem") +x = problem.BinaryVar("x") +A = problem.Natural("A") +B = problem.Natural("B") +problem += A * x + B + +problem.generate_random_dataset(default={"value": range(1, 10)}) +``` + +上記の例では、`options`がないため、 `A`と`B`の値の生成時は、`default`が参照されます。`range`の区間内でそれぞれ別の値が生成されます。 + +今回使った Python 組み込みの`range`は左閉右開になっています(つまり、`range(1,4)`の場合、1、2、3が入って、4は入らない)。{py:mod}`jijmodeling.generation` では、 開区間の{py:func}`jijmodeling.generation.open`や左有界(上界が無限大)の{py:func}`jijmodeling.generation.at_least`など、違うスタイルの範囲を定義するための関数を提供しています。 Python 組み込みの`range`は {py:func}`jijmodeling.generation.closed_open`と同じになります。 + +生成された値はプレースホルダーの型に則します。つまり、自然数のプレースホルダーがあった場合、`(-10, 10)` など負数を含む範囲を渡しても、生成されるのは自然数のみです。 + +それでは、`options`を使って、`A`と`B`に別々の範囲を指定したい場合をみてみましょう。プレースホルダーの名前がキー、値が該当プレースホルダーの生成オプションになります。生成オプションは複数あるので、辞書である必要があります。スカラーの場合は`value`オプションのみで十分です。他のオプションは下記で説明します。 + +```{code-cell} ipython3 +problem.generate_random_dataset(default={"value": range(1, 10)}, options={"A": {"value": range(50, 100)}}) +``` + +このコードでは、`options`を通じて`"A"`の値の範囲を指定しています。`"B"`は`options`で指定していないため、前述の通り`default`を参照しています。もちろん、次のようにどちらも`options`で指定することも可能です。 + +```{code-cell} ipython3 +problem.generate_random_dataset(options = {"A": {"value": range(50, 100)}, "B": {"value": range(1, 10)}}) +``` + +## 配列プレスホルダー + +配列プレスホルダーの値の範囲指定は基本的にスカラーと同じです。プレースホルダーの`shape`が完全に定義された場合、その`shape`に則した配列が生成されます。要素はすべて`value`範囲内となります(`value`指定がない場合、`default`が参照されます)。 + +```{code-cell} ipython3 +problem = jm.Problem("my problem") +# この例では、数値の10にしているが、shapeをプレースホルダーにしても問題ありません。 +x = problem.BinaryVar("x", shape=10) +A = problem.Natural("A", shape=10) +problem += jm.sum(10, lambda i: A[i] * x[i]) + +problem.generate_random_dataset(options={"A": {"value": range(1,10)}}) +``` + +`shape`が完全に定義されていない場合は、配列の要素数を`size`キーで指定する必要があります。`size`は要素数を決めるものなので自然数でなければなりませんが、`value`と同様、範囲指定に対応しています。そのため、配列の要素数がランダムなインスタンスも生成可能です。 + +```{code-cell} ipython3 +problem = jm.Problem("my problem") +A = problem.Float("A", ndim=1) +N = A.len_at(0) +x = problem.BinaryVar("x", shape=(N,)) + +problem += jm.sum(N, lambda i: A[i] * x[i]) + +problem.generate_random_dataset( + options={ + "A": {"value": range(-10, 10), "size": range(1,10),} + }, +) +``` + +`shape`の一部が未指定のプレースホルダーの場合(たとえば`shape=(None, 10)`など)、要素数が未指定になっている次元はそれぞれ`size`を参照して要素数を決めます。`shape`の情報が優先されるので、要素数が完全に定義されているプレースホルダーに`size`オプションをつけても意味ありません。 + ++++ + +## 辞書型プレースホルダー + +カテゴリーラベル型をキーとしている辞書型のプレースホルダーの場合、`options`でそのカテゴリーラベルに該当するキーを定義する必要があります。カテゴリーラベルのオプションに`keys`に文字列の配列を設定すると、キー集合を明示的に定義できます。たとえば、カテゴリーラベル`C`のキー集合をX、Y、Zにするには以下のように書きます。 + +```python +{ "C": {"keys": ["X", "Y", "Z"]} } +``` + +`C` をキー集合にしている辞書型プレースホルダーは、`keys`に渡された各文字列に対して値を生成します。範囲指定はスカラーと配列型と同じで、`default`を渡すか、各プレースホルダーの`options`で指定することができます。 + +生成したいインスタンスにとってカテゴリーラベルで実際使われる文字列がなんでもよいという場合、カテゴリーラベルのオプションに`keys`ではなく、`size`をすることも可能です(固定値も範囲指定も可)。その場合、その数だけの文字列が適当に生成されます。 + +`PartialDict`含め、デフォルトで全辞書型プレースホルダーで全域に対して値を生成するということになっています。`PartialDict`のキーを制限したいときは、そのプレースホルダーのオプションに追加で`keys`か`size`を渡す必要があります。 +たとえば、`C`がキー集合になっている `D` プレースホルダー(`PartialDict`)がある場合は次のように書きます。 + +```python +{ "C": {"keys": ["X", "Y", "Z"]}, "D": {"keys": ["X", "Y"], "value": range(10, 100)} } } +``` + +上記はカテゴリーラベルに`keys`を設定している時のみ使える書き方で、`"D"`の`keys`がキー集合の部分集合になっていないとエラーになるのでご注意ください。 + +一方、プレースホルダーのオプションに`size`を使うことで、キー集合の中からその数だけ任意に選ばれます。この方法だとカテゴリーラベルがどのように定義されても構いません。 +```python +# キーが1個か2個選ばれる場合 +{ "C": {"keys": ["X", "Y", "Z"]}, "D": {"size": range(1, 3), "value": range(10, 100)} } } +# キーが1個から4個選ばれる場合 +{ "C": {"size": range(3, 10)}, "D": {"size": range(1, 5), "value": range(10, 100)} } } +``` diff --git a/markdowns/ja/advanced/named_expr.md b/markdowns/ja/advanced/named_expr.md new file mode 100644 index 00000000..28b57d8a --- /dev/null +++ b/markdowns/ja/advanced/named_expr.md @@ -0,0 +1,249 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.19.1 +kernelspec: + display_name: .venv + language: python + name: python3 +--- + +# 式の命名とインスタンスへの保存 + +JijModeling では、名前つきの式を表すクラスとして {py:class}`~jijmodeling.NamedExpr` クラスが提供されており、 +決定変数やプレースホルダーと同様に、 {py:meth}`Problem.NamedExpr() ` メソッドを使って宣言することができます。 +{py:meth}`Problem.NamedExpr() ` の引数は以下の通りです。 + +| 引数 | 型 | 説明 | +| :-- | :--: | :-- | +| `name` | `str` | 名前つき式の名前。Decorator API では省略可能。 | +| `definition` | 必須。{py:data}`~jijmodeling.ExpressionLike` | 名前つき式の定義。JijModeling の式オブジェクトや、Python の数値、文字列、タプル、リスト、辞書、NumPy 配列など、式に変換可能なオブジェクトを指定できます。 | +| `description` | `Optional[str]` | 省略可。名前つき式の説明。数式出力や OMMX に保存される式の説明に使用されます。 | +| `latex` | `Optional[str]` | 省略可。名前つき式の $\LaTeX$ 表現。数式出力時に使用されます。 | +| `save_in_ommx` | `bool` | 省略可(デフォルト:`False`)。`True` にすると、後述する条件を満たす場合、OMMX インスタンスに {py:class}`ommx.v1.NamedFunction` として保存されます。 | + +{py:class}`~jijmodeling.NamedExpr` には、以下の 2 つの使い方があります。 + +1. 特定の式に対して名前をつけて $\LaTeX$ 表示を見やすくする +2. 特定の式を OMMX インスタンスに保存して求解後にその式の値を評価する + +本ドキュメントでは、 {py:class}`~jijmodeling.NamedExpr` のこれらの使い方について具体例を交えながら説明していきます。 + ++++ + +# 式の命名 + +特定の式に対して名前をつけて $\LaTeX$ 表示を見やすくする例を見てみましょう。ナップサック問題において、アイテム数 $N$ をインスタンスデータとして与えるのではなく、各アイテムの重さを表すプレースホルダー配列 $w$ の長さから推論することを考えます。 +まずは、 {py:meth}`~jijmodeling.Problem.NamedExpr` を使わずに定式化すると以下のようになります。 + +```{code-cell} ipython3 +import jijmodeling as jm + + +@jm.Problem.define("Knapsack (Unnamed)", sense=jm.ProblemSense.MAXIMIZE) +def knapsack_unnamed(problem: jm.DecoratedProblem): + W = problem.Float(description="maximum weight capacity of the knapsack") + w = problem.Float(ndim=1, description="weight of each item") + # w の長さから N を推論させる + N = w.len_at(0) + v = problem.Float(shape=(N,), description="value of each item") + x = problem.BinaryVar( + shape=(N,), description="$x_i = 1$ if item i is put in the knapsack" + ) + + problem += jm.sum(v[i] * x[i] for i in N) + problem += problem.Constraint("Weight", jm.sum(w[i] * x[i] for i in N) <= W) + + +knapsack_unnamed +``` + +$\LaTeX$ 表示を見るとわかる通り、$N$ の定義式 `len_at(w, 0)` が定義中で展開されてしまっており、特に総和の範囲などがみづらくなっています。 +そこで、$N$ を {py:meth}`~jijmodeling.Problem.NamedExpr` を使って定義してみましょう。 + +```{code-cell} ipython3 +@jm.Problem.define("Knapsack", sense=jm.ProblemSense.MAXIMIZE) +def knapsack(problem: jm.DecoratedProblem): + W = problem.Float(description="maximum weight capacity of the knapsack") + w = problem.Float(ndim=1, description="weight of each item") + # w の長さに対して NamedExpr を利用して N という名前をつける + N = problem.NamedExpr(w.len_at(0), description="Length of w") + v = problem.Float(shape=(N,), description="value of each item") + x = problem.BinaryVar( + shape=(N,), description="$x_i = 1$ if item i is put in the knapsack" + ) + + problem += jm.sum(v[i] * x[i] for i in N) + problem += problem.Constraint("Weight", jm.sum(w[i] * x[i] for i in N) <= W) + + +knapsack +``` + +末尾の `Named Expressions` 節に $N$ の定義式が現れ、残りの数式中でも $N$ として表示されるようになり、$\LaTeX$ 表示としても見やすくなりました。 + ++++ + +また、 {py:meth}`~jijmodeling.Problem.NamedExpr` で定義された $N$ は JijModeling の数理モデルの中では変数の一種として扱われますが、コンパイル時に自動で展開されるため、 {py:meth}`~jijmodeling.Problem.NamedExpr` の有無で OMMX インスタンスが変わることはありません。 + +```{code-cell} ipython3 +knapsack_instance_data = { + "v": [10, 13, 18, 31, 7, 15], + "w": [11, 15, 20, 35, 10, 33], + "W": 47, +} + +instance_named = knapsack.eval(knapsack_instance_data) +instance_unnamed = knapsack_unnamed.eval(knapsack_instance_data) + +assert instance_named.objective.almost_equal(instance_unnamed.objective) +assert instance_named.constraints[0].function.almost_equal( + instance_unnamed.constraints[0].function +) +``` + +:::{tip} +数理モデルに登録されている {py:class}`~jijmodeling.NamedExpr` の一覧は、 {py:meth}`jijmodeling.Problem.named_exprs` で確認できます。 +::: + ++++ + +## インタンスへの保存 + +{py:class}`~jijmodeling.Problem.NamedExpr` の `save_in_ommx` 引数に `True` を設定することで、以下の条件を満たす場合に限り、その式を OMMX インスタンスに保存することができます。 + +1. 取りうる値がスカラーである式 +2. 取りうる値がスカラーである式の配列 +3. 取りうる値がスカラーである式の辞書 + +具体的には、以下のような式が OMMX インスタンスに保存できます。 + +```{code-cell} ipython3 +# 取りうる値がスカラーである式(例: バイナリ変数の和) +problem = jm.Problem("Scalar") +x = problem.BinaryVar("x", shape=(5,)) +S = problem.NamedExpr("scalar", x.sum(), save_in_ommx=True) +problem +``` + +```{code-cell} ipython3 +# 取りうる値がスカラーである式の配列(例: 整数変数の配列の差) +problem = jm.Problem("Tensor of Scalars") +y = problem.IntegerVar("y", shape=(5,), lower_bound=0, upper_bound=10) +z = problem.IntegerVar("z", shape=(5,), lower_bound=0, upper_bound=10) +T = problem.NamedExpr("tensor_of_scalars", y - z, save_in_ommx=True) +problem +``` + +```{code-cell} ipython3 +# 取りうる値がスカラーである式の辞書(例: プレースホルダと実数変数の辞書の積) +problem = jm.Problem("Dict of Scalars") +K = problem.CategoryLabel("K") +a = problem.Float("a", dict_keys=K) +w = problem.ContinuousVar("w", dict_keys=K, lower_bound=0, upper_bound=10) +U = problem.NamedExpr("dict_of_scalars", a * w, save_in_ommx=True) +problem +``` + +一方で、以下のような式は OMMX インスタンスに保存できません。 + +```{code-cell} ipython3 +problem = jm.Problem("Errornous Problem") +``` + +```{code-cell} ipython3 +# 比較式は保存できない +a = problem.IntegerVar("a", lower_bound=0, upper_bound=10) +try: + problem.NamedExpr("comparison", a == 2, save_in_ommx=True) +except Exception as e: + print(e) +``` + +```{code-cell} ipython3 +# カテゴリラベルは保存できない +L = problem.CategoryLabel("L") +try: + problem.NamedExpr("category_labels", L, save_in_ommx=True) +except Exception as e: + print(e) +``` + +```{code-cell} ipython3 +# rows() は配列の配列を返すので保存できない +x = problem.BinaryVar("M", shape=(5, 5)) +try: + problem.NamedExpr("array_of_array", x.rows(), save_in_ommx=True) +except Exception as e: + print(e) +``` + +:::{tip} +これらの OMMX インスタンスに保存できない式についても、 `save_in_ommx=False`(あるいは、未指定)にすれば `NamedExpr` として宣言することができます。 +::: + ++++ + +では、特定の式を OMMX インスタンスに保存して求解後にその式の値を評価する例を見てみましょう。ナップサック問題において、目的関数であるアイテムの価値の合計だけでなく、アイテムの総重量を知りたいというケースを考えます。 + +```{code-cell} ipython3 +@jm.Problem.define("Knapsack", sense=jm.ProblemSense.MAXIMIZE) +def knapsack_weight(problem: jm.DecoratedProblem): + W = problem.Float(description="maximum weight capacity of the knapsack") + w = problem.Float(ndim=1, description="weight of each item") + N = problem.NamedExpr(w.len_at(0), description="Length of w") + v = problem.Float(shape=(N,), description="value of each item") + x = problem.BinaryVar( + shape=(N,), description="$x_i = 1$ if item i is put in the knapsack" + ) + total_weight = problem.NamedExpr( + jm.sum(w[i] * x[i] for i in N), + description="Total weight of items in the knapsack", + save_in_ommx=True, + ) + + problem += jm.sum(v[i] * x[i] for i in N) + problem += problem.Constraint("Weight", total_weight <= W) + + +knapsack_weight +``` + +上記のコードでは、総重量の式に `total_weight` という名前をつけ、`save_in_ommx=True` により OMMX インスタンスの保存を有効にしています。さて、この数理モデルをコンパイルして OMMX インスタンスを生成してみましょう。 + +```{code-cell} ipython3 +instance = knapsack_weight.eval(knapsack_instance_data) +``` + +OMMX インスタンスに保存された式は、 {py:meth}`ommx.v1.Instance.named_functions` や {py:meth}`ommx.v1.Instance.named_functions_df` プロパティで確認することができます。 + +```{code-cell} ipython3 +instance.named_functions_df +``` + +:::{tip} +OMMX インスタンスに保存された式に対応する NamedFunction の ID を得るには、{py:meth}`Compiler.get_named_function_id_by_name() ` メソッドを利用してください。 +::: + ++++ + +それでは、この OMMX インスタンスを OpenJij で解き、得られた解における `total_weight` の値を確認してみましょう。 + +```{code-cell} ipython3 +from ommx_openjij_adapter import OMMXOpenJijSAAdapter + +solution = OMMXOpenJijSAAdapter.solve( + instance, + num_reads=100, + num_sweeps=10, + uniform_penalty_weight=1.6, +) + +solution.named_functions_df +``` + +確かに OMMX インスタンスに保存した式 `total_weight` の値を評価することができました。 +このような用法以外にも、特定の式を OMMX インスタンスに保存する機能は、加重方式の多目的最適化を扱う場合などに利用できる便利なものとなっています。 diff --git a/markdowns/ja/advanced/serialize.md b/markdowns/ja/advanced/serialize.md new file mode 100644 index 00000000..68fa0e72 --- /dev/null +++ b/markdowns/ja/advanced/serialize.md @@ -0,0 +1,33 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.19.1 +kernelspec: + display_name: Python 3 (ipykernel) + language: python + name: python3 +--- + +# 数理モデルのシリアライズ + +JijModeling で作られた数理モデルは、[Protobuf](https://protobuf.dev) で簡単にシリアライズできます。具体的には、{py:func}`jijmodeling.to_protobuf`関数か`Problem.to_protobuf `メソッドを使えばシリアライズできます。 + +```{code-cell} ipython3 +import jijmodeling as jm + +problem = jm.Problem("my problem") +N = problem.Placeholder("N", dtype=jm.DataType.NATURAL) +x = problem.BinaryVar("x", shape=(N,)) +problem += x.sum() + +serialized = problem.to_protobuf() +``` + +デシリアライズは、{py:func}`jijmodeling.from_protobuf` か{py:meth}`Problem.from_protobuf `で行えます。 + +```{code-cell} ipython3 +deserialized = jm.from_protobuf(serialized) +``` diff --git a/markdowns/ja/basics/expressions.md b/markdowns/ja/basics/expressions.md index d7e77edc..683f175e 100644 --- a/markdowns/ja/basics/expressions.md +++ b/markdowns/ja/basics/expressions.md @@ -147,7 +147,7 @@ except Exception as e: | 型名 | 説明 | | --- | --- | -| `ExpressionLike` | {py:class}`~jijmodeling.Expression` に変換することができる型を表す。 {py:class}`~jijmodeling.Expression` 自身の他、{py:class}`~jijmodeling.Placeholder`, {py:class}`~jijmodeling.DecisionVar`, {py:class}`~jijmodeling.DependentVar`や、Python の数値、文字列、それらからなるタプル、リスト・辞書・Numpy配列などが文脈に応じて使えます。 | +| `ExpressionLike` | {py:class}`~jijmodeling.Expression` に変換することができる型を表す。 {py:class}`~jijmodeling.Expression` 自身の他、{py:class}`~jijmodeling.Placeholder`, {py:class}`~jijmodeling.DecisionVar`, {py:class}`~jijmodeling.NamedExpr`や、Python の数値、文字列、それらからなるタプル、リスト・辞書・Numpy配列などが文脈に応じて使えます。 | | `ExpressoinFunction` | 一つ以上の {py:class}`~jijmodeling.Expression` オブジェクトを取り、 {py:class}`~jijmodeling.Expression` を返す関数。Pythonの型ヒントの仕組み上、最大5つの引数までしか列挙していませんが、実際には引数の個数に上限はありません。 | ::: @@ -336,6 +336,7 @@ JijModeling では、「特定の型の値からなる一連の値」を表す ::: 一部の型の値は自動的に集合へと変換されます。たとえば、多次元配列は、要素を行優先順で走査する集合に、自然数$N$は集合 $\{0, 1, \ldots, N-1\}$ に、カテゴリーラベル `L` はコンパイル時に与えられる`L`の値全体の集合へと自動的に変換されます。 +また、JijModeling 2.3.1 から Python 組込みの {py:class}`range() ` 関数に対応する、{py:func}`jijmodeling.range` 関数も提供されており、自然数の等差数列からなる集合を定義することができます。 :::{admonition} JijModeling 1 系統からの変更点:配列の「集合」としての振る舞い :class: caution diff --git a/markdowns/ja/basics/modeling.md b/markdowns/ja/basics/modeling.md index 53201cbe..7ceec201 100644 --- a/markdowns/ja/basics/modeling.md +++ b/markdowns/ja/basics/modeling.md @@ -80,6 +80,12 @@ problem 既存の項が置き換えられたのではなく、$y$ が加算され $x + y$ が新たな目的関数となっていることが分かります。 目的関数の項を削除したい場合、目的関数の項の一覧を(Python の)リストなどで持っておき、あとからそれを使って目的関数を設定するなどするとよいでしょう。 +:::{admonition} 目的関数から項を「引く」操作 +:class: tip + +JijModeling 2.3.1 以降では、{py:class}`~jijmodeling.Problem` に対して {py:meth}`-= ` 演算子を使うことで、数値型の {py:class}`~jijmodeling.Expression` オブジェクトを目的関数から「引く」こともできます。 +::: + ## 制約条件の設定 制約条件の追加も同様に {py:meth}`+= ` 演算子を使って行います。 @@ -119,6 +125,12 @@ knapsack_problem 制約条件を追加する際には、必ず {py:meth}`+= ` 演算子を使って追加してください。単純に {py:meth}`Problem.Constraint() ` を呼び出しただけでは、制約条件はモデルに追加されません。 ::: +:::{admonition} 制約条件の削除 +:class: important + +現時点において、モデルから制約条件を削除する方法は提供されていません。特に、{py:func}`-= ` 演算子を使ってモデルから制約条件を「引く」ことはできませんので注意してください。 +::: + +++ ### 制約条件の族 diff --git a/markdowns/ja/references/cheat_sheet.md b/markdowns/ja/references/cheat_sheet.md index de67e799..1eb54ae4 100644 --- a/markdowns/ja/references/cheat_sheet.md +++ b/markdowns/ja/references/cheat_sheet.md @@ -55,7 +55,7 @@ problem ```{code-cell} ipython3 problem = jm.Problem("WeightedSum") a = problem.Float("a", ndim=1) -N = problem.DependentVar("N", a.len_at(0)) +N = problem.NamedExpr("N", a.len_at(0)) x = problem.BinaryVar("x", shape=(N,)) problem += jm.sum(a * x) @@ -68,7 +68,7 @@ problem @jm.Problem.define("WeightedSum") def problem(problem: jm.DecoratedProblem): a = problem.Float(ndim=1) - N = problem.DependentVar(a.len_at(0)) + N = problem.NamedExpr(a.len_at(0)) x = problem.BinaryVar(shape=(N,)) problem += (a * x).sum() @@ -206,7 +206,7 @@ problem = jm.Problem("DependentSum") N = problem.Natural("N") x = problem.BinaryVar("x", shape=(N,)) a = problem.Natural("a", ndim=1) -M = problem.DependentVar("M", a.len_at(0)) +M = problem.NamedExpr("M", a.len_at(0)) problem += jm.sum(jm.flat_map(lambda i: a[i].map(lambda j: x[j]), M)) problem @@ -220,7 +220,7 @@ def problem(problem: jm.DecoratedProblem): N = problem.Natural() x = problem.BinaryVar(shape=(N,)) a = problem.Natural(ndim=1) - M = problem.DependentVar(a.len_at(0)) + M = problem.NamedExpr(a.len_at(0)) problem += jm.sum(x[j] for i in M for j in a[i]) problem @@ -292,7 +292,7 @@ problem ```{code-cell} ipython3 problem = jm.Problem("2D K-Hot") K = problem.Natural("K", ndim=1) -N = problem.DependentVar("N", K.len_at(0)) +N = problem.NamedExpr("N", K.len_at(0)) M = problem.Natural("M") x = problem.BinaryVar("x", shape=(N, M)) problem += problem.Constraint("2d k-hot", x.sum(axis=1) == K) @@ -306,7 +306,7 @@ problem @jm.Problem.define("2D K-Hot") def problem(problem: jm.DecoratedProblem): K = problem.Natural(ndim=1) - N = problem.DependentVar(K.len_at(0)) + N = problem.NamedExpr(K.len_at(0)) M = problem.Natural() x = problem.BinaryVar(shape=(N, M)) problem += problem.Constraint("2d k-hot", x.sum(axis=1) == K) @@ -324,7 +324,7 @@ problem problem = jm.Problem("KHotOverSet") N = problem.Natural("N") C = problem.Natural("C", jagged=True, ndim=2) -M = problem.DependentVar("M", C.len_at(0)) +M = problem.NamedExpr("M", C.len_at(0)) K = problem.Natural("K", shape=(M,)) x = problem.BinaryVar("x", shape=(N,)) problem += problem.Constraint( @@ -341,7 +341,7 @@ problem def problem(problem: jm.DecoratedProblem): N = problem.Natural() C = problem.Natural(jagged=True, ndim=2) - M = problem.DependentVar(C.len_at(0)) + M = problem.NamedExpr(C.len_at(0)) K = problem.Natural(shape=(M,)) x = problem.BinaryVar(shape=(N,)) problem += problem.Constraint( @@ -360,7 +360,7 @@ problem ```{code-cell} ipython3 problem = jm.Problem("LinearInequality") w = problem.Float("w", ndim=1) -N = problem.DependentVar("N", w.len_at(0)) +N = problem.NamedExpr("N", w.len_at(0)) W = problem.Float("W") x = problem.BinaryVar("x", shape=(N,)) problem += problem.Constraint("weight", (w * x).sum() <= W) @@ -374,7 +374,7 @@ problem @jm.Problem.define("LinearInequality") def problem(problem: jm.DecoratedProblem): w = problem.Float(ndim=1) - N = problem.DependentVar(w.len_at(0)) + N = problem.NamedExpr(w.len_at(0)) W = problem.Float() x = problem.BinaryVar(shape=(N,)) problem += problem.Constraint("weight", (w * x).sum() <= W) diff --git a/markdowns/ja/references/migration_guide_to_jijmodeling2.md b/markdowns/ja/references/migration_guide_to_jijmodeling2.md index a8f1a58d..de13385d 100644 --- a/markdowns/ja/references/migration_guide_to_jijmodeling2.md +++ b/markdowns/ja/references/migration_guide_to_jijmodeling2.md @@ -62,7 +62,7 @@ https://jij-inc-jijmodeling-tutorials-en.readthedocs-hosted.com/en/jijmodeling1 * 実数値:`problem.Float()` - これらの利用により意図がより明確になり、また正確な型チェックによる精度の高いエラーメッセージが得られるようになります。高度なケース(タプルなどのカスタム`dtype`)にのみ`Placeholder`を使用してください。 -7. **従属変数の導入**:新たに導入された`problem.DependentVar(..)`宣言により、頻出する部分式を従属変数として束縛・再利用できるようになりました。これにより、従来の JijModeling で`with_latex()`や`latex=...`で定義された$\LaTeX$上の変数の定義がわからなくなる問題が解消されます。 +7. **従属変数の導入**:新たに導入された`problem.NamedExpr(..)`や`problem.NamedExpr(..)`宣言により、頻出する部分式を名前つき式として束縛・再利用できるようになりました。これにより、従来の JijModeling で`with_latex()`や`latex=...`で定義された$\LaTeX$上の変数の定義がわからなくなる問題が解消されます。 8. **新しいデータ型**: JijModeling 2 では辞書型とカテゴリーラベル型が追加されました! - 従来 Jagged Array で書いていた多くのケースが、辞書を使ってより簡潔に記述できるようになりました! @@ -795,7 +795,7 @@ problem = jm.Problem("KHotOverSet", sense=jm.ProblemSense.MINIMIZE) def _(problem: jm.DecoratedProblem): N = problem.Length() C = problem.Natural(jagged=True, ndim=2) - M = problem.DependentVar(C.len_at(0)) + M = problem.NamedExpr(C.len_at(0)) K = problem.Placeholder(dtype=jm.DataType.NATURAL, shape=(M,)) x = problem.BinaryVar(shape=(N,)) @@ -841,7 +841,7 @@ problem = jm.Problem("CompilerDemo", sense=jm.ProblemSense.MAXIMIZE) def _(problem: jm.DecoratedProblem): v = problem.Placeholder(dtype=jm.DataType.FLOAT, ndim=1) w = problem.Placeholder(dtype=jm.DataType.FLOAT, ndim=1) - N = problem.DependentVar(v.len_at(0)) + N = problem.NamedExpr(v.len_at(0)) W = problem.Float() x = problem.BinaryVar(shape=(N,)) diff --git a/markdowns/ja/releases/jijmodeling-2.3.1.md b/markdowns/ja/releases/jijmodeling-2.3.1.md new file mode 100644 index 00000000..2f674915 --- /dev/null +++ b/markdowns/ja/releases/jijmodeling-2.3.1.md @@ -0,0 +1,92 @@ +--- +jupytext: + text_representation: + extension: .md + format_name: myst + format_version: 0.13 + jupytext_version: 1.19.1 +kernelspec: + display_name: .venv + language: python + name: python3 +--- + +# JijModeling 2.3.1 リリースノート + ++++ + +## 機能強化 + ++++ + +### `jm.range` 関数の追加 + +{py:class}`~jijmodeling.Expression` を使用した値シーケンスを表する関数、 {py:func}`jijmodeling.range` を追加しました。使い方は基本的に python 組み込みの {py:class}`range() ` と似ています。 + +例は以下の通りです: + +```{code-cell} ipython3 +import jijmodeling as jm + + +@jm.Problem.define("RangeProblem") +def problem(problem: jm.DecoratedProblem): + S = problem.Natural() + F = problem.Natural() + N = problem.Natural() + x = problem.BinaryVar(shape=(10,)) + problem += jm.sum(x[i] for i in jm.range(S, F, N)) +``` + +### `Problem`の`-=`演算子で目的関数更新の対応 + +{py:class}`~jijmodeling.Problem` に `-=` 演算子を追加しました。 `-=` を使って目的関数から項を引くことができます。 + +`+=` とは異なり、 `-=` で制約条件を削除することはできません。 + +```{code-cell} ipython3 +problem = jm.Problem("problem") +x = problem.ContinuousVar("x", lower_bound=0, upper_bound=5) +y = problem.ContinuousVar("y", lower_bound=0, upper_bound=5) + +problem += x +problem -= y +assert jm.is_same(problem.objective, x - y) +``` + +### `DependentVar` が `NamedExpr` に + +JijModeling 2.3 以前では、依存変数を表す `DependentVar` クラスが存在していました。 +名前の印象に反し、この機能は Placeholder の長さなど決定変数に依存しないような値を定義するためにも用いることができました。 +この状況は混乱を招く恐れがあるため、 `DependentVar` クラスは廃止され、同様の機能を提供する {py:class}`~jijmodeling.NamedExpr` クラスが定義されました。今後は {py:class}`~jijmodeling.NamedExpr` をご利用ください。 + +詳細については {doc}`../advanced/named_expr` を御参照ください。 + +## バグ修正 + ++++ + +### 修正:スライス記法内にバグ束縛変数が現れられるように + +スライス記法内の束縛変数の扱いを修正し、内包表記や制約の添え字で束縛された変数がスライス記法内で正しく扱われるようになりました。 + +### 修正:添え字つき制約内での自然数上の総和・所属関係の $\LaTeX$ 出力の修正 + +これまでの実装では、添え字つき制約の定義域が自然数であったり、総和の範囲が自然数であったりした場合、以下のように所属関係が $\in$ を使って出力されていました: + +$$ +\text{c1}:\quad\sum _{j\in {N}_{1}}{{x}_{i,j}}=1\quad \forall i\;\text{s.t.}\;i\in {N}_{0} +$$ + +本リリースから、目的関数や単独の制約の場合と同様、以下のように自然な出力が行われるようになりました: + +```{code-cell} ipython3 +problem = jm.Problem("P") +N = problem.Natural("N", shape=2) +x = problem.BinaryVar("x", shape=(N[0], N[1])) +problem.Constraint("c1", lambda i: jm.sum(N[1], lambda j: x[i, j]) == 1, domain=N[0]) +``` + +### 修正:未使用のプレースホルダーがある場合のランダムインスタンス生成で発生する復旧不能エラー + +問題定義に未使用のプレースホルダーが含まれていた場合、ランダムインスタンス生成時に panic が発生する不具合を修正しました。 diff --git a/package-lock.json b/package-lock.json index 1675cd2a..a57ac349 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1166,6 +1166,7 @@ "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.1", @@ -1811,6 +1812,7 @@ "integrity": "sha512-FA5LmZVF1VziNc0bIdCSA1IoSVnDCqE8HJIZZv2/W8YmoAM50+tnUgJR/gQZwEeIMleuIOnRnHA/UaZRNeV4iQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@keyv/serialize": "^1.1.1" } @@ -3208,7 +3210,8 @@ "version": "16.0.0", "resolved": "https://registry.npmjs.org/sudachi-synonyms-dictionary/-/sudachi-synonyms-dictionary-16.0.0.tgz", "integrity": "sha512-2Tms1VA5QPRC7kOoxZznvnu6XXcl2ddglvNGKcMpxOKAbDZG5fZsS8GfpsJQSIfLKj5oZT2mxveMPWlHvqdedw==", - "license": "Apache-2.0" + "license": "Apache-2.0", + "peer": true }, "node_modules/supports-color": { "version": "7.2.0", @@ -3821,6 +3824,7 @@ "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "dev": true, "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/pyproject.toml b/pyproject.toml index a4f7169b..a0b6d3ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ dependencies = [ "jijmodeling>=2.0.0,<3", "ommx-openjij-adapter >= 2.3.4, < 3.0.0", "ommx-pyscipopt-adapter >= 2.3.4, < 3.0.0", - "ommx >= 2.3.4, < 3.0.0", + "ommx >= 2.5.0, < 3.0.0", ] [project.optional-dependencies] diff --git a/requirements.txt b/requirements.txt index d681fcc7..5d7bf613 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ dimod==0.12.21 # openjij jij-cimod==1.7.3 # via openjij -jijmodeling==2.2.0 +jijmodeling==2.3.1 # via jijmodeling-tutorial (pyproject.toml) numpy==2.3.5 # via @@ -18,15 +18,15 @@ numpy==2.3.5 # pandas # pyscipopt # scipy -ommx==2.3.5 +ommx==2.5.1 # via # jijmodeling-tutorial (pyproject.toml) # jijmodeling # ommx-openjij-adapter # ommx-pyscipopt-adapter -ommx-openjij-adapter==2.3.5 +ommx-openjij-adapter==2.5.1 # via jijmodeling-tutorial (pyproject.toml) -ommx-pyscipopt-adapter==2.3.5 +ommx-pyscipopt-adapter==2.5.1 # via jijmodeling-tutorial (pyproject.toml) openjij==0.11.6 # via ommx-openjij-adapter @@ -46,7 +46,7 @@ python-dateutil==2.9.0.post0 # via # ommx # pandas -pytz==2025.2 +pytz==2026.1.post1 # via pandas scipy==1.15.3 # via jij-cimod diff --git a/uv.lock b/uv.lock index 3e9fea18..53bf9371 100644 --- a/uv.lock +++ b/uv.lock @@ -47,11 +47,11 @@ wheels = [ [[package]] name = "attrs" -version = "25.4.0" +version = "26.1.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/6b/5c/685e6633917e101e5dcb62b9dd76946cbb57c26e133bae9e0cd36033c0a9/attrs-25.4.0.tar.gz", hash = "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11", size = 934251, upload-time = "2025-10-06T13:54:44.725Z" } +sdist = { url = "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32", size = 952055, upload-time = "2026-03-19T14:22:25.026Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/3a/2a/7cc015f5b9f5db42b7d48157e23356022889fc354a2813c15934b7cb5c0e/attrs-25.4.0-py3-none-any.whl", hash = "sha256:adcf7e2a1fb3b36ac48d97835bb6d8ade15b8dcce26aba8bf1d14847b57a3373", size = 67615, upload-time = "2025-10-06T13:54:43.17Z" }, + { url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" }, ] [[package]] @@ -152,59 +152,59 @@ wheels = [ [[package]] name = "charset-normalizer" -version = "3.4.4" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/13/69/33ddede1939fdd074bce5434295f38fae7136463422fe4fd3e0e89b98062/charset_normalizer-3.4.4.tar.gz", hash = "sha256:94537985111c35f28720e43603b8e7b43a6ecfb2ce1d3058bbe955b73404e21a", size = 129418, upload-time = "2025-10-14T04:42:32.879Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ed/27/c6491ff4954e58a10f69ad90aca8a1b6fe9c5d3c6f380907af3c37435b59/charset_normalizer-3.4.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6e1fcf0720908f200cd21aa4e6750a48ff6ce4afe7ff5a79a90d5ed8a08296f8", size = 206988, upload-time = "2025-10-14T04:40:33.79Z" }, - { url = "https://files.pythonhosted.org/packages/94/59/2e87300fe67ab820b5428580a53cad894272dbb97f38a7a814a2a1ac1011/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5f819d5fe9234f9f82d75bdfa9aef3a3d72c4d24a6e57aeaebba32a704553aa0", size = 147324, upload-time = "2025-10-14T04:40:34.961Z" }, - { url = "https://files.pythonhosted.org/packages/07/fb/0cf61dc84b2b088391830f6274cb57c82e4da8bbc2efeac8c025edb88772/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a59cb51917aa591b1c4e6a43c132f0cdc3c76dbad6155df4e28ee626cc77a0a3", size = 142742, upload-time = "2025-10-14T04:40:36.105Z" }, - { url = "https://files.pythonhosted.org/packages/62/8b/171935adf2312cd745d290ed93cf16cf0dfe320863ab7cbeeae1dcd6535f/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8ef3c867360f88ac904fd3f5e1f902f13307af9052646963ee08ff4f131adafc", size = 160863, upload-time = "2025-10-14T04:40:37.188Z" }, - { url = "https://files.pythonhosted.org/packages/09/73/ad875b192bda14f2173bfc1bc9a55e009808484a4b256748d931b6948442/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d9e45d7faa48ee908174d8fe84854479ef838fc6a705c9315372eacbc2f02897", size = 157837, upload-time = "2025-10-14T04:40:38.435Z" }, - { url = "https://files.pythonhosted.org/packages/6d/fc/de9cce525b2c5b94b47c70a4b4fb19f871b24995c728e957ee68ab1671ea/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:840c25fb618a231545cbab0564a799f101b63b9901f2569faecd6b222ac72381", size = 151550, upload-time = "2025-10-14T04:40:40.053Z" }, - { url = "https://files.pythonhosted.org/packages/55/c2/43edd615fdfba8c6f2dfbd459b25a6b3b551f24ea21981e23fb768503ce1/charset_normalizer-3.4.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ca5862d5b3928c4940729dacc329aa9102900382fea192fc5e52eb69d6093815", size = 149162, upload-time = "2025-10-14T04:40:41.163Z" }, - { url = "https://files.pythonhosted.org/packages/03/86/bde4ad8b4d0e9429a4e82c1e8f5c659993a9a863ad62c7df05cf7b678d75/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d9c7f57c3d666a53421049053eaacdd14bbd0a528e2186fcb2e672effd053bb0", size = 150019, upload-time = "2025-10-14T04:40:42.276Z" }, - { url = "https://files.pythonhosted.org/packages/1f/86/a151eb2af293a7e7bac3a739b81072585ce36ccfb4493039f49f1d3cae8c/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:277e970e750505ed74c832b4bf75dac7476262ee2a013f5574dd49075879e161", size = 143310, upload-time = "2025-10-14T04:40:43.439Z" }, - { url = "https://files.pythonhosted.org/packages/b5/fe/43dae6144a7e07b87478fdfc4dbe9efd5defb0e7ec29f5f58a55aeef7bf7/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:31fd66405eaf47bb62e8cd575dc621c56c668f27d46a61d975a249930dd5e2a4", size = 162022, upload-time = "2025-10-14T04:40:44.547Z" }, - { url = "https://files.pythonhosted.org/packages/80/e6/7aab83774f5d2bca81f42ac58d04caf44f0cc2b65fc6db2b3b2e8a05f3b3/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:0d3d8f15c07f86e9ff82319b3d9ef6f4bf907608f53fe9d92b28ea9ae3d1fd89", size = 149383, upload-time = "2025-10-14T04:40:46.018Z" }, - { url = "https://files.pythonhosted.org/packages/4f/e8/b289173b4edae05c0dde07f69f8db476a0b511eac556dfe0d6bda3c43384/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:9f7fcd74d410a36883701fafa2482a6af2ff5ba96b9a620e9e0721e28ead5569", size = 159098, upload-time = "2025-10-14T04:40:47.081Z" }, - { url = "https://files.pythonhosted.org/packages/d8/df/fe699727754cae3f8478493c7f45f777b17c3ef0600e28abfec8619eb49c/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ebf3e58c7ec8a8bed6d66a75d7fb37b55e5015b03ceae72a8e7c74495551e224", size = 152991, upload-time = "2025-10-14T04:40:48.246Z" }, - { url = "https://files.pythonhosted.org/packages/1a/86/584869fe4ddb6ffa3bd9f491b87a01568797fb9bd8933f557dba9771beaf/charset_normalizer-3.4.4-cp311-cp311-win32.whl", hash = "sha256:eecbc200c7fd5ddb9a7f16c7decb07b566c29fa2161a16cf67b8d068bd21690a", size = 99456, upload-time = "2025-10-14T04:40:49.376Z" }, - { url = "https://files.pythonhosted.org/packages/65/f6/62fdd5feb60530f50f7e38b4f6a1d5203f4d16ff4f9f0952962c044e919a/charset_normalizer-3.4.4-cp311-cp311-win_amd64.whl", hash = "sha256:5ae497466c7901d54b639cf42d5b8c1b6a4fead55215500d2f486d34db48d016", size = 106978, upload-time = "2025-10-14T04:40:50.844Z" }, - { url = "https://files.pythonhosted.org/packages/7a/9d/0710916e6c82948b3be62d9d398cb4fcf4e97b56d6a6aeccd66c4b2f2bd5/charset_normalizer-3.4.4-cp311-cp311-win_arm64.whl", hash = "sha256:65e2befcd84bc6f37095f5961e68a6f077bf44946771354a28ad434c2cce0ae1", size = 99969, upload-time = "2025-10-14T04:40:52.272Z" }, - { url = "https://files.pythonhosted.org/packages/f3/85/1637cd4af66fa687396e757dec650f28025f2a2f5a5531a3208dc0ec43f2/charset_normalizer-3.4.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0a98e6759f854bd25a58a73fa88833fba3b7c491169f86ce1180c948ab3fd394", size = 208425, upload-time = "2025-10-14T04:40:53.353Z" }, - { url = "https://files.pythonhosted.org/packages/9d/6a/04130023fef2a0d9c62d0bae2649b69f7b7d8d24ea5536feef50551029df/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b5b290ccc2a263e8d185130284f8501e3e36c5e02750fc6b6bdeb2e9e96f1e25", size = 148162, upload-time = "2025-10-14T04:40:54.558Z" }, - { url = "https://files.pythonhosted.org/packages/78/29/62328d79aa60da22c9e0b9a66539feae06ca0f5a4171ac4f7dc285b83688/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74bb723680f9f7a6234dcf67aea57e708ec1fbdf5699fb91dfd6f511b0a320ef", size = 144558, upload-time = "2025-10-14T04:40:55.677Z" }, - { url = "https://files.pythonhosted.org/packages/86/bb/b32194a4bf15b88403537c2e120b817c61cd4ecffa9b6876e941c3ee38fe/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f1e34719c6ed0b92f418c7c780480b26b5d9c50349e9a9af7d76bf757530350d", size = 161497, upload-time = "2025-10-14T04:40:57.217Z" }, - { url = "https://files.pythonhosted.org/packages/19/89/a54c82b253d5b9b111dc74aca196ba5ccfcca8242d0fb64146d4d3183ff1/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2437418e20515acec67d86e12bf70056a33abdacb5cb1655042f6538d6b085a8", size = 159240, upload-time = "2025-10-14T04:40:58.358Z" }, - { url = "https://files.pythonhosted.org/packages/c0/10/d20b513afe03acc89ec33948320a5544d31f21b05368436d580dec4e234d/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11d694519d7f29d6cd09f6ac70028dba10f92f6cdd059096db198c283794ac86", size = 153471, upload-time = "2025-10-14T04:40:59.468Z" }, - { url = "https://files.pythonhosted.org/packages/61/fa/fbf177b55bdd727010f9c0a3c49eefa1d10f960e5f09d1d887bf93c2e698/charset_normalizer-3.4.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ac1c4a689edcc530fc9d9aa11f5774b9e2f33f9a0c6a57864e90908f5208d30a", size = 150864, upload-time = "2025-10-14T04:41:00.623Z" }, - { url = "https://files.pythonhosted.org/packages/05/12/9fbc6a4d39c0198adeebbde20b619790e9236557ca59fc40e0e3cebe6f40/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:21d142cc6c0ec30d2efee5068ca36c128a30b0f2c53c1c07bd78cb6bc1d3be5f", size = 150647, upload-time = "2025-10-14T04:41:01.754Z" }, - { url = "https://files.pythonhosted.org/packages/ad/1f/6a9a593d52e3e8c5d2b167daf8c6b968808efb57ef4c210acb907c365bc4/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:5dbe56a36425d26d6cfb40ce79c314a2e4dd6211d51d6d2191c00bed34f354cc", size = 145110, upload-time = "2025-10-14T04:41:03.231Z" }, - { url = "https://files.pythonhosted.org/packages/30/42/9a52c609e72471b0fc54386dc63c3781a387bb4fe61c20231a4ebcd58bdd/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:5bfbb1b9acf3334612667b61bd3002196fe2a1eb4dd74d247e0f2a4d50ec9bbf", size = 162839, upload-time = "2025-10-14T04:41:04.715Z" }, - { url = "https://files.pythonhosted.org/packages/c4/5b/c0682bbf9f11597073052628ddd38344a3d673fda35a36773f7d19344b23/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d055ec1e26e441f6187acf818b73564e6e6282709e9bcb5b63f5b23068356a15", size = 150667, upload-time = "2025-10-14T04:41:05.827Z" }, - { url = "https://files.pythonhosted.org/packages/e4/24/a41afeab6f990cf2daf6cb8c67419b63b48cf518e4f56022230840c9bfb2/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:af2d8c67d8e573d6de5bc30cdb27e9b95e49115cd9baad5ddbd1a6207aaa82a9", size = 160535, upload-time = "2025-10-14T04:41:06.938Z" }, - { url = "https://files.pythonhosted.org/packages/2a/e5/6a4ce77ed243c4a50a1fecca6aaaab419628c818a49434be428fe24c9957/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:780236ac706e66881f3b7f2f32dfe90507a09e67d1d454c762cf642e6e1586e0", size = 154816, upload-time = "2025-10-14T04:41:08.101Z" }, - { url = "https://files.pythonhosted.org/packages/a8/ef/89297262b8092b312d29cdb2517cb1237e51db8ecef2e9af5edbe7b683b1/charset_normalizer-3.4.4-cp312-cp312-win32.whl", hash = "sha256:5833d2c39d8896e4e19b689ffc198f08ea58116bee26dea51e362ecc7cd3ed26", size = 99694, upload-time = "2025-10-14T04:41:09.23Z" }, - { url = "https://files.pythonhosted.org/packages/3d/2d/1e5ed9dd3b3803994c155cd9aacb60c82c331bad84daf75bcb9c91b3295e/charset_normalizer-3.4.4-cp312-cp312-win_amd64.whl", hash = "sha256:a79cfe37875f822425b89a82333404539ae63dbdddf97f84dcbc3d339aae9525", size = 107131, upload-time = "2025-10-14T04:41:10.467Z" }, - { url = "https://files.pythonhosted.org/packages/d0/d9/0ed4c7098a861482a7b6a95603edce4c0d9db2311af23da1fb2b75ec26fc/charset_normalizer-3.4.4-cp312-cp312-win_arm64.whl", hash = "sha256:376bec83a63b8021bb5c8ea75e21c4ccb86e7e45ca4eb81146091b56599b80c3", size = 100390, upload-time = "2025-10-14T04:41:11.915Z" }, - { url = "https://files.pythonhosted.org/packages/97/45/4b3a1239bbacd321068ea6e7ac28875b03ab8bc0aa0966452db17cd36714/charset_normalizer-3.4.4-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:e1f185f86a6f3403aa2420e815904c67b2f9ebc443f045edd0de921108345794", size = 208091, upload-time = "2025-10-14T04:41:13.346Z" }, - { url = "https://files.pythonhosted.org/packages/7d/62/73a6d7450829655a35bb88a88fca7d736f9882a27eacdca2c6d505b57e2e/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b39f987ae8ccdf0d2642338faf2abb1862340facc796048b604ef14919e55ed", size = 147936, upload-time = "2025-10-14T04:41:14.461Z" }, - { url = "https://files.pythonhosted.org/packages/89/c5/adb8c8b3d6625bef6d88b251bbb0d95f8205831b987631ab0c8bb5d937c2/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3162d5d8ce1bb98dd51af660f2121c55d0fa541b46dff7bb9b9f86ea1d87de72", size = 144180, upload-time = "2025-10-14T04:41:15.588Z" }, - { url = "https://files.pythonhosted.org/packages/91/ed/9706e4070682d1cc219050b6048bfd293ccf67b3d4f5a4f39207453d4b99/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:81d5eb2a312700f4ecaa977a8235b634ce853200e828fbadf3a9c50bab278328", size = 161346, upload-time = "2025-10-14T04:41:16.738Z" }, - { url = "https://files.pythonhosted.org/packages/d5/0d/031f0d95e4972901a2f6f09ef055751805ff541511dc1252ba3ca1f80cf5/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5bd2293095d766545ec1a8f612559f6b40abc0eb18bb2f5d1171872d34036ede", size = 158874, upload-time = "2025-10-14T04:41:17.923Z" }, - { url = "https://files.pythonhosted.org/packages/f5/83/6ab5883f57c9c801ce5e5677242328aa45592be8a00644310a008d04f922/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a8a8b89589086a25749f471e6a900d3f662d1d3b6e2e59dcecf787b1cc3a1894", size = 153076, upload-time = "2025-10-14T04:41:19.106Z" }, - { url = "https://files.pythonhosted.org/packages/75/1e/5ff781ddf5260e387d6419959ee89ef13878229732732ee73cdae01800f2/charset_normalizer-3.4.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc7637e2f80d8530ee4a78e878bce464f70087ce73cf7c1caf142416923b98f1", size = 150601, upload-time = "2025-10-14T04:41:20.245Z" }, - { url = "https://files.pythonhosted.org/packages/d7/57/71be810965493d3510a6ca79b90c19e48696fb1ff964da319334b12677f0/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f8bf04158c6b607d747e93949aa60618b61312fe647a6369f88ce2ff16043490", size = 150376, upload-time = "2025-10-14T04:41:21.398Z" }, - { url = "https://files.pythonhosted.org/packages/e5/d5/c3d057a78c181d007014feb7e9f2e65905a6c4ef182c0ddf0de2924edd65/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:554af85e960429cf30784dd47447d5125aaa3b99a6f0683589dbd27e2f45da44", size = 144825, upload-time = "2025-10-14T04:41:22.583Z" }, - { url = "https://files.pythonhosted.org/packages/e6/8c/d0406294828d4976f275ffbe66f00266c4b3136b7506941d87c00cab5272/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:74018750915ee7ad843a774364e13a3db91682f26142baddf775342c3f5b1133", size = 162583, upload-time = "2025-10-14T04:41:23.754Z" }, - { url = "https://files.pythonhosted.org/packages/d7/24/e2aa1f18c8f15c4c0e932d9287b8609dd30ad56dbe41d926bd846e22fb8d/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:c0463276121fdee9c49b98908b3a89c39be45d86d1dbaa22957e38f6321d4ce3", size = 150366, upload-time = "2025-10-14T04:41:25.27Z" }, - { url = "https://files.pythonhosted.org/packages/e4/5b/1e6160c7739aad1e2df054300cc618b06bf784a7a164b0f238360721ab86/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:362d61fd13843997c1c446760ef36f240cf81d3ebf74ac62652aebaf7838561e", size = 160300, upload-time = "2025-10-14T04:41:26.725Z" }, - { url = "https://files.pythonhosted.org/packages/7a/10/f882167cd207fbdd743e55534d5d9620e095089d176d55cb22d5322f2afd/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9a26f18905b8dd5d685d6d07b0cdf98a79f3c7a918906af7cc143ea2e164c8bc", size = 154465, upload-time = "2025-10-14T04:41:28.322Z" }, - { url = "https://files.pythonhosted.org/packages/89/66/c7a9e1b7429be72123441bfdbaf2bc13faab3f90b933f664db506dea5915/charset_normalizer-3.4.4-cp313-cp313-win32.whl", hash = "sha256:9b35f4c90079ff2e2edc5b26c0c77925e5d2d255c42c74fdb70fb49b172726ac", size = 99404, upload-time = "2025-10-14T04:41:29.95Z" }, - { url = "https://files.pythonhosted.org/packages/c4/26/b9924fa27db384bdcd97ab83b4f0a8058d96ad9626ead570674d5e737d90/charset_normalizer-3.4.4-cp313-cp313-win_amd64.whl", hash = "sha256:b435cba5f4f750aa6c0a0d92c541fb79f69a387c91e61f1795227e4ed9cece14", size = 107092, upload-time = "2025-10-14T04:41:31.188Z" }, - { url = "https://files.pythonhosted.org/packages/af/8f/3ed4bfa0c0c72a7ca17f0380cd9e4dd842b09f664e780c13cff1dcf2ef1b/charset_normalizer-3.4.4-cp313-cp313-win_arm64.whl", hash = "sha256:542d2cee80be6f80247095cc36c418f7bddd14f4a6de45af91dfad36d817bba2", size = 100408, upload-time = "2025-10-14T04:41:32.624Z" }, - { url = "https://files.pythonhosted.org/packages/0a/4c/925909008ed5a988ccbb72dcc897407e5d6d3bd72410d69e051fc0c14647/charset_normalizer-3.4.4-py3-none-any.whl", hash = "sha256:7a32c560861a02ff789ad905a2fe94e3f840803362c84fecf1851cb4cf3dc37f", size = 53402, upload-time = "2025-10-14T04:42:31.76Z" }, +version = "3.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7b/60/e3bec1881450851b087e301bedc3daa9377a4d45f1c26aa90b0b235e38aa/charset_normalizer-3.4.6.tar.gz", hash = "sha256:1ae6b62897110aa7c79ea2f5dd38d1abca6db663687c0b1ad9aed6f6bae3d9d6", size = 143363, upload-time = "2026-03-15T18:53:25.478Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/62/28/ff6f234e628a2de61c458be2779cb182bc03f6eec12200d4a525bbfc9741/charset_normalizer-3.4.6-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:82060f995ab5003a2d6e0f4ad29065b7672b6593c8c63559beefe5b443242c3e", size = 293582, upload-time = "2026-03-15T18:50:25.454Z" }, + { url = "https://files.pythonhosted.org/packages/1c/b7/b1a117e5385cbdb3205f6055403c2a2a220c5ea80b8716c324eaf75c5c95/charset_normalizer-3.4.6-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:60c74963d8350241a79cb8feea80e54d518f72c26db618862a8f53e5023deaf9", size = 197240, upload-time = "2026-03-15T18:50:27.196Z" }, + { url = "https://files.pythonhosted.org/packages/a1/5f/2574f0f09f3c3bc1b2f992e20bce6546cb1f17e111c5be07308dc5427956/charset_normalizer-3.4.6-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f6e4333fb15c83f7d1482a76d45a0818897b3d33f00efd215528ff7c51b8e35d", size = 217363, upload-time = "2026-03-15T18:50:28.601Z" }, + { url = "https://files.pythonhosted.org/packages/4a/d1/0ae20ad77bc949ddd39b51bf383b6ca932f2916074c95cad34ae465ab71f/charset_normalizer-3.4.6-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:bc72863f4d9aba2e8fd9085e63548a324ba706d2ea2c83b260da08a59b9482de", size = 212994, upload-time = "2026-03-15T18:50:30.102Z" }, + { url = "https://files.pythonhosted.org/packages/60/ac/3233d262a310c1b12633536a07cde5ddd16985e6e7e238e9f3f9423d8eb9/charset_normalizer-3.4.6-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9cc4fc6c196d6a8b76629a70ddfcd4635a6898756e2d9cac5565cf0654605d73", size = 204697, upload-time = "2026-03-15T18:50:31.654Z" }, + { url = "https://files.pythonhosted.org/packages/25/3c/8a18fc411f085b82303cfb7154eed5bd49c77035eb7608d049468b53f87c/charset_normalizer-3.4.6-cp311-cp311-manylinux_2_31_armv7l.whl", hash = "sha256:0c173ce3a681f309f31b87125fecec7a5d1347261ea11ebbb856fa6006b23c8c", size = 191673, upload-time = "2026-03-15T18:50:33.433Z" }, + { url = "https://files.pythonhosted.org/packages/ff/a7/11cfe61d6c5c5c7438d6ba40919d0306ed83c9ab957f3d4da2277ff67836/charset_normalizer-3.4.6-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c907cdc8109f6c619e6254212e794d6548373cc40e1ec75e6e3823d9135d29cc", size = 201120, upload-time = "2026-03-15T18:50:35.105Z" }, + { url = "https://files.pythonhosted.org/packages/b5/10/cf491fa1abd47c02f69687046b896c950b92b6cd7337a27e6548adbec8e4/charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:404a1e552cf5b675a87f0651f8b79f5f1e6fd100ee88dc612f89aa16abd4486f", size = 200911, upload-time = "2026-03-15T18:50:36.819Z" }, + { url = "https://files.pythonhosted.org/packages/28/70/039796160b48b18ed466fde0af84c1b090c4e288fae26cd674ad04a2d703/charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:e3c701e954abf6fc03a49f7c579cc80c2c6cc52525340ca3186c41d3f33482ef", size = 192516, upload-time = "2026-03-15T18:50:38.228Z" }, + { url = "https://files.pythonhosted.org/packages/ff/34/c56f3223393d6ff3124b9e78f7de738047c2d6bc40a4f16ac0c9d7a1cb3c/charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:7a6967aaf043bceabab5412ed6bd6bd26603dae84d5cb75bf8d9a74a4959d398", size = 218795, upload-time = "2026-03-15T18:50:39.664Z" }, + { url = "https://files.pythonhosted.org/packages/e8/3b/ce2d4f86c5282191a041fdc5a4ce18f1c6bd40a5bd1f74cf8625f08d51c1/charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:5feb91325bbceade6afab43eb3b508c63ee53579fe896c77137ded51c6b6958e", size = 201833, upload-time = "2026-03-15T18:50:41.552Z" }, + { url = "https://files.pythonhosted.org/packages/3b/9b/b6a9f76b0fd7c5b5ec58b228ff7e85095370282150f0bd50b3126f5506d6/charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:f820f24b09e3e779fe84c3c456cb4108a7aa639b0d1f02c28046e11bfcd088ed", size = 213920, upload-time = "2026-03-15T18:50:43.33Z" }, + { url = "https://files.pythonhosted.org/packages/ae/98/7bc23513a33d8172365ed30ee3a3b3fe1ece14a395e5fc94129541fc6003/charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b35b200d6a71b9839a46b9b7fff66b6638bb52fc9658aa58796b0326595d3021", size = 206951, upload-time = "2026-03-15T18:50:44.789Z" }, + { url = "https://files.pythonhosted.org/packages/32/73/c0b86f3d1458468e11aec870e6b3feac931facbe105a894b552b0e518e79/charset_normalizer-3.4.6-cp311-cp311-win32.whl", hash = "sha256:9ca4c0b502ab399ef89248a2c84c54954f77a070f28e546a85e91da627d1301e", size = 143703, upload-time = "2026-03-15T18:50:46.103Z" }, + { url = "https://files.pythonhosted.org/packages/c6/e3/76f2facfe8eddee0bbd38d2594e709033338eae44ebf1738bcefe0a06185/charset_normalizer-3.4.6-cp311-cp311-win_amd64.whl", hash = "sha256:a9e68c9d88823b274cf1e72f28cb5dc89c990edf430b0bfd3e2fb0785bfeabf4", size = 153857, upload-time = "2026-03-15T18:50:47.563Z" }, + { url = "https://files.pythonhosted.org/packages/e2/dc/9abe19c9b27e6cd3636036b9d1b387b78c40dedbf0b47f9366737684b4b0/charset_normalizer-3.4.6-cp311-cp311-win_arm64.whl", hash = "sha256:97d0235baafca5f2b09cf332cc275f021e694e8362c6bb9c96fc9a0eb74fc316", size = 142751, upload-time = "2026-03-15T18:50:49.234Z" }, + { url = "https://files.pythonhosted.org/packages/e5/62/c0815c992c9545347aeea7859b50dc9044d147e2e7278329c6e02ac9a616/charset_normalizer-3.4.6-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:2ef7fedc7a6ecbe99969cd09632516738a97eeb8bd7258bf8a0f23114c057dab", size = 295154, upload-time = "2026-03-15T18:50:50.88Z" }, + { url = "https://files.pythonhosted.org/packages/a8/37/bdca6613c2e3c58c7421891d80cc3efa1d32e882f7c4a7ee6039c3fc951a/charset_normalizer-3.4.6-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a4ea868bc28109052790eb2b52a9ab33f3aa7adc02f96673526ff47419490e21", size = 199191, upload-time = "2026-03-15T18:50:52.658Z" }, + { url = "https://files.pythonhosted.org/packages/6c/92/9934d1bbd69f7f398b38c5dae1cbf9cc672e7c34a4adf7b17c0a9c17d15d/charset_normalizer-3.4.6-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:836ab36280f21fc1a03c99cd05c6b7af70d2697e374c7af0b61ed271401a72a2", size = 218674, upload-time = "2026-03-15T18:50:54.102Z" }, + { url = "https://files.pythonhosted.org/packages/af/90/25f6ab406659286be929fd89ab0e78e38aa183fc374e03aa3c12d730af8a/charset_normalizer-3.4.6-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f1ce721c8a7dfec21fcbdfe04e8f68174183cf4e8188e0645e92aa23985c57ff", size = 215259, upload-time = "2026-03-15T18:50:55.616Z" }, + { url = "https://files.pythonhosted.org/packages/4e/ef/79a463eb0fff7f96afa04c1d4c51f8fc85426f918db467854bfb6a569ce3/charset_normalizer-3.4.6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0e28d62a8fc7a1fa411c43bd65e346f3bce9716dc51b897fbe930c5987b402d5", size = 207276, upload-time = "2026-03-15T18:50:57.054Z" }, + { url = "https://files.pythonhosted.org/packages/f7/72/d0426afec4b71dc159fa6b4e68f868cd5a3ecd918fec5813a15d292a7d10/charset_normalizer-3.4.6-cp312-cp312-manylinux_2_31_armv7l.whl", hash = "sha256:530d548084c4a9f7a16ed4a294d459b4f229db50df689bfe92027452452943a0", size = 195161, upload-time = "2026-03-15T18:50:58.686Z" }, + { url = "https://files.pythonhosted.org/packages/bf/18/c82b06a68bfcb6ce55e508225d210c7e6a4ea122bfc0748892f3dc4e8e11/charset_normalizer-3.4.6-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:30f445ae60aad5e1f8bdbb3108e39f6fbc09f4ea16c815c66578878325f8f15a", size = 203452, upload-time = "2026-03-15T18:51:00.196Z" }, + { url = "https://files.pythonhosted.org/packages/44/d6/0c25979b92f8adafdbb946160348d8d44aa60ce99afdc27df524379875cb/charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ac2393c73378fea4e52aa56285a3d64be50f1a12395afef9cce47772f60334c2", size = 202272, upload-time = "2026-03-15T18:51:01.703Z" }, + { url = "https://files.pythonhosted.org/packages/2e/3d/7fea3e8fe84136bebbac715dd1221cc25c173c57a699c030ab9b8900cbb7/charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:90ca27cd8da8118b18a52d5f547859cc1f8354a00cd1e8e5120df3e30d6279e5", size = 195622, upload-time = "2026-03-15T18:51:03.526Z" }, + { url = "https://files.pythonhosted.org/packages/57/8a/d6f7fd5cb96c58ef2f681424fbca01264461336d2a7fc875e4446b1f1346/charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:8e5a94886bedca0f9b78fecd6afb6629142fd2605aa70a125d49f4edc6037ee6", size = 220056, upload-time = "2026-03-15T18:51:05.269Z" }, + { url = "https://files.pythonhosted.org/packages/16/50/478cdda782c8c9c3fb5da3cc72dd7f331f031e7f1363a893cdd6ca0f8de0/charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:695f5c2823691a25f17bc5d5ffe79fa90972cc34b002ac6c843bb8a1720e950d", size = 203751, upload-time = "2026-03-15T18:51:06.858Z" }, + { url = "https://files.pythonhosted.org/packages/75/fc/cc2fcac943939c8e4d8791abfa139f685e5150cae9f94b60f12520feaa9b/charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:231d4da14bcd9301310faf492051bee27df11f2bc7549bc0bb41fef11b82daa2", size = 216563, upload-time = "2026-03-15T18:51:08.564Z" }, + { url = "https://files.pythonhosted.org/packages/a8/b7/a4add1d9a5f68f3d037261aecca83abdb0ab15960a3591d340e829b37298/charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a056d1ad2633548ca18ffa2f85c202cfb48b68615129143915b8dc72a806a923", size = 209265, upload-time = "2026-03-15T18:51:10.312Z" }, + { url = "https://files.pythonhosted.org/packages/6c/18/c094561b5d64a24277707698e54b7f67bd17a4f857bbfbb1072bba07c8bf/charset_normalizer-3.4.6-cp312-cp312-win32.whl", hash = "sha256:c2274ca724536f173122f36c98ce188fd24ce3dad886ec2b7af859518ce008a4", size = 144229, upload-time = "2026-03-15T18:51:11.694Z" }, + { url = "https://files.pythonhosted.org/packages/ab/20/0567efb3a8fd481b8f34f739ebddc098ed062a59fed41a8d193a61939e8f/charset_normalizer-3.4.6-cp312-cp312-win_amd64.whl", hash = "sha256:c8ae56368f8cc97c7e40a7ee18e1cedaf8e780cd8bc5ed5ac8b81f238614facb", size = 154277, upload-time = "2026-03-15T18:51:13.004Z" }, + { url = "https://files.pythonhosted.org/packages/15/57/28d79b44b51933119e21f65479d0864a8d5893e494cf5daab15df0247c17/charset_normalizer-3.4.6-cp312-cp312-win_arm64.whl", hash = "sha256:899d28f422116b08be5118ef350c292b36fc15ec2daeb9ea987c89281c7bb5c4", size = 142817, upload-time = "2026-03-15T18:51:14.408Z" }, + { url = "https://files.pythonhosted.org/packages/1e/1d/4fdabeef4e231153b6ed7567602f3b68265ec4e5b76d6024cf647d43d981/charset_normalizer-3.4.6-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:11afb56037cbc4b1555a34dd69151e8e069bee82e613a73bef6e714ce733585f", size = 294823, upload-time = "2026-03-15T18:51:15.755Z" }, + { url = "https://files.pythonhosted.org/packages/47/7b/20e809b89c69d37be748d98e84dce6820bf663cf19cf6b942c951a3e8f41/charset_normalizer-3.4.6-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:423fb7e748a08f854a08a222b983f4df1912b1daedce51a72bd24fe8f26a1843", size = 198527, upload-time = "2026-03-15T18:51:17.177Z" }, + { url = "https://files.pythonhosted.org/packages/37/a6/4f8d27527d59c039dce6f7622593cdcd3d70a8504d87d09eb11e9fdc6062/charset_normalizer-3.4.6-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d73beaac5e90173ac3deb9928a74763a6d230f494e4bfb422c217a0ad8e629bf", size = 218388, upload-time = "2026-03-15T18:51:18.934Z" }, + { url = "https://files.pythonhosted.org/packages/f6/9b/4770ccb3e491a9bacf1c46cc8b812214fe367c86a96353ccc6daf87b01ec/charset_normalizer-3.4.6-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d60377dce4511655582e300dc1e5a5f24ba0cb229005a1d5c8d0cb72bb758ab8", size = 214563, upload-time = "2026-03-15T18:51:20.374Z" }, + { url = "https://files.pythonhosted.org/packages/2b/58/a199d245894b12db0b957d627516c78e055adc3a0d978bc7f65ddaf7c399/charset_normalizer-3.4.6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:530e8cebeea0d76bdcf93357aa5e41336f48c3dc709ac52da2bb167c5b8271d9", size = 206587, upload-time = "2026-03-15T18:51:21.807Z" }, + { url = "https://files.pythonhosted.org/packages/7e/70/3def227f1ec56f5c69dfc8392b8bd63b11a18ca8178d9211d7cc5e5e4f27/charset_normalizer-3.4.6-cp313-cp313-manylinux_2_31_armv7l.whl", hash = "sha256:a26611d9987b230566f24a0a125f17fe0de6a6aff9f25c9f564aaa2721a5fb88", size = 194724, upload-time = "2026-03-15T18:51:23.508Z" }, + { url = "https://files.pythonhosted.org/packages/58/ab/9318352e220c05efd31c2779a23b50969dc94b985a2efa643ed9077bfca5/charset_normalizer-3.4.6-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:34315ff4fc374b285ad7f4a0bf7dcbfe769e1b104230d40f49f700d4ab6bbd84", size = 202956, upload-time = "2026-03-15T18:51:25.239Z" }, + { url = "https://files.pythonhosted.org/packages/75/13/f3550a3ac25b70f87ac98c40d3199a8503676c2f1620efbf8d42095cfc40/charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5f8ddd609f9e1af8c7bd6e2aca279c931aefecd148a14402d4e368f3171769fd", size = 201923, upload-time = "2026-03-15T18:51:26.682Z" }, + { url = "https://files.pythonhosted.org/packages/1b/db/c5c643b912740b45e8eec21de1bbab8e7fc085944d37e1e709d3dcd9d72f/charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:80d0a5615143c0b3225e5e3ef22c8d5d51f3f72ce0ea6fb84c943546c7b25b6c", size = 195366, upload-time = "2026-03-15T18:51:28.129Z" }, + { url = "https://files.pythonhosted.org/packages/5a/67/3b1c62744f9b2448443e0eb160d8b001c849ec3fef591e012eda6484787c/charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:92734d4d8d187a354a556626c221cd1a892a4e0802ccb2af432a1d85ec012194", size = 219752, upload-time = "2026-03-15T18:51:29.556Z" }, + { url = "https://files.pythonhosted.org/packages/f6/98/32ffbaf7f0366ffb0445930b87d103f6b406bc2c271563644bde8a2b1093/charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:613f19aa6e082cf96e17e3ffd89383343d0d589abda756b7764cf78361fd41dc", size = 203296, upload-time = "2026-03-15T18:51:30.921Z" }, + { url = "https://files.pythonhosted.org/packages/41/12/5d308c1bbe60cabb0c5ef511574a647067e2a1f631bc8634fcafaccd8293/charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:2b1a63e8224e401cafe7739f77efd3f9e7f5f2026bda4aead8e59afab537784f", size = 215956, upload-time = "2026-03-15T18:51:32.399Z" }, + { url = "https://files.pythonhosted.org/packages/53/e9/5f85f6c5e20669dbe56b165c67b0260547dea97dba7e187938833d791687/charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6cceb5473417d28edd20c6c984ab6fee6c6267d38d906823ebfe20b03d607dc2", size = 208652, upload-time = "2026-03-15T18:51:34.214Z" }, + { url = "https://files.pythonhosted.org/packages/f1/11/897052ea6af56df3eef3ca94edafee410ca699ca0c7b87960ad19932c55e/charset_normalizer-3.4.6-cp313-cp313-win32.whl", hash = "sha256:d7de2637729c67d67cf87614b566626057e95c303bc0a55ffe391f5205e7003d", size = 143940, upload-time = "2026-03-15T18:51:36.15Z" }, + { url = "https://files.pythonhosted.org/packages/a1/5c/724b6b363603e419829f561c854b87ed7c7e31231a7908708ac086cdf3e2/charset_normalizer-3.4.6-cp313-cp313-win_amd64.whl", hash = "sha256:572d7c822caf521f0525ba1bce1a622a0b85cf47ffbdae6c9c19e3b5ac3c4389", size = 154101, upload-time = "2026-03-15T18:51:37.876Z" }, + { url = "https://files.pythonhosted.org/packages/01/a5/7abf15b4c0968e47020f9ca0935fb3274deb87cb288cd187cad92e8cdffd/charset_normalizer-3.4.6-cp313-cp313-win_arm64.whl", hash = "sha256:a4474d924a47185a06411e0064b803c68be044be2d60e50e8bddcc2649957c1f", size = 143109, upload-time = "2026-03-15T18:51:39.565Z" }, + { url = "https://files.pythonhosted.org/packages/2a/68/687187c7e26cb24ccbd88e5069f5ef00eba804d36dde11d99aad0838ab45/charset_normalizer-3.4.6-py3-none-any.whl", hash = "sha256:947cf925bc916d90adba35a64c82aace04fa39b46b52d4630ece166655905a69", size = 61455, upload-time = "2026-03-15T18:53:23.833Z" }, ] [[package]] @@ -375,23 +375,23 @@ wheels = [ [[package]] name = "imagesize" -version = "1.4.1" +version = "2.0.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/a7/84/62473fb57d61e31fef6e36d64a179c8781605429fd927b5dd608c997be31/imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a", size = 1280026, upload-time = "2022-07-01T12:21:05.687Z" } +sdist = { url = "https://files.pythonhosted.org/packages/6c/e6/7bf14eeb8f8b7251141944835abd42eb20a658d89084b7e1f3e5fe394090/imagesize-2.0.0.tar.gz", hash = "sha256:8e8358c4a05c304f1fccf7ff96f036e7243a189e9e42e90851993c558cfe9ee3", size = 1773045, upload-time = "2026-03-03T14:18:29.941Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ff/62/85c4c919272577931d407be5ba5d71c20f0b616d31a0befe0ae45bb79abd/imagesize-1.4.1-py2.py3-none-any.whl", hash = "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b", size = 8769, upload-time = "2022-07-01T12:21:02.467Z" }, + { url = "https://files.pythonhosted.org/packages/5f/53/fb7122b71361a0d121b669dcf3d31244ef75badbbb724af388948de543e2/imagesize-2.0.0-py2.py3-none-any.whl", hash = "sha256:5667c5bbb57ab3f1fa4bc366f4fbc971db3d5ed011fd2715fd8001f782718d96", size = 9441, upload-time = "2026-03-03T14:18:27.892Z" }, ] [[package]] name = "importlib-metadata" -version = "8.7.1" +version = "9.0.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "zipp" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/f3/49/3b30cad09e7771a4982d9975a8cbf64f00d4a1ececb53297f1d9a7be1b10/importlib_metadata-8.7.1.tar.gz", hash = "sha256:49fef1ae6440c182052f407c8d34a68f72efc36db9ca90dc0113398f2fdde8bb", size = 57107, upload-time = "2025-12-21T10:00:19.278Z" } +sdist = { url = "https://files.pythonhosted.org/packages/a9/01/15bb152d77b21318514a96f43af312635eb2500c96b55398d020c93d86ea/importlib_metadata-9.0.0.tar.gz", hash = "sha256:a4f57ab599e6a2e3016d7595cfd72eb4661a5106e787a95bcc90c7105b831efc", size = 56405, upload-time = "2026-03-20T06:42:56.999Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/fa/5e/f8e9a1d23b9c20a551a8a02ea3637b4642e22c2626e3a13a9a29cdea99eb/importlib_metadata-8.7.1-py3-none-any.whl", hash = "sha256:5a1f80bf1daa489495071efbb095d75a634cf28a8bc299581244063b53176151", size = 27865, upload-time = "2025-12-21T10:00:18.329Z" }, + { url = "https://files.pythonhosted.org/packages/38/3d/2d244233ac4f76e38533cfcb2991c9eb4c7bf688ae0a036d30725b8faafe/importlib_metadata-9.0.0-py3-none-any.whl", hash = "sha256:2d21d1cc5a017bd0559e36150c21c830ab1dc304dedd1b7ea85d20f45ef3edd7", size = 27789, upload-time = "2026-03-20T06:42:55.665Z" }, ] [[package]] @@ -402,7 +402,8 @@ dependencies = [ { name = "appnope", marker = "sys_platform == 'darwin'" }, { name = "comm" }, { name = "debugpy" }, - { name = "ipython" }, + { name = "ipython", version = "9.10.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, + { name = "ipython", version = "9.11.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, { name = "jupyter-client" }, { name = "jupyter-core" }, { name = "matplotlib-inline" }, @@ -422,17 +423,20 @@ wheels = [ name = "ipython" version = "9.10.0" source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.12'", +] dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, - { name = "decorator" }, - { name = "ipython-pygments-lexers" }, - { name = "jedi" }, - { name = "matplotlib-inline" }, - { name = "pexpect", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" }, - { name = "prompt-toolkit" }, - { name = "pygments" }, - { name = "stack-data" }, - { name = "traitlets" }, + { name = "colorama", marker = "python_full_version < '3.12' and sys_platform == 'win32'" }, + { name = "decorator", marker = "python_full_version < '3.12'" }, + { name = "ipython-pygments-lexers", marker = "python_full_version < '3.12'" }, + { name = "jedi", marker = "python_full_version < '3.12'" }, + { name = "matplotlib-inline", marker = "python_full_version < '3.12'" }, + { name = "pexpect", marker = "python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'" }, + { name = "prompt-toolkit", marker = "python_full_version < '3.12'" }, + { name = "pygments", marker = "python_full_version < '3.12'" }, + { name = "stack-data", marker = "python_full_version < '3.12'" }, + { name = "traitlets", marker = "python_full_version < '3.12'" }, { name = "typing-extensions", marker = "python_full_version < '3.12'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a6/60/2111715ea11f39b1535bed6024b7dec7918b71e5e5d30855a5b503056b50/ipython-9.10.0.tar.gz", hash = "sha256:cd9e656be97618a0676d058134cd44e6dc7012c0e5cb36a9ce96a8c904adaf77", size = 4426526, upload-time = "2026-02-02T10:00:33.594Z" } @@ -440,6 +444,30 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3d/aa/898dec789a05731cd5a9f50605b7b44a72bd198fd0d4528e11fc610177cc/ipython-9.10.0-py3-none-any.whl", hash = "sha256:c6ab68cc23bba8c7e18e9b932797014cc61ea7fd6f19de180ab9ba73e65ee58d", size = 622774, upload-time = "2026-02-02T10:00:31.503Z" }, ] +[[package]] +name = "ipython" +version = "9.11.0" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.12'", +] +dependencies = [ + { name = "colorama", marker = "python_full_version >= '3.12' and sys_platform == 'win32'" }, + { name = "decorator", marker = "python_full_version >= '3.12'" }, + { name = "ipython-pygments-lexers", marker = "python_full_version >= '3.12'" }, + { name = "jedi", marker = "python_full_version >= '3.12'" }, + { name = "matplotlib-inline", marker = "python_full_version >= '3.12'" }, + { name = "pexpect", marker = "python_full_version >= '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'" }, + { name = "prompt-toolkit", marker = "python_full_version >= '3.12'" }, + { name = "pygments", marker = "python_full_version >= '3.12'" }, + { name = "stack-data", marker = "python_full_version >= '3.12'" }, + { name = "traitlets", marker = "python_full_version >= '3.12'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/86/28/a4698eda5a8928a45d6b693578b135b753e14fa1c2b36ee9441e69a45576/ipython-9.11.0.tar.gz", hash = "sha256:2a94bc4406b22ecc7e4cb95b98450f3ea493a76bec8896cda11b78d7752a6667", size = 4427354, upload-time = "2026-03-05T08:57:30.549Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b2/90/45c72becc57158facc6a6404f663b77bbcea2519ca57f760e2879ae1315d/ipython-9.11.0-py3-none-any.whl", hash = "sha256:6922d5bcf944c6e525a76a0a304451b60a2b6f875e86656d8bc2dfda5d710e19", size = 624222, upload-time = "2026-03-05T08:57:28.94Z" }, +] + [[package]] name = "ipython-pygments-lexers" version = "1.1.1" @@ -494,7 +522,7 @@ wheels = [ [[package]] name = "jijmodeling" -version = "2.2.0" +version = "2.3.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "numpy" }, @@ -504,13 +532,13 @@ dependencies = [ { name = "typing-extensions" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/c6/e5/be1634a6928e06d0deefc8c55acb30edfb24bca92f8db5b11f20e9657b9b/jijmodeling-2.2.0-cp38-abi3-macosx_10_16_x86_64.whl", hash = "sha256:c993650b874eba3878ba7bf467b5c3d09735889fcbb39b98db9ec9d0181cae32", size = 11231693, upload-time = "2026-02-26T05:55:43.859Z" }, - { url = "https://files.pythonhosted.org/packages/8d/98/a1d6507738d9a2eb63dbcf0a6218fba4380ad967ab7e4fbf26d4c1fd0435/jijmodeling-2.2.0-cp38-abi3-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl", hash = "sha256:8033f711ceea1f580a1bec43e7a158e40834873cca0d835f8df4dc0e4083501b", size = 21978765, upload-time = "2026-02-26T05:55:47.665Z" }, - { url = "https://files.pythonhosted.org/packages/de/4d/6a2fca0eeea9554e8a075c201d46235c7a2809351c7a7e2bd4ca9c77fbe0/jijmodeling-2.2.0-cp38-abi3-macosx_12_0_x86_64.macosx_12_0_arm64.macosx_12_0_universal2.whl", hash = "sha256:4edaa4b5992a9d96f10ebd3246e9b327bc307f63f73299a416047ddbe008996a", size = 21979161, upload-time = "2026-02-26T05:55:50.834Z" }, - { url = "https://files.pythonhosted.org/packages/82/d3/96e6ac408dd028ad671134cd523d2a3777cf400d58becde1c506c8b6dc10/jijmodeling-2.2.0-cp38-abi3-macosx_13_0_x86_64.macosx_13_0_arm64.macosx_13_0_universal2.whl", hash = "sha256:57766be24a77d24d81aa62ad6a559aa1fa599d9fac1d55ca51b54976bf583e13", size = 21979159, upload-time = "2026-02-26T05:55:53.753Z" }, - { url = "https://files.pythonhosted.org/packages/e6/83/3943f68016c53e1eaf4489916ce3623cf768354dbf84eeccf6ea9a16a8ed/jijmodeling-2.2.0-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:726a803e667508d8f8b2b38754e66b6baa851e3e3d1123b3223174526e3d45e1", size = 10912736, upload-time = "2026-02-26T05:55:56.33Z" }, - { url = "https://files.pythonhosted.org/packages/2d/32/135eb317454222fa13d7ec69fa2bb8d36dda0c6d03d6204d4426a28696b2/jijmodeling-2.2.0-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:9cfffb4abfac8814cbbe2d5b4cc820450ef040ea33b4f294b7a64703d9c40dc8", size = 11581981, upload-time = "2026-02-26T05:55:58.936Z" }, - { url = "https://files.pythonhosted.org/packages/e1/03/ab8bbc8ab5f9d9b59101d74758fff2a85389d8f2578e5803749f4c0c2e0d/jijmodeling-2.2.0-cp38-abi3-win_amd64.whl", hash = "sha256:b66f379cc8d220216336683ac260f9a7b129126d2924cb42765dd3e32ea6a811", size = 12881930, upload-time = "2026-02-26T05:56:01.775Z" }, + { url = "https://files.pythonhosted.org/packages/cb/7a/fe320d3b0a2aa3fd1794373c31f09ebc868d2a7f9f0eefc2ef862bb77f99/jijmodeling-2.3.1-cp38-abi3-macosx_10_16_x86_64.whl", hash = "sha256:19452f678b0be23e3105d58562dc070c0bef1c293a6877ead88b55a8ea024b98", size = 11599549, upload-time = "2026-03-24T02:00:41.175Z" }, + { url = "https://files.pythonhosted.org/packages/59/5e/7b960260d942e3a287214dee7ded7d5dc970d054f3d4769b11b343bd97bb/jijmodeling-2.3.1-cp38-abi3-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl", hash = "sha256:0d9b4f3970574fe048d51e5a801818f4621d8ee40633a1e3935a568226e3878a", size = 22683665, upload-time = "2026-03-24T02:00:43.738Z" }, + { url = "https://files.pythonhosted.org/packages/a9/e8/9b7d59d8b5c1935b42879c1f475952b192fe3fd003e525d2af4055d4ca3c/jijmodeling-2.3.1-cp38-abi3-macosx_12_0_x86_64.macosx_12_0_arm64.macosx_12_0_universal2.whl", hash = "sha256:126e3fd443c6804066632dd0b72adce590ba5255a41a73eff172572ee180d52a", size = 22683907, upload-time = "2026-03-24T02:00:46.125Z" }, + { url = "https://files.pythonhosted.org/packages/24/d9/3baac7086cc4bc7b54c80d4497b9196d3158ce5e63a5f1d859c63a1463ca/jijmodeling-2.3.1-cp38-abi3-macosx_13_0_x86_64.macosx_13_0_arm64.macosx_13_0_universal2.whl", hash = "sha256:8130ed2848dd5b243430d4bc8e2096e4e64d975d51e930126c6cd62abe448a15", size = 22683901, upload-time = "2026-03-24T02:00:49.364Z" }, + { url = "https://files.pythonhosted.org/packages/ff/c0/0b280555c99daa7712a59c6b2fe0b9a546927685313ddc387448e9e9e9ad/jijmodeling-2.3.1-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:2c945f25ad120b866bd7087a5990aa4edf4eda39ffa3d716c96b59e2d73b1268", size = 11331641, upload-time = "2026-03-24T02:00:51.772Z" }, + { url = "https://files.pythonhosted.org/packages/c6/cc/0a6a2a0eb0c1505dc3107eae831743f013eec66797c00ca1d34f82030007/jijmodeling-2.3.1-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:8ff32bb6c57d16a32475755faa51d6b6c54c589e221b071eeb98a381cefef60f", size = 12013750, upload-time = "2026-03-24T02:00:53.953Z" }, + { url = "https://files.pythonhosted.org/packages/62/74/5d51e07ae50ceb080d209f3a218aff125d1de47e3b801ebc104b6c1ca624/jijmodeling-2.3.1-cp38-abi3-win_amd64.whl", hash = "sha256:b842816ac8dda0e99b6bf7077cf7603ca7a53f62cca471c9e0f8adba4c994206", size = 13324125, upload-time = "2026-03-24T02:00:56.458Z" }, ] [[package]] @@ -538,7 +566,7 @@ requires-dist = [ { name = "jupyter-book", marker = "extra == 'dev'", specifier = ">=1.0.0,<2.0.0" }, { name = "jupytext", marker = "extra == 'dev'", specifier = ">=1.18.1,<2.0.0" }, { name = "nbconvert", marker = "extra == 'dev'", specifier = ">=7.16.6,<8.0.0" }, - { name = "ommx", specifier = ">=2.3.4,<3.0.0" }, + { name = "ommx", specifier = ">=2.5.0,<3.0.0" }, { name = "ommx-openjij-adapter", specifier = ">=2.3.4,<3.0.0" }, { name = "ommx-pyscipopt-adapter", specifier = ">=2.3.4,<3.0.0" }, { name = "sphinxcontrib-katex", marker = "extra == 'dev'", specifier = ">=0.9.11,<1.0.0" }, @@ -697,14 +725,14 @@ wheels = [ [[package]] name = "linkify-it-py" -version = "2.0.3" +version = "2.1.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "uc-micro-py" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/2a/ae/bb56c6828e4797ba5a4821eec7c43b8bf40f69cda4d4f5f8c8a2810ec96a/linkify-it-py-2.0.3.tar.gz", hash = "sha256:68cda27e162e9215c17d786649d1da0021a451bdc436ef9e0fa0ba5234b9b048", size = 27946, upload-time = "2024-02-04T14:48:04.179Z" } +sdist = { url = "https://files.pythonhosted.org/packages/2e/c9/06ea13676ef354f0af6169587ae292d3e2406e212876a413bf9eece4eb23/linkify_it_py-2.1.0.tar.gz", hash = "sha256:43360231720999c10e9328dc3691160e27a718e280673d444c38d7d3aaa3b98b", size = 29158, upload-time = "2026-03-01T07:48:47.683Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/04/1e/b832de447dee8b582cac175871d2f6c3d5077cc56d5575cadba1fd1cccfa/linkify_it_py-2.0.3-py3-none-any.whl", hash = "sha256:6bcbc417b0ac14323382aef5c5192c0075bf8a9d6b41820a2b66371eac6b6d79", size = 19820, upload-time = "2024-02-04T14:48:02.496Z" }, + { url = "https://files.pythonhosted.org/packages/b4/de/88b3be5c31b22333b3ca2f6ff1de4e863d8fe45aaea7485f591970ec1d3e/linkify_it_py-2.1.0-py3-none-any.whl", hash = "sha256:0d252c1594ecba2ecedc444053db5d3a9b7ec1b0dd929c8f1d74dce89f86c05e", size = 19878, upload-time = "2026-03-01T07:48:46.098Z" }, ] [[package]] @@ -815,12 +843,13 @@ wheels = [ [[package]] name = "myst-nb" -version = "1.3.0" +version = "1.4.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "importlib-metadata" }, { name = "ipykernel" }, - { name = "ipython" }, + { name = "ipython", version = "9.10.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, + { name = "ipython", version = "9.11.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, { name = "jupyter-cache" }, { name = "myst-parser" }, { name = "nbclient" }, @@ -829,9 +858,9 @@ dependencies = [ { name = "sphinx" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/21/83/a894bd8dea7a6e9f053502ee8413484dcbf75a219013d6a72e971c0fecfd/myst_nb-1.3.0.tar.gz", hash = "sha256:df3cd4680f51a5af673fd46b38b562be3559aef1475e906ed0f2e66e4587ce4b", size = 81963, upload-time = "2025-07-13T22:49:38.493Z" } +sdist = { url = "https://files.pythonhosted.org/packages/bd/b4/ff1abeea67e8cfe0a8c033389f6d1d8b0bfecfd611befb5cbdeab884fce6/myst_nb-1.4.0.tar.gz", hash = "sha256:c145598de62446a6fd009773dd071a40d3b76106ace780de1abdfc6961f614c2", size = 82285, upload-time = "2026-03-02T21:14:56.95Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/69/a6/03d410c114b8c4856579b3d294dafc27626a7690a552625eec42b16dfa41/myst_nb-1.3.0-py3-none-any.whl", hash = "sha256:1f36af3c19964960ec4e51ac30949b6ed6df220356ffa8d60dd410885e132d7d", size = 82396, upload-time = "2025-07-13T22:49:37.019Z" }, + { url = "https://files.pythonhosted.org/packages/94/93/0a378b48488879a1d925b42a804edfc6e0cd0ef854220f2dce738a46e7e9/myst_nb-1.4.0-py3-none-any.whl", hash = "sha256:0e2c86e7d3b82c3aa51383f82d6268f7714f3b772c23a796ab09538a8e68b4e4", size = 82555, upload-time = "2026-03-02T21:14:55.652Z" }, ] [[package]] @@ -976,7 +1005,7 @@ wheels = [ [[package]] name = "ommx" -version = "2.3.5" +version = "2.5.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "numpy" }, @@ -987,35 +1016,35 @@ dependencies = [ { name = "typing-extensions" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/27/06/8de39046c9c49bccaf8f7f40a866b7ab5d0c3e4123576bbc97b351c7fb8b/ommx-2.3.5-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:96ec04b7d3c00d974dfd5cb1f34bbf45ad0d43e6d19da5784560dea3a4c54f5e", size = 3850411, upload-time = "2026-02-10T08:10:16.296Z" }, - { url = "https://files.pythonhosted.org/packages/4a/5a/f3d7f38e21693dd30aeebc7abab7fbe6c1c7c628b4520c299446f8a7647b/ommx-2.3.5-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:3330986efaf9df020052db6c5c643fa29e48a063e52c00ef7f54c0ec926e9b9a", size = 36975643, upload-time = "2026-02-10T08:10:18.772Z" }, - { url = "https://files.pythonhosted.org/packages/fa/0e/133495498c6ec75eeb80989efbcc52d3e272b0f10d8fe3524d1a60d42325/ommx-2.3.5-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f8cddbc3655cedf01f4f7d5d6d6acb50378a70089623a4ebd94c5a0a131f32cf", size = 41635539, upload-time = "2026-02-10T08:10:22.149Z" }, - { url = "https://files.pythonhosted.org/packages/f7/7b/73c0422633b5c58745855fac071f9d18cf7b3c0c421e004e96188b5bcbe1/ommx-2.3.5-cp310-abi3-win_amd64.whl", hash = "sha256:87c6999c3aa0a08af0cf6118eedc03ee017748ed70106fac17146f8a829e436f", size = 3435811, upload-time = "2026-02-10T08:10:25.758Z" }, - { url = "https://files.pythonhosted.org/packages/9f/56/65f433f015ce8c6cee9ecc3b5c1e5817d0cd5e32263a22e61410dce991c0/ommx-2.3.5-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:f5d8abab02f6b4cfb6a9bba2671bdb5d5dd5c2f725250e6801268a815ea1d177", size = 3843207, upload-time = "2026-02-10T08:10:27.912Z" }, - { url = "https://files.pythonhosted.org/packages/01/2f/e2ed8cb9a938d5aa5ec427a0d47164b37d0b6854aeda65acfdddee094ce6/ommx-2.3.5-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:af082bffe7a9ef62ef0b9186ef14d8bc38a5b629db7b9923ad9d2e7c41918122", size = 37162719, upload-time = "2026-02-10T08:10:29.831Z" }, - { url = "https://files.pythonhosted.org/packages/53/73/37356f348bd4b374f819d06e771b6251e7b8ed6bb0f4ddf7bdbbe06d6e67/ommx-2.3.5-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:503ae216c5a3e938d5338ba113b9ab7acda3b882bd6426693866ea501e4d7010", size = 41777936, upload-time = "2026-02-10T08:10:32.596Z" }, - { url = "https://files.pythonhosted.org/packages/c4/45/4868a493f8bfc66a3475b069791552437573ab13a6ecc67cc83e35c59c34/ommx-2.3.5-cp313-cp313t-win_amd64.whl", hash = "sha256:de6c7d5b97ddd46f6fb085f5e3a546a4d15804861c65c520a8432b06f0c4e439", size = 3426581, upload-time = "2026-02-10T08:10:35.448Z" }, + { url = "https://files.pythonhosted.org/packages/59/a8/a955688f687b8f95b89ad2e48e092f913979e4094a4318b775edbf495d23/ommx-2.5.1-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:2601e5b665c5ec90841cf1490d4b4793b13107c80293ccf6b93e7e5fabb6ad6d", size = 4112324, upload-time = "2026-03-19T13:04:58.837Z" }, + { url = "https://files.pythonhosted.org/packages/b5/16/c2615c55479fb7bbfa239ad761790144da57f9f812da84e4e5128b093fb7/ommx-2.5.1-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:001cf3eaf7c9b5319c496aeded53f9d8ede8609377c381cdd4b2648437eec26d", size = 39292744, upload-time = "2026-03-19T13:05:02.233Z" }, + { url = "https://files.pythonhosted.org/packages/5f/0c/d2e392e8b0df791e3ad6ca812ab947b527c9b28a47f3e9cf92e0fd2ed043/ommx-2.5.1-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:97c12c212d72fdd9f58d9265c43f2ea34ecfe3a5d1a6457822bac056eca581ea", size = 43595353, upload-time = "2026-03-19T13:05:06.317Z" }, + { url = "https://files.pythonhosted.org/packages/e7/7d/859bfe0e3d97aa8192ed9f287d7f38926c8a8cdc840f5be85f05ed1d02f9/ommx-2.5.1-cp310-abi3-win_amd64.whl", hash = "sha256:bf276ab1a3adceb92badb3aee258b0a3e945d5ddcbee110b2bf27adf2136cbde", size = 3720801, upload-time = "2026-03-19T13:05:09.435Z" }, + { url = "https://files.pythonhosted.org/packages/29/de/f64c2b4feaf3af60aa40ab9da61265eac2763e5a3e7328153acecd252417/ommx-2.5.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:8093a78db1fcc33d180f6a37873249a65cc27524445e30e8cc3f2f2f838899ca", size = 4108998, upload-time = "2026-03-19T13:05:11.544Z" }, + { url = "https://files.pythonhosted.org/packages/a9/ca/5f4ba2097aa2c794cf230a1100617d25a7bf2580511cfee3c71457998064/ommx-2.5.1-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:2b474a32f52dca43b3b6cd74f143b333d90f362ad34f8c570a4bfc1bc4d2c812", size = 39508633, upload-time = "2026-03-19T13:05:15.382Z" }, + { url = "https://files.pythonhosted.org/packages/6d/51/b578960a66d2846aa9d95d3e10ffb4694257671d5ff7d0b9f13b79f50c92/ommx-2.5.1-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:6bc02b632537ba6f433da3a7c2f99500c827157d3393254666d99162c2ea91cf", size = 43831885, upload-time = "2026-03-19T13:05:21.89Z" }, + { url = "https://files.pythonhosted.org/packages/f9/4b/cf9080f24a23bd43f3d0d599a2bcfb6d69eb626747b666e4eb51277e0148/ommx-2.5.1-cp313-cp313t-win_amd64.whl", hash = "sha256:be8a0dbc768d2876b754435801b1640340401660a62956c154056ad3a4a47158", size = 3704435, upload-time = "2026-03-19T13:05:24.84Z" }, ] [[package]] name = "ommx-openjij-adapter" -version = "2.3.5" +version = "2.5.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "ommx" }, { name = "openjij" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/bd/f5/8d72da716ae5b39b1026aba7b589bde5a3c170a9b2fc6cd3f6756726315e/ommx_openjij_adapter-2.3.5.tar.gz", hash = "sha256:5852bd7aea491d1eab01cf54a6221f4337be6dfe7d50b5d74028070123c8f92d", size = 5707, upload-time = "2026-02-10T08:10:45.897Z" } +sdist = { url = "https://files.pythonhosted.org/packages/04/a8/86e263896cccdfd074207e2c70af4a1afc0663be389d7a6b3aafed59e2d1/ommx_openjij_adapter-2.5.1.tar.gz", hash = "sha256:481642ee172d848fe032ae4dae5833b18090e45d1c80f4334bfec36c6e88b463", size = 5731, upload-time = "2026-03-19T13:05:40.663Z" } [[package]] name = "ommx-pyscipopt-adapter" -version = "2.3.5" +version = "2.5.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "ommx" }, { name = "pyscipopt" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c7/1e/3b87c7aafdbb73b9dfd174dcdd0c85614aa88d44419e88db5a56eb830326/ommx_pyscipopt_adapter-2.3.5.tar.gz", hash = "sha256:3085a4c5b059ef2b709f116f4970b8efb65452446c36ea4907da07bcd01e2153", size = 11017, upload-time = "2026-02-10T08:10:47.185Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ca/00/5f0aab79e0d9e9dc83ec41294b43ff99f4ae7d6870bcfe7d5fda5daa38f0/ommx_pyscipopt_adapter-2.5.1.tar.gz", hash = "sha256:767d386c6d3c47a03a35b8e237c6d0d623ed3c63f5995d15c13cd6541b253f2d", size = 11064, upload-time = "2026-03-19T13:05:41.627Z" } [[package]] name = "openjij" @@ -1180,11 +1209,11 @@ wheels = [ [[package]] name = "platformdirs" -version = "4.9.2" +version = "4.9.4" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/1b/04/fea538adf7dbbd6d186f551d595961e564a3b6715bdf276b477460858672/platformdirs-4.9.2.tar.gz", hash = "sha256:9a33809944b9db043ad67ca0db94b14bf452cc6aeaac46a88ea55b26e2e9d291", size = 28394, upload-time = "2026-02-16T03:56:10.574Z" } +sdist = { url = "https://files.pythonhosted.org/packages/19/56/8d4c30c8a1d07013911a8fdbd8f89440ef9f08d07a1b50ab8ca8be5a20f9/platformdirs-4.9.4.tar.gz", hash = "sha256:1ec356301b7dc906d83f371c8f487070e99d3ccf9e501686456394622a01a934", size = 28737, upload-time = "2026-03-05T18:34:13.271Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/48/31/05e764397056194206169869b50cf2fee4dbbbc71b344705b9c0d878d4d8/platformdirs-4.9.2-py3-none-any.whl", hash = "sha256:9170634f126f8efdae22fb58ae8a0eaa86f38365bc57897a6c4f781d1f5875bd", size = 21168, upload-time = "2026-02-16T03:56:08.891Z" }, + { url = "https://files.pythonhosted.org/packages/63/d7/97f7e3a6abb67d8080dd406fd4df842c2be0efaf712d1c899c32a075027c/platformdirs-4.9.4-py3-none-any.whl", hash = "sha256:68a9a4619a666ea6439f2ff250c12a853cd1cbd5158d258bd824a7df6be2f868", size = 21216, upload-time = "2026-03-05T18:34:12.172Z" }, ] [[package]] @@ -1326,21 +1355,20 @@ wheels = [ [[package]] name = "pydata-sphinx-theme" -version = "0.15.4" +version = "0.16.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "accessible-pygments" }, { name = "babel" }, { name = "beautifulsoup4" }, { name = "docutils" }, - { name = "packaging" }, { name = "pygments" }, { name = "sphinx" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/67/ea/3ab478cccacc2e8ef69892c42c44ae547bae089f356c4b47caf61730958d/pydata_sphinx_theme-0.15.4.tar.gz", hash = "sha256:7762ec0ac59df3acecf49fd2f889e1b4565dbce8b88b2e29ee06fdd90645a06d", size = 2400673, upload-time = "2024-06-25T19:28:45.041Z" } +sdist = { url = "https://files.pythonhosted.org/packages/00/20/bb50f9de3a6de69e6abd6b087b52fa2418a0418b19597601605f855ad044/pydata_sphinx_theme-0.16.1.tar.gz", hash = "sha256:a08b7f0b7f70387219dc659bff0893a7554d5eb39b59d3b8ef37b8401b7642d7", size = 2412693, upload-time = "2024-12-17T10:53:39.537Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e7/d3/c622950d87a2ffd1654208733b5bd1c5645930014abed8f4c0d74863988b/pydata_sphinx_theme-0.15.4-py3-none-any.whl", hash = "sha256:2136ad0e9500d0949f96167e63f3e298620040aea8f9c74621959eda5d4cf8e6", size = 4640157, upload-time = "2024-06-25T19:28:42.383Z" }, + { url = "https://files.pythonhosted.org/packages/e2/0d/8ba33fa83a7dcde13eb3c1c2a0c1cc29950a048bfed6d9b0d8b6bd710b4c/pydata_sphinx_theme-0.16.1-py3-none-any.whl", hash = "sha256:225331e8ac4b32682c18fcac5a57a6f717c4e632cea5dd0e247b55155faeccde", size = 6723264, upload-time = "2024-12-17T10:53:35.645Z" }, ] [[package]] @@ -1392,11 +1420,11 @@ wheels = [ [[package]] name = "pytz" -version = "2025.2" +version = "2026.1.post1" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/f8/bf/abbd3cdfb8fbc7fb3d4d38d320f2441b1e7cbe29be4f23797b4a2b5d8aac/pytz-2025.2.tar.gz", hash = "sha256:360b9e3dbb49a209c21ad61809c7fb453643e048b38924c765813546746e81c3", size = 320884, upload-time = "2025-03-25T02:25:00.538Z" } +sdist = { url = "https://files.pythonhosted.org/packages/56/db/b8721d71d945e6a8ac63c0fc900b2067181dbb50805958d4d4661cf7d277/pytz-2026.1.post1.tar.gz", hash = "sha256:3378dde6a0c3d26719182142c56e60c7f9af7e968076f31aae569d72a0358ee1", size = 321088, upload-time = "2026-03-03T07:47:50.683Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/81/c4/34e93fe5f5429d7570ec1fa436f1986fb1f00c3e0f43a589fe2bbcd22c3f/pytz-2025.2-py2.py3-none-any.whl", hash = "sha256:5ddf76296dd8c44c26eb8f4b6f35488f3ccbf6fbbd7adee0b7262d43f0ec2f00", size = 509225, upload-time = "2025-03-25T02:24:58.468Z" }, + { url = "https://files.pythonhosted.org/packages/10/99/781fe0c827be2742bcc775efefccb3b048a3a9c6ce9aec0cbf4a101677e5/pytz-2026.1.post1-py2.py3-none-any.whl", hash = "sha256:f2fd16142fda348286a75e1a524be810bb05d444e5a081f37f7affc635035f7a", size = 510489, upload-time = "2026-03-03T07:47:49.167Z" }, ] [[package]] @@ -1641,11 +1669,11 @@ wheels = [ [[package]] name = "setuptools" -version = "82.0.0" +version = "82.0.1" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/82/f3/748f4d6f65d1756b9ae577f329c951cda23fb900e4de9f70900ced962085/setuptools-82.0.0.tar.gz", hash = "sha256:22e0a2d69474c6ae4feb01951cb69d515ed23728cf96d05513d36e42b62b37cb", size = 1144893, upload-time = "2026-02-08T15:08:40.206Z" } +sdist = { url = "https://files.pythonhosted.org/packages/4f/db/cfac1baf10650ab4d1c111714410d2fbb77ac5a616db26775db562c8fab2/setuptools-82.0.1.tar.gz", hash = "sha256:7d872682c5d01cfde07da7bccc7b65469d3dca203318515ada1de5eda35efbf9", size = 1152316, upload-time = "2026-03-09T12:47:17.221Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e1/c6/76dc613121b793286a3f91621d7b75a2b493e0390ddca50f11993eadf192/setuptools-82.0.0-py3-none-any.whl", hash = "sha256:70b18734b607bd1da571d097d236cfcfacaf01de45717d59e6e04b96877532e0", size = 1003468, upload-time = "2026-02-08T15:08:38.723Z" }, + { url = "https://files.pythonhosted.org/packages/9d/76/f789f7a86709c6b087c5a2f52f911838cad707cc613162401badc665acfe/setuptools-82.0.1-py3-none-any.whl", hash = "sha256:a59e362652f08dcd477c78bb6e7bd9d80a7995bc73ce773050228a348ce2e5bb", size = 1006223, upload-time = "2026-03-09T12:47:15.026Z" }, ] [[package]] @@ -1704,15 +1732,15 @@ wheels = [ [[package]] name = "sphinx-book-theme" -version = "1.1.4" +version = "1.2.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydata-sphinx-theme" }, { name = "sphinx" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/45/19/d002ed96bdc7738c15847c730e1e88282d738263deac705d5713b4d8fa94/sphinx_book_theme-1.1.4.tar.gz", hash = "sha256:73efe28af871d0a89bd05856d300e61edce0d5b2fbb7984e84454be0fedfe9ed", size = 439188, upload-time = "2025-02-20T16:32:32.581Z" } +sdist = { url = "https://files.pythonhosted.org/packages/eb/f7/154786f3cfb7692cd7acc24b6dfe4dcd1146b66f376b17df9e47125555e9/sphinx_book_theme-1.2.0.tar.gz", hash = "sha256:4a7ebfc7da4395309ac942ddfc38fbec5c5254c3be22195e99ad12586fbda9e3", size = 443962, upload-time = "2026-03-09T23:20:30.442Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/51/9e/c41d68be04eef5b6202b468e0f90faf0c469f3a03353f2a218fd78279710/sphinx_book_theme-1.1.4-py3-none-any.whl", hash = "sha256:843b3f5c8684640f4a2d01abd298beb66452d1b2394cd9ef5be5ebd5640ea0e1", size = 433952, upload-time = "2025-02-20T16:32:31.009Z" }, + { url = "https://files.pythonhosted.org/packages/02/bf/6f506a37c7f8ecc4576caf9486e303c7af249f6d70447bb51dde9d78cb99/sphinx_book_theme-1.2.0-py3-none-any.whl", hash = "sha256:709605d308e1991c5ef0cf19c481dbe9084b62852e317fafab74382a0ee7ccfa", size = 455936, upload-time = "2026-03-09T23:20:28.788Z" }, ] [[package]] @@ -1901,42 +1929,42 @@ wheels = [ [[package]] name = "sqlalchemy" -version = "2.0.47" +version = "2.0.48" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "greenlet", marker = "platform_machine == 'AMD64' or platform_machine == 'WIN32' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'ppc64le' or platform_machine == 'win32' or platform_machine == 'x86_64'" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/cd/4b/1e00561093fe2cd8eef09d406da003c8a118ff02d6548498c1ae677d68d9/sqlalchemy-2.0.47.tar.gz", hash = "sha256:e3e7feb57b267fe897e492b9721ae46d5c7de6f9e8dee58aacf105dc4e154f3d", size = 9886323, upload-time = "2026-02-24T16:34:27.947Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/94/13/886338d3e8ab5ddcfe84d54302c749b1793e16c4bba63d7004e3f7baa8ec/sqlalchemy-2.0.47-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3a1dbf0913879c443617d6b64403cf2801c941651db8c60e96d204ed9388d6b0", size = 2157124, upload-time = "2026-02-24T16:43:54.706Z" }, - { url = "https://files.pythonhosted.org/packages/b6/bb/a897f6a66c9986aa9f27f5cf8550637d8a5ea368fd7fb42f6dac3105b4dc/sqlalchemy-2.0.47-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:775effbb97ea3b00c4dd3aeaf3ba8acba6e3e2b4b41d17d67a27e696843dbc95", size = 3313513, upload-time = "2026-02-24T17:29:00.527Z" }, - { url = "https://files.pythonhosted.org/packages/59/fb/69bfae022b681507565ab0d34f0c80aa1e9f954a5a7cbfb0ed054966ac8d/sqlalchemy-2.0.47-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:56cc834a3ffac34270cc2a41875e0f40e97aa651f4f3ca1cfbbf421c044cb62b", size = 3313014, upload-time = "2026-02-24T17:27:11.679Z" }, - { url = "https://files.pythonhosted.org/packages/04/f3/0eba329f7c182d53205a228c4fd24651b95489b431ea2bd830887b4c13c4/sqlalchemy-2.0.47-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:49b5e0c7244262f39e767c018e4fdb5e5dbc23cd54c5ddac8eea8f0ba32ef890", size = 3265389, upload-time = "2026-02-24T17:29:02.497Z" }, - { url = "https://files.pythonhosted.org/packages/5c/06/654edc084b3b46ac79e04200d7c46467ae80c759c4ee41c897f9272b036f/sqlalchemy-2.0.47-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:15cd822a3f1f6f77b5b841a30c1a07a07f7dee3385f17e638e1722de9ab683be", size = 3287604, upload-time = "2026-02-24T17:27:13.295Z" }, - { url = "https://files.pythonhosted.org/packages/78/33/c18c8f63b61981219d3aa12321bb7ccee605034d195e868ed94f9727b27c/sqlalchemy-2.0.47-cp311-cp311-win32.whl", hash = "sha256:9847a19548cd283a65e1ce0afd54016598d55ff72682d6fd3e493af6fc044064", size = 2116916, upload-time = "2026-02-24T17:14:37.392Z" }, - { url = "https://files.pythonhosted.org/packages/f5/c6/a59e3f9796fff844e16afbd821db9abfd6e12698db9441a231a96193a100/sqlalchemy-2.0.47-cp311-cp311-win_amd64.whl", hash = "sha256:722abf1c82aeca46a1a0803711244a48a298279eeaec9e02f7bfee9e064182e5", size = 2141587, upload-time = "2026-02-24T17:14:39.746Z" }, - { url = "https://files.pythonhosted.org/packages/80/88/74eb470223ff88ea6572a132c0b8de8c1d8ed7b843d3b44a8a3c77f31d39/sqlalchemy-2.0.47-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4fa91b19d6b9821c04cc8f7aa2476429cc8887b9687c762815aa629f5c0edec1", size = 2155687, upload-time = "2026-02-24T17:05:46.451Z" }, - { url = "https://files.pythonhosted.org/packages/ef/ba/1447d3d558971b036cb93b557595cb5dcdfe728f1c7ac4dec16505ef5756/sqlalchemy-2.0.47-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7c5bbbd14eff577c8c79cbfe39a0771eecd20f430f3678533476f0087138f356", size = 3336978, upload-time = "2026-02-24T17:18:04.597Z" }, - { url = "https://files.pythonhosted.org/packages/8a/07/b47472d2ffd0776826f17ccf0b4d01b224c99fbd1904aeb103dffbb4b1cc/sqlalchemy-2.0.47-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a5a6c555da8d4280a3c4c78c5b7a3f990cee2b2884e5f934f87a226191682ff7", size = 3349939, upload-time = "2026-02-24T17:27:18.937Z" }, - { url = "https://files.pythonhosted.org/packages/bb/c6/95fa32b79b57769da3e16f054cf658d90940317b5ca0ec20eac84aa19c4f/sqlalchemy-2.0.47-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ed48a1701d24dff3bb49a5bce94d6bc84cbe33d98af2aa2d3cdcce3dea1709ec", size = 3279648, upload-time = "2026-02-24T17:18:07.038Z" }, - { url = "https://files.pythonhosted.org/packages/bb/c8/3d07e7c73928dc59a0bed40961ca4e313e797bce650b088e8d5fdd3ad939/sqlalchemy-2.0.47-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:4f3178c920ad98158f0b6309382194df04b14808fa6052ae07099fdde29d5602", size = 3314695, upload-time = "2026-02-24T17:27:20.93Z" }, - { url = "https://files.pythonhosted.org/packages/6b/d2/ed32b1611c1e19fdb028eee1adc5a9aa138c2952d09ae11f1670170f80ae/sqlalchemy-2.0.47-cp312-cp312-win32.whl", hash = "sha256:b9c11ac9934dd59ece9619fe42780a08abe2faab7b0543bb00d5eabea4f421b9", size = 2115502, upload-time = "2026-02-24T17:22:52.546Z" }, - { url = "https://files.pythonhosted.org/packages/fd/52/9de590356a4dd8e9ef5a881dbba64b2bbc4cbc71bf02bc68e775fb9b1899/sqlalchemy-2.0.47-cp312-cp312-win_amd64.whl", hash = "sha256:db43b72cf8274a99e089755c9c1e0b947159b71adbc2c83c3de2e38d5d607acb", size = 2142435, upload-time = "2026-02-24T17:22:54.268Z" }, - { url = "https://files.pythonhosted.org/packages/4a/e5/0af64ce7d8f60ec5328c10084e2f449e7912a9b8bdbefdcfb44454a25f49/sqlalchemy-2.0.47-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:456a135b790da5d3c6b53d0ef71ac7b7d280b7f41eb0c438986352bf03ca7143", size = 2152551, upload-time = "2026-02-24T17:05:47.675Z" }, - { url = "https://files.pythonhosted.org/packages/63/79/746b8d15f6940e2ac469ce22d7aa5b1124b1ab820bad9b046eb3000c88a6/sqlalchemy-2.0.47-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:09a2f7698e44b3135433387da5d8846cf7cc7c10e5425af7c05fee609df978b6", size = 3278782, upload-time = "2026-02-24T17:18:10.012Z" }, - { url = "https://files.pythonhosted.org/packages/91/b1/bd793ddb34345d1ed43b13ab2d88c95d7d4eb2e28f5b5a99128b9cc2bca2/sqlalchemy-2.0.47-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0bbc72e6a177c78d724f9106aaddc0d26a2ada89c6332b5935414eccf04cbd5", size = 3295155, upload-time = "2026-02-24T17:27:22.827Z" }, - { url = "https://files.pythonhosted.org/packages/97/84/7213def33f94e5ca6f5718d259bc9f29de0363134648425aa218d4356b23/sqlalchemy-2.0.47-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:75460456b043b78b6006e41bdf5b86747ee42eafaf7fffa3b24a6e9a456a2092", size = 3226834, upload-time = "2026-02-24T17:18:11.465Z" }, - { url = "https://files.pythonhosted.org/packages/ef/06/456810204f4dc29b5f025b1b0a03b4bd6b600ebf3c1040aebd90a257fa33/sqlalchemy-2.0.47-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5d9adaa616c3bc7d80f9ded57cd84b51d6617cad6a5456621d858c9f23aaee01", size = 3265001, upload-time = "2026-02-24T17:27:24.813Z" }, - { url = "https://files.pythonhosted.org/packages/fb/20/df3920a4b2217dbd7390a5bd277c1902e0393f42baaf49f49b3c935e7328/sqlalchemy-2.0.47-cp313-cp313-win32.whl", hash = "sha256:76e09f974382a496a5ed985db9343628b1cb1ac911f27342e4cc46a8bac10476", size = 2113647, upload-time = "2026-02-24T17:22:55.747Z" }, - { url = "https://files.pythonhosted.org/packages/46/06/7873ddf69918efbfabd7211829f4bd8019739d0a719253112d305d3ba51d/sqlalchemy-2.0.47-cp313-cp313-win_amd64.whl", hash = "sha256:0664089b0bf6724a0bfb49a0cf4d4da24868a0a5c8e937cd7db356d5dcdf2c66", size = 2139425, upload-time = "2026-02-24T17:22:57.033Z" }, - { url = "https://files.pythonhosted.org/packages/54/fa/61ad9731370c90ac7ea5bf8f5eaa12c48bb4beec41c0fa0360becf4ac10d/sqlalchemy-2.0.47-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ed0c967c701ae13da98eb220f9ddab3044ab63504c1ba24ad6a59b26826ad003", size = 3558809, upload-time = "2026-02-24T17:12:15.232Z" }, - { url = "https://files.pythonhosted.org/packages/33/d5/221fac96f0529391fe374875633804c866f2b21a9c6d3a6ca57d9c12cfd7/sqlalchemy-2.0.47-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d3537943a61fd25b241e976426a0c6814434b93cf9b09d39e8e78f3c9eb9a487", size = 3525480, upload-time = "2026-02-24T17:27:59.602Z" }, - { url = "https://files.pythonhosted.org/packages/ec/55/8247d53998c3673e4a8d1958eba75c6f5cc3b39082029d400bb1f2a911ae/sqlalchemy-2.0.47-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:57f7e336a64a0dba686c66392d46b9bc7af2c57d55ce6dc1697b4ef32b043ceb", size = 3466569, upload-time = "2026-02-24T17:12:16.94Z" }, - { url = "https://files.pythonhosted.org/packages/6b/b5/c1f0eea1bac6790845f71420a7fe2f2a0566203aa57543117d4af3b77d1c/sqlalchemy-2.0.47-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:dff735a621858680217cb5142b779bad40ef7322ddbb7c12062190db6879772e", size = 3475770, upload-time = "2026-02-24T17:28:02.034Z" }, - { url = "https://files.pythonhosted.org/packages/c5/ed/2f43f92474ea0c43c204657dc47d9d002cd738b96ca2af8e6d29a9b5e42d/sqlalchemy-2.0.47-cp313-cp313t-win32.whl", hash = "sha256:3893dc096bb3cca9608ea3487372ffcea3ae9b162f40e4d3c51dd49db1d1b2dc", size = 2141300, upload-time = "2026-02-24T17:14:37.024Z" }, - { url = "https://files.pythonhosted.org/packages/cc/a9/8b73f9f1695b6e92f7aaf1711135a1e3bbeb78bca9eded35cb79180d3c6d/sqlalchemy-2.0.47-cp313-cp313t-win_amd64.whl", hash = "sha256:b5103427466f4b3e61f04833ae01f9a914b1280a2a8bcde3a9d7ab11f3755b42", size = 2173053, upload-time = "2026-02-24T17:14:38.688Z" }, - { url = "https://files.pythonhosted.org/packages/15/9f/7c378406b592fcf1fc157248607b495a40e3202ba4a6f1372a2ba6447717/sqlalchemy-2.0.47-py3-none-any.whl", hash = "sha256:e2647043599297a1ef10e720cf310846b7f31b6c841fee093d2b09d81215eb93", size = 1940159, upload-time = "2026-02-24T17:15:07.158Z" }, +sdist = { url = "https://files.pythonhosted.org/packages/1f/73/b4a9737255583b5fa858e0bb8e116eb94b88c910164ed2ed719147bde3de/sqlalchemy-2.0.48.tar.gz", hash = "sha256:5ca74f37f3369b45e1f6b7b06afb182af1fd5dde009e4ffd831830d98cbe5fe7", size = 9886075, upload-time = "2026-03-02T15:28:51.474Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d7/6d/b8b78b5b80f3c3ab3f7fa90faa195ec3401f6d884b60221260fd4d51864c/sqlalchemy-2.0.48-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1b4c575df7368b3b13e0cebf01d4679f9a28ed2ae6c1cd0b1d5beffb6b2007dc", size = 2157184, upload-time = "2026-03-02T15:38:28.161Z" }, + { url = "https://files.pythonhosted.org/packages/21/4b/4f3d4a43743ab58b95b9ddf5580a265b593d017693df9e08bd55780af5bb/sqlalchemy-2.0.48-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e83e3f959aaa1c9df95c22c528096d94848a1bc819f5d0ebf7ee3df0ca63db6c", size = 3313555, upload-time = "2026-03-02T15:58:57.21Z" }, + { url = "https://files.pythonhosted.org/packages/21/dd/3b7c53f1dbbf736fd27041aee68f8ac52226b610f914085b1652c2323442/sqlalchemy-2.0.48-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6f7b7243850edd0b8b97043f04748f31de50cf426e939def5c16bedb540698f7", size = 3313057, upload-time = "2026-03-02T15:52:29.366Z" }, + { url = "https://files.pythonhosted.org/packages/d9/cc/3e600a90ae64047f33313d7d32e5ad025417f09d2ded487e8284b5e21a15/sqlalchemy-2.0.48-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:82745b03b4043e04600a6b665cb98697c4339b24e34d74b0a2ac0a2488b6f94d", size = 3265431, upload-time = "2026-03-02T15:58:59.096Z" }, + { url = "https://files.pythonhosted.org/packages/8b/19/780138dacfe3f5024f4cf96e4005e91edf6653d53d3673be4844578faf1d/sqlalchemy-2.0.48-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:e5e088bf43f6ee6fec7dbf1ef7ff7774a616c236b5c0cb3e00662dd71a56b571", size = 3287646, upload-time = "2026-03-02T15:52:31.569Z" }, + { url = "https://files.pythonhosted.org/packages/40/fd/f32ced124f01a23151f4777e4c705f3a470adc7bd241d9f36a7c941a33bf/sqlalchemy-2.0.48-cp311-cp311-win32.whl", hash = "sha256:9c7d0a77e36b5f4b01ca398482230ab792061d243d715299b44a0b55c89fe617", size = 2116956, upload-time = "2026-03-02T15:46:54.535Z" }, + { url = "https://files.pythonhosted.org/packages/58/d5/dd767277f6feef12d05651538f280277e661698f617fa4d086cce6055416/sqlalchemy-2.0.48-cp311-cp311-win_amd64.whl", hash = "sha256:583849c743e0e3c9bb7446f5b5addeacedc168d657a69b418063dfdb2d90081c", size = 2141627, upload-time = "2026-03-02T15:46:55.849Z" }, + { url = "https://files.pythonhosted.org/packages/ef/91/a42ae716f8925e9659df2da21ba941f158686856107a61cc97a95e7647a3/sqlalchemy-2.0.48-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:348174f228b99f33ca1f773e85510e08927620caa59ffe7803b37170df30332b", size = 2155737, upload-time = "2026-03-02T15:49:13.207Z" }, + { url = "https://files.pythonhosted.org/packages/b9/52/f75f516a1f3888f027c1cfb5d22d4376f4b46236f2e8669dcb0cddc60275/sqlalchemy-2.0.48-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:53667b5f668991e279d21f94ccfa6e45b4e3f4500e7591ae59a8012d0f010dcb", size = 3337020, upload-time = "2026-03-02T15:50:34.547Z" }, + { url = "https://files.pythonhosted.org/packages/37/9a/0c28b6371e0cdcb14f8f1930778cb3123acfcbd2c95bb9cf6b4a2ba0cce3/sqlalchemy-2.0.48-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34634e196f620c7a61d18d5cf7dc841ca6daa7961aed75d532b7e58b309ac894", size = 3349983, upload-time = "2026-03-02T15:53:25.542Z" }, + { url = "https://files.pythonhosted.org/packages/1c/46/0aee8f3ff20b1dcbceb46ca2d87fcc3d48b407925a383ff668218509d132/sqlalchemy-2.0.48-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:546572a1793cc35857a2ffa1fe0e58571af1779bcc1ffa7c9fb0839885ed69a9", size = 3279690, upload-time = "2026-03-02T15:50:36.277Z" }, + { url = "https://files.pythonhosted.org/packages/ce/8c/a957bc91293b49181350bfd55e6dfc6e30b7f7d83dc6792d72043274a390/sqlalchemy-2.0.48-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:07edba08061bc277bfdc772dd2a1a43978f5a45994dd3ede26391b405c15221e", size = 3314738, upload-time = "2026-03-02T15:53:27.519Z" }, + { url = "https://files.pythonhosted.org/packages/4b/44/1d257d9f9556661e7bdc83667cc414ba210acfc110c82938cb3611eea58f/sqlalchemy-2.0.48-cp312-cp312-win32.whl", hash = "sha256:908a3fa6908716f803b86896a09a2c4dde5f5ce2bb07aacc71ffebb57986ce99", size = 2115546, upload-time = "2026-03-02T15:54:31.591Z" }, + { url = "https://files.pythonhosted.org/packages/f2/af/c3c7e1f3a2b383155a16454df62ae8c62a30dd238e42e68c24cebebbfae6/sqlalchemy-2.0.48-cp312-cp312-win_amd64.whl", hash = "sha256:68549c403f79a8e25984376480959975212a670405e3913830614432b5daa07a", size = 2142484, upload-time = "2026-03-02T15:54:34.072Z" }, + { url = "https://files.pythonhosted.org/packages/d1/c6/569dc8bf3cd375abc5907e82235923e986799f301cd79a903f784b996fca/sqlalchemy-2.0.48-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e3070c03701037aa418b55d36532ecb8f8446ed0135acb71c678dbdf12f5b6e4", size = 2152599, upload-time = "2026-03-02T15:49:14.41Z" }, + { url = "https://files.pythonhosted.org/packages/6d/ff/f4e04a4bd5a24304f38cb0d4aa2ad4c0fb34999f8b884c656535e1b2b74c/sqlalchemy-2.0.48-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2645b7d8a738763b664a12a1542c89c940daa55196e8d73e55b169cc5c99f65f", size = 3278825, upload-time = "2026-03-02T15:50:38.269Z" }, + { url = "https://files.pythonhosted.org/packages/fe/88/cb59509e4668d8001818d7355d9995be90c321313078c912420603a7cb95/sqlalchemy-2.0.48-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b19151e76620a412c2ac1c6f977ab1b9fa7ad43140178345136456d5265b32ed", size = 3295200, upload-time = "2026-03-02T15:53:29.366Z" }, + { url = "https://files.pythonhosted.org/packages/87/dc/1609a4442aefd750ea2f32629559394ec92e89ac1d621a7f462b70f736ff/sqlalchemy-2.0.48-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5b193a7e29fd9fa56e502920dca47dffe60f97c863494946bd698c6058a55658", size = 3226876, upload-time = "2026-03-02T15:50:39.802Z" }, + { url = "https://files.pythonhosted.org/packages/37/c3/6ae2ab5ea2fa989fbac4e674de01224b7a9d744becaf59bb967d62e99bed/sqlalchemy-2.0.48-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:36ac4ddc3d33e852da9cb00ffb08cea62ca05c39711dc67062ca2bb1fae35fd8", size = 3265045, upload-time = "2026-03-02T15:53:31.421Z" }, + { url = "https://files.pythonhosted.org/packages/6f/82/ea4665d1bb98c50c19666e672f21b81356bd6077c4574e3d2bbb84541f53/sqlalchemy-2.0.48-cp313-cp313-win32.whl", hash = "sha256:389b984139278f97757ea9b08993e7b9d1142912e046ab7d82b3fbaeb0209131", size = 2113700, upload-time = "2026-03-02T15:54:35.825Z" }, + { url = "https://files.pythonhosted.org/packages/b7/2b/b9040bec58c58225f073f5b0c1870defe1940835549dafec680cbd58c3c3/sqlalchemy-2.0.48-cp313-cp313-win_amd64.whl", hash = "sha256:d612c976cbc2d17edfcc4c006874b764e85e990c29ce9bd411f926bbfb02b9a2", size = 2139487, upload-time = "2026-03-02T15:54:37.079Z" }, + { url = "https://files.pythonhosted.org/packages/f4/f4/7b17bd50244b78a49d22cc63c969d71dc4de54567dc152a9b46f6fae40ce/sqlalchemy-2.0.48-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:69f5bc24904d3bc3640961cddd2523e361257ef68585d6e364166dfbe8c78fae", size = 3558851, upload-time = "2026-03-02T15:57:48.607Z" }, + { url = "https://files.pythonhosted.org/packages/20/0d/213668e9aca61d370f7d2a6449ea4ec699747fac67d4bda1bb3d129025be/sqlalchemy-2.0.48-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fd08b90d211c086181caed76931ecfa2bdfc83eea3cfccdb0f82abc6c4b876cb", size = 3525525, upload-time = "2026-03-02T16:04:38.058Z" }, + { url = "https://files.pythonhosted.org/packages/85/d7/a84edf412979e7d59c69b89a5871f90a49228360594680e667cb2c46a828/sqlalchemy-2.0.48-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:1ccd42229aaac2df431562117ac7e667d702e8e44afdb6cf0e50fa3f18160f0b", size = 3466611, upload-time = "2026-03-02T15:57:50.759Z" }, + { url = "https://files.pythonhosted.org/packages/86/55/42404ce5770f6be26a2b0607e7866c31b9a4176c819e9a7a5e0a055770be/sqlalchemy-2.0.48-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:f0dcbc588cd5b725162c076eb9119342f6579c7f7f55057bb7e3c6ff27e13121", size = 3475812, upload-time = "2026-03-02T16:04:40.092Z" }, + { url = "https://files.pythonhosted.org/packages/ae/ae/29b87775fadc43e627cf582fe3bda4d02e300f6b8f2747c764950d13784c/sqlalchemy-2.0.48-cp313-cp313t-win32.whl", hash = "sha256:9764014ef5e58aab76220c5664abb5d47d5bc858d9debf821e55cfdd0f128485", size = 2141335, upload-time = "2026-03-02T15:52:51.518Z" }, + { url = "https://files.pythonhosted.org/packages/91/44/f39d063c90f2443e5b46ec4819abd3d8de653893aae92df42a5c4f5843de/sqlalchemy-2.0.48-cp313-cp313t-win_amd64.whl", hash = "sha256:e2f35b4cccd9ed286ad62e0a3c3ac21e06c02abc60e20aa51a3e305a30f5fa79", size = 2173095, upload-time = "2026-03-02T15:52:52.79Z" }, + { url = "https://files.pythonhosted.org/packages/46/2c/9664130905f03db57961b8980b05cab624afd114bf2be2576628a9f22da4/sqlalchemy-2.0.48-py3-none-any.whl", hash = "sha256:a66fe406437dd65cacd96a72689a3aaaecaebbcd62d81c5ac1c0fdbeac835096", size = 1940202, upload-time = "2026-03-02T15:52:43.285Z" }, ] [[package]] @@ -1955,11 +1983,11 @@ wheels = [ [[package]] name = "tabulate" -version = "0.9.0" +version = "0.10.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ec/fe/802052aecb21e3797b8f7902564ab6ea0d60ff8ca23952079064155d1ae1/tabulate-0.9.0.tar.gz", hash = "sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c", size = 81090, upload-time = "2022-10-06T17:21:48.54Z" } +sdist = { url = "https://files.pythonhosted.org/packages/46/58/8c37dea7bbf769b20d58e7ace7e5edfe65b849442b00ffcdd56be88697c6/tabulate-0.10.0.tar.gz", hash = "sha256:e2cfde8f79420f6deeffdeda9aaec3b6bc5abce947655d17ac662b126e48a60d", size = 91754, upload-time = "2026-03-04T18:55:34.402Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/40/44/4a5f08c96eb108af5cb50b41f76142f0afa346dfa99d5296fe7202a11854/tabulate-0.9.0-py3-none-any.whl", hash = "sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f", size = 35252, upload-time = "2022-10-06T17:21:44.262Z" }, + { url = "https://files.pythonhosted.org/packages/99/55/db07de81b5c630da5cbf5c7df646580ca26dfaefa593667fc6f2fe016d2e/tabulate-0.10.0-py3-none-any.whl", hash = "sha256:f0b0622e567335c8fabaaa659f1b33bcb6ddfe2e496071b743aa113f8774f2d3", size = 39814, upload-time = "2026-03-04T18:55:31.284Z" }, ] [[package]] @@ -1976,21 +2004,19 @@ wheels = [ [[package]] name = "tornado" -version = "6.5.4" +version = "6.5.5" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/37/1d/0a336abf618272d53f62ebe274f712e213f5a03c0b2339575430b8362ef2/tornado-6.5.4.tar.gz", hash = "sha256:a22fa9047405d03260b483980635f0b041989d8bcc9a313f8fe18b411d84b1d7", size = 513632, upload-time = "2025-12-15T19:21:03.836Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f8/f1/3173dfa4a18db4a9b03e5d55325559dab51ee653763bb8745a75af491286/tornado-6.5.5.tar.gz", hash = "sha256:192b8f3ea91bd7f1f50c06955416ed76c6b72f96779b962f07f911b91e8d30e9", size = 516006, upload-time = "2026-03-10T21:31:02.067Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ab/a9/e94a9d5224107d7ce3cc1fab8d5dc97f5ea351ccc6322ee4fb661da94e35/tornado-6.5.4-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:d6241c1a16b1c9e4cc28148b1cda97dd1c6cb4fb7068ac1bedc610768dff0ba9", size = 443909, upload-time = "2025-12-15T19:20:48.382Z" }, - { url = "https://files.pythonhosted.org/packages/db/7e/f7b8d8c4453f305a51f80dbb49014257bb7d28ccb4bbb8dd328ea995ecad/tornado-6.5.4-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:2d50f63dda1d2cac3ae1fa23d254e16b5e38153758470e9956cbc3d813d40843", size = 442163, upload-time = "2025-12-15T19:20:49.791Z" }, - { url = "https://files.pythonhosted.org/packages/ba/b5/206f82d51e1bfa940ba366a8d2f83904b15942c45a78dd978b599870ab44/tornado-6.5.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d1cf66105dc6acb5af613c054955b8137e34a03698aa53272dbda4afe252be17", size = 445746, upload-time = "2025-12-15T19:20:51.491Z" }, - { url = "https://files.pythonhosted.org/packages/8e/9d/1a3338e0bd30ada6ad4356c13a0a6c35fbc859063fa7eddb309183364ac1/tornado-6.5.4-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:50ff0a58b0dc97939d29da29cd624da010e7f804746621c78d14b80238669335", size = 445083, upload-time = "2025-12-15T19:20:52.778Z" }, - { url = "https://files.pythonhosted.org/packages/50/d4/e51d52047e7eb9a582da59f32125d17c0482d065afd5d3bc435ff2120dc5/tornado-6.5.4-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5fb5e04efa54cf0baabdd10061eb4148e0be137166146fff835745f59ab9f7f", size = 445315, upload-time = "2025-12-15T19:20:53.996Z" }, - { url = "https://files.pythonhosted.org/packages/27/07/2273972f69ca63dbc139694a3fc4684edec3ea3f9efabf77ed32483b875c/tornado-6.5.4-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:9c86b1643b33a4cd415f8d0fe53045f913bf07b4a3ef646b735a6a86047dda84", size = 446003, upload-time = "2025-12-15T19:20:56.101Z" }, - { url = "https://files.pythonhosted.org/packages/d1/83/41c52e47502bf7260044413b6770d1a48dda2f0246f95ee1384a3cd9c44a/tornado-6.5.4-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:6eb82872335a53dd063a4f10917b3efd28270b56a33db69009606a0312660a6f", size = 445412, upload-time = "2025-12-15T19:20:57.398Z" }, - { url = "https://files.pythonhosted.org/packages/10/c7/bc96917f06cbee182d44735d4ecde9c432e25b84f4c2086143013e7b9e52/tornado-6.5.4-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:6076d5dda368c9328ff41ab5d9dd3608e695e8225d1cd0fd1e006f05da3635a8", size = 445392, upload-time = "2025-12-15T19:20:58.692Z" }, - { url = "https://files.pythonhosted.org/packages/0c/1a/d7592328d037d36f2d2462f4bc1fbb383eec9278bc786c1b111cbbd44cfa/tornado-6.5.4-cp39-abi3-win32.whl", hash = "sha256:1768110f2411d5cd281bac0a090f707223ce77fd110424361092859e089b38d1", size = 446481, upload-time = "2025-12-15T19:21:00.008Z" }, - { url = "https://files.pythonhosted.org/packages/d6/6d/c69be695a0a64fd37a97db12355a035a6d90f79067a3cf936ec2b1dc38cd/tornado-6.5.4-cp39-abi3-win_amd64.whl", hash = "sha256:fa07d31e0cd85c60713f2b995da613588aa03e1303d75705dca6af8babc18ddc", size = 446886, upload-time = "2025-12-15T19:21:01.287Z" }, - { url = "https://files.pythonhosted.org/packages/50/49/8dc3fd90902f70084bd2cd059d576ddb4f8bb44c2c7c0e33a11422acb17e/tornado-6.5.4-cp39-abi3-win_arm64.whl", hash = "sha256:053e6e16701eb6cbe641f308f4c1a9541f91b6261991160391bfc342e8a551a1", size = 445910, upload-time = "2025-12-15T19:21:02.571Z" }, + { url = "https://files.pythonhosted.org/packages/59/8c/77f5097695f4dd8255ecbd08b2a1ed8ba8b953d337804dd7080f199e12bf/tornado-6.5.5-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:487dc9cc380e29f58c7ab88f9e27cdeef04b2140862e5076a66fb6bb68bb1bfa", size = 445983, upload-time = "2026-03-10T21:30:44.28Z" }, + { url = "https://files.pythonhosted.org/packages/ab/5e/7625b76cd10f98f1516c36ce0346de62061156352353ef2da44e5c21523c/tornado-6.5.5-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:65a7f1d46d4bb41df1ac99f5fcb685fb25c7e61613742d5108b010975a9a6521", size = 444246, upload-time = "2026-03-10T21:30:46.571Z" }, + { url = "https://files.pythonhosted.org/packages/b2/04/7b5705d5b3c0fab088f434f9c83edac1573830ca49ccf29fb83bf7178eec/tornado-6.5.5-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e74c92e8e65086b338fd56333fb9a68b9f6f2fe7ad532645a290a464bcf46be5", size = 447229, upload-time = "2026-03-10T21:30:48.273Z" }, + { url = "https://files.pythonhosted.org/packages/34/01/74e034a30ef59afb4097ef8659515e96a39d910b712a89af76f5e4e1f93c/tornado-6.5.5-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:435319e9e340276428bbdb4e7fa732c2d399386d1de5686cb331ec8eee754f07", size = 448192, upload-time = "2026-03-10T21:30:51.22Z" }, + { url = "https://files.pythonhosted.org/packages/be/00/fe9e02c5a96429fce1a1d15a517f5d8444f9c412e0bb9eadfbe3b0fc55bf/tornado-6.5.5-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:3f54aa540bdbfee7b9eb268ead60e7d199de5021facd276819c193c0fb28ea4e", size = 448039, upload-time = "2026-03-10T21:30:53.52Z" }, + { url = "https://files.pythonhosted.org/packages/82/9e/656ee4cec0398b1d18d0f1eb6372c41c6b889722641d84948351ae19556d/tornado-6.5.5-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:36abed1754faeb80fbd6e64db2758091e1320f6bba74a4cf8c09cd18ccce8aca", size = 447445, upload-time = "2026-03-10T21:30:55.541Z" }, + { url = "https://files.pythonhosted.org/packages/5a/76/4921c00511f88af86a33de770d64141170f1cfd9c00311aea689949e274e/tornado-6.5.5-cp39-abi3-win32.whl", hash = "sha256:dd3eafaaeec1c7f2f8fdcd5f964e8907ad788fe8a5a32c4426fbbdda621223b7", size = 448582, upload-time = "2026-03-10T21:30:57.142Z" }, + { url = "https://files.pythonhosted.org/packages/2c/23/f6c6112a04d28eed765e374435fb1a9198f73e1ec4b4024184f21faeb1ad/tornado-6.5.5-cp39-abi3-win_amd64.whl", hash = "sha256:6443a794ba961a9f619b1ae926a2e900ac20c34483eea67be4ed8f1e58d3ef7b", size = 448990, upload-time = "2026-03-10T21:30:58.857Z" }, + { url = "https://files.pythonhosted.org/packages/b7/c8/876602cbc96469911f0939f703453c1157b0c826ecb05bdd32e023397d4e/tornado-6.5.5-cp39-abi3-win_arm64.whl", hash = "sha256:2c9a876e094109333f888539ddb2de4361743e5d21eece20688e3e351e4990a6", size = 448016, upload-time = "2026-03-10T21:31:00.43Z" }, ] [[package]] @@ -2022,11 +2048,11 @@ wheels = [ [[package]] name = "uc-micro-py" -version = "1.0.3" +version = "2.0.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/91/7a/146a99696aee0609e3712f2b44c6274566bc368dfe8375191278045186b8/uc-micro-py-1.0.3.tar.gz", hash = "sha256:d321b92cff673ec58027c04015fcaa8bb1e005478643ff4a500882eaab88c48a", size = 6043, upload-time = "2024-02-09T16:52:01.654Z" } +sdist = { url = "https://files.pythonhosted.org/packages/78/67/9a363818028526e2d4579334460df777115bdec1bb77c08f9db88f6389f2/uc_micro_py-2.0.0.tar.gz", hash = "sha256:c53691e495c8db60e16ffc4861a35469b0ba0821fe409a8a7a0a71864d33a811", size = 6611, upload-time = "2026-03-01T06:31:27.526Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/37/87/1f677586e8ac487e29672e4b17455758fce261de06a0d086167bb760361a/uc_micro_py-1.0.3-py3-none-any.whl", hash = "sha256:db1dffff340817673d7b466ec86114a9dc0e9d4d9b5ba229d9d60e5c12600cd5", size = 6229, upload-time = "2024-02-09T16:52:00.371Z" }, + { url = "https://files.pythonhosted.org/packages/61/73/d21edf5b204d1467e06500080a50f79d49ef2b997c79123a536d4a17d97c/uc_micro_py-2.0.0-py3-none-any.whl", hash = "sha256:3603a3859af53e5a39bc7677713c78ea6589ff188d70f4fee165db88e22b242c", size = 6383, upload-time = "2026-03-01T06:31:26.257Z" }, ] [[package]]