divopt
下の方に日本語の説明があります
Overview
- optimization tools based on domain division
- description is under construction.
Usage
# Trisectional Convex Optimization [divopt].
divopt = load_develop("divopt", "../", develop_flag = True)
dim_n = 50
# Generate an example of the function to be optimized [divopt].
func = divopt.gen_example_func(
ans = [0.3 for _ in range(dim_n)], # Vector of optimal values (answers)
direction = "maximize" # Maximize / Minimize
)
# Optimize [divopt].
res = divopt.optimize(
func = func, # Function to be optimized
dim_n = dim_n, # Number of dimensions of input
lim_range = [(0,1) for _ in range(dim_n)], # Range of each axis
fin_judge = ["rep", 500], # Termination condition (specify: [mode, value])
direction = "maximize" # Maximize / Minimize
)
# debug
print(res)
# Determine optimality [divopt].
flag = divopt.is_optimal(
func = func, # Function to optimize
x = res, # the solution to be tested
delta = 0.02, # tolerance
direction = "maximize" # Maximize / minimize
)
# debug
print(flag)
# Objective function according to optuna's IF
def target_func(trial):
x = []
for i in range(dim_n):
x.append(trial.suggest_float("param_%d"%i, 0, 1))
return func(x)
# optuna-like interface
oi = divopt.optuna_interface
study = oi.create_study(
direction = "maximize"
)
study.optimize(target_func, n_trials = 500)
print(study.best_params)
概要
- 領域分割に基づく最適化ツール
- 説明文は書きかけです
Usage
# 3分凸最適化 [divopt]
import divopt
dim_n = 50
# 最適化対象関数の例を生成 [divopt]
func = divopt.gen_example_func(
ans = [0.3 for _ in range(dim_n)], # 最適値(答え)のベクトル
direction = "maximize" # 最大化 / 最小化
)
# 最適化 [divopt]
res = divopt.optimize(
func = func, # 最適化対象関数
dim_n = dim_n, # 入力の次元数
lim_range = [(0,1) for _ in range(dim_n)], # 各軸の範囲
fin_judge = ["rep", 500], # 終了条件 (指定: [mode, value])
direction = "maximize" # 最大化 / 最小化
)
# debug
print(res)
# 最適性判断 [divopt]
flag = divopt.is_optimal(
func = func, # 最適化対象関数
x = res, # 検査したい解
delta = 0.02, # 許容誤差
direction = "maximize" # 最大化 / 最小化
)
# debug
print(flag)
# optunaのIFに合わせた目的関数
def target_func(trial):
x = []
for i in range(dim_n):
x.append(trial.suggest_float("param_%d"%i, 0, 1))
return func(x)
# optuna様インターフェース
oi = divopt.optuna_interface
study = oi.create_study(
direction = "maximize"
)
study.optimize(target_func, n_trials = 500)
print(study.best_params)
Metadata
Release files for divopt 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| divopt-0.0.3.tar.gz | 7.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| divopt-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / divopt-0.0.3.tar.gz
| Download URL | divopt-0.0.3.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
734bf9d4b4d0a390278a057e063a196939339a7a06840e35b6c3e034642a8bc3
|
|
BLAKE2b-256 checksum How to use checksums |
a10a9739be45691f010ce2daff4c0c73a5ae0ed11aa1db1ef5db63df0ffac6f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
|
Release files / divopt-0.0.3-py3-none-any.whl
| Download URL | divopt-0.0.3-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc0eb45635a8fe63eea1fda8a041e3d16e50848618b314b3d5ac2d701cbe8f77
|
|
BLAKE2b-256 checksum How to use checksums |
a229248a8c7d01d31545e2e488608bef27083cc367227d2c8d1be987efccad79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
|
Security for divopt 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.