# scipy-optimstruct
[![Build Status](https://travis-ci.com/andrewnyu/scipy-optimstruct.svg?branch=master)](https://travis-ci.com/andrewnyu/scipy-optimstruct.svg?branch=master)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg )](https://raw.githubusercontent.com/andrewnyu/scipy-optimstruct/master/LICENSE)
scipy-optimstruct is a Python package that simplifies the implementation of variables and constraints for optimization problems using the SciPy optimization module. It provides a convenient way to define and manage problem structures, making it easier to solve optimization problems.
## Features
- **Introduction to Optimization Problem Structures:** The package includes a Jupyter notebook that provides an introduction to optimization problem structures and demonstrates how to use the SciPy optimization module to solve optimization problems.
- **Examples of Optimization Problem Structures:** The package provides examples of optimization problem structures, including linear programming, quadratic programming, and nonlinear programming.
- **Sample Code:** The package includes sample code that demonstrates how to use the optimization problem structures to solve practical problems.
- **Requirements:** The package includes a requirements.txt file that lists the required Python packages to run the example code.
## Usage
To use scipy-optimstruct, follow these steps:
1. Install the package using pip:
```shell
pip install scipy-optimstruct
Make sure you have the required Python packages installed. You can find the complete list in the requirements.txt file included with the package.
<br>
### Sample
<br>
```python
import numpy as np
from optimstruct.optim_dict import optim_dict
#initialize optim_dict
my_vars = optim_dict()
#add variables
foo1 = np.array([[1,2,3], [2,4,5], [3,5,7]])
my_vars.add_var("foo1", foo1)
foo2 = np.array([[1,12,3], [2,1,5], [3,55,7]])
my_vars.add_var("foo2", foo2)
#flatten variables into np.array ready to be used with Scipy minimize function
x = my_vars.toVector()
#return np.array into easily accessible dictionary in constrains
var_dict = my_vars.toDict(x)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/andrewnyu/scipy-optimstruct",
"name": "scipy-optimstruct",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "scipy, optimization, data structures",
"author": "Andrew Yu",
"author_email": "andrewthomasyu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/62/9e/5b38c38c64dff4d035d3e480dd0b08562add204181f2d410a4e56f70e278/scipy_optimstruct-0.1.3.tar.gz",
"platform": null,
"description": "# scipy-optimstruct\n\n[![Build Status](https://travis-ci.com/andrewnyu/scipy-optimstruct.svg?branch=master)](https://travis-ci.com/andrewnyu/scipy-optimstruct.svg?branch=master)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg )](https://raw.githubusercontent.com/andrewnyu/scipy-optimstruct/master/LICENSE)\n\nscipy-optimstruct is a Python package that simplifies the implementation of variables and constraints for optimization problems using the SciPy optimization module. It provides a convenient way to define and manage problem structures, making it easier to solve optimization problems.\n\n## Features\n\n- **Introduction to Optimization Problem Structures:** The package includes a Jupyter notebook that provides an introduction to optimization problem structures and demonstrates how to use the SciPy optimization module to solve optimization problems.\n\n- **Examples of Optimization Problem Structures:** The package provides examples of optimization problem structures, including linear programming, quadratic programming, and nonlinear programming.\n\n- **Sample Code:** The package includes sample code that demonstrates how to use the optimization problem structures to solve practical problems.\n\n- **Requirements:** The package includes a requirements.txt file that lists the required Python packages to run the example code.\n\n## Usage\n\nTo use scipy-optimstruct, follow these steps:\n\n1. Install the package using pip:\n\n ```shell\n pip install scipy-optimstruct\n\nMake sure you have the required Python packages installed. You can find the complete list in the requirements.txt file included with the package.\n\n<br>\n### Sample\n<br>\n\n```python\nimport numpy as np\nfrom optimstruct.optim_dict import optim_dict\n\n#initialize optim_dict\nmy_vars = optim_dict()\n\n#add variables\nfoo1 = np.array([[1,2,3], [2,4,5], [3,5,7]])\nmy_vars.add_var(\"foo1\", foo1)\n\nfoo2 = np.array([[1,12,3], [2,1,5], [3,55,7]])\nmy_vars.add_var(\"foo2\", foo2)\n\n#flatten variables into np.array ready to be used with Scipy minimize function\nx = my_vars.toVector()\n\n#return np.array into easily accessible dictionary in constrains\nvar_dict = my_vars.toDict(x)\n\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Enable easier organization of variables and constraints for Scipy Optimize",
"version": "0.1.3",
"project_urls": {
"Download": "https://github.com/andrewnyu/scipy-optimstruct/archive/refs/tags/v0.1.tar.gz",
"Homepage": "https://github.com/andrewnyu/scipy-optimstruct"
},
"split_keywords": [
"scipy",
" optimization",
" data structures"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "26679e4b8de547ea7e5c3f6bc188b9137943fadbcbcee3ba245285d5166895d3",
"md5": "52783154b8c2b93ad2e681f5f4a83cb4",
"sha256": "6aa5ef92c865446afe4330385ac938f22d89af2ef9fa5fa2940dcda530b0de55"
},
"downloads": -1,
"filename": "scipy_optimstruct-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "52783154b8c2b93ad2e681f5f4a83cb4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4030,
"upload_time": "2024-12-02T16:11:42",
"upload_time_iso_8601": "2024-12-02T16:11:42.708273Z",
"url": "https://files.pythonhosted.org/packages/26/67/9e4b8de547ea7e5c3f6bc188b9137943fadbcbcee3ba245285d5166895d3/scipy_optimstruct-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "629e5b38c38c64dff4d035d3e480dd0b08562add204181f2d410a4e56f70e278",
"md5": "30af5a66dacad1b697718790221d8178",
"sha256": "9d68e194cdb0c2453133d52064b65f213a183d816c43c1bfa2aee8f1d81bea19"
},
"downloads": -1,
"filename": "scipy_optimstruct-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "30af5a66dacad1b697718790221d8178",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4074,
"upload_time": "2024-12-02T16:11:43",
"upload_time_iso_8601": "2024-12-02T16:11:43.832837Z",
"url": "https://files.pythonhosted.org/packages/62/9e/5b38c38c64dff4d035d3e480dd0b08562add204181f2d410a4e56f70e278/scipy_optimstruct-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-02 16:11:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "andrewnyu",
"github_project": "scipy-optimstruct",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "scipy-optimstruct"
}