Giter VIP home page Giter VIP logo

optix's Introduction

Optix

AeroLab Optimization Software

Created by:

  • Dr Doug Hunsaker (professor, Utah State University; director, USU AeroLab)
  • Josh Hodson (graduate student, Utah State University)
  • Cory Goates (undergraduate/graduate student, Utah State University)

NOTE FOR LEGACY OPTIX USERS:

Since January of 2019, API of Optix has changed significantly to somewhat mirror that of scipy.optimize. We continue working to improve the API and functionality of Optix. This README will always contain up to date information for using Optix.

About

Optix is a gradient-based optimization tool designed with aerodynamics in mind. Recognizing that aerodynamic functions are often computationally intensive, Optix has been designed to be as light-weight and parallel as possible, while offering an intuitive API.

The algorithms have been developed, for the most part, using the following references:

  • Parkinson, Balling, Hedengren, Optimization Methods for Engineering Design, Brigham Young University, 2013.
  • Martins, Ning, Engineering Design Optimization, electronically published, 2020.

THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED

API

All functionality of Optix is wrapped within the minimize(). The following is an example of how this function is used:

import optix as opt
from random import random

def f(x):
    return x[0]**4-2*x[1]*x[0]**2+x[1]**2+x[0]**2-2*x[0]+5

x0 = [-10+20*random(),-10+20*random()]

optimum = opt.minimize(f,x0,file_tag="_test",n_search=8,max_processes=8,line_search="quadratic",termination_tol=1e-6,verbose=False,hess_init=1)
print("Optimum value: {0}".format(optimum.f))
print("Optimum point: {0}".format(optimum.x))
print("Function calls: {0}".format(optimum.obj_calls))

File Outputs

Running optix.minimize() will also output results to 3 text files. These 3 files are named iterations, gradient, and evaluations, each appended with the user-specified file tag. The first two are written to during runtime. The last is written to only after successful completion of the optimization. Optimize mimics what is printed to the command line, giving information about the fitness, point in the design space, magnitude of steps, etc. Gradient gives information about the objective and constraint gradients at each point in the optimization. Evaluations simply outputs the value of the objective function at each point considered during optimization, including points used to calculate finite differences.

Documentation

For documentation, please refer to the docstrings. This can be done either by using the built in python help() command in the interpreter or by refering to the source. For example, to view the minimize() parameters and return values, type:

    help(optix.minimize)

into a Python interpreter. Please note that Optix should be imported first.

Getting the Source Code

The source code can be found at https://github.com/usuaero/Optix

You can either download the source as a ZIP file and extract the contents, or clone the Optix repository using Git. If your system does not already have a version of Git installed, you will not be able to use this second option unless you first download and install Git. If you are unsure, you can check by typing git --version into a command prompt.

Downloading source as a ZIP file

  1. Open a web browser and navigate to https://github.com/usuaero/Optix
  2. Make sure the Branch is set to Master
  3. Click the Clone or download button
  4. Select Download ZIP
  5. Extract the downloaded ZIP file to a local directory on your machine

Cloning the Github repository

  1. From the command prompt navigate to the directory where Optix will be installed
  2. git clone https://github.com/usuaero/Optix

Installation

The Optix package can be installed by navigating to the root directory of the project and using the following command

   pip install .

This installs Optix as a package on your machine, meaning you can import Optix into any Python script without having to copy around the source files

Testing

Unit tests are are run using the following command:

    py.test

Please note that you must have Pytest installed for this to work.

Support

For bugs, please create an issue on the github repository.

License

This project is licensed under the MIT license. See LICENSE file for more information.

optix's People

Contributors

corygoates avatar doughunsaker avatar joddlehod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

optix's Issues

Problem with multiprocessing in Windows 11

I ve had a problem running optix in Windows 11 which occurs either inside or outside of Pycharm IDE. It ssems to be related to multiprocessing.
Nothing is said in the Readme file about the running environment, I ve assumed it runs correctly in any Environment (Windows or Linux). I may have an installation problem.

import optix as opt

Define the objective function

def objective_function(x):
return (x[0]-5) ** 2+4*(x[1]-2) ** 2

if name == 'main':

# Initial guess
xo =[-2.0, -2.0]

optimum = opt.minimize(objective_function, xo, file_tag='_test', n_search = 8, max_processors = 1, line_search = "quadratic", termination_tol = 1e-6, verbose = True)

Running trace as follows:

C:\Documentos\Artificial Inteligence\Optimization\Optix-master\Optix-master>python myptix.py
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\spawn.py", line 120, in spawn_main
exitcode = _main(fd, parent_sentinel)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\spawn.py", line 133, in _main
return self._bootstrap(parent_sentinel)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BaseProcess._bootstrap() takes 1 positional argument but 2 were given
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\spawn.py", line 120, in spawn_main
exitcode = _main(fd, parent_sentinel)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\spawn.py", line 133, in _main
return self._bootstrap(parent_sentinel)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BaseProcess._bootstrap() takes 1 positional argument but 2 were given
Traceback (most recent call last):
File "C:\Users\mvgfa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\multiprocessing_on_dill\connection.py", line 312, in _recv_bytes
nread, err = ov.GetOverlappedResult(True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
BrokenPipeError: [WinError 109] O pipe foi finalizado

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Documentos\Artificial Inteligence\Optimization\Optix-master\Optix-master\myptix.py", line 12, in
optimum = opt.minimize(objective_function, xo, file_tag='_test', n_search = 8, max_processors = 1, line_search = "quadratic", termination_tol = 1e-6, verbose = True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Documentos\Artificial Inteligence\Optimization\Optix-master\Optix-master\optix\optix.py", line 212, in minimize
manager = mp.Manager()
^^^^^^^^^^^^
File "C:\Users\mvgfa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\multiprocessing_on_dill\context.py", line 55, in Manager
m.start()
File "C:\Users\mvgfa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\multiprocessing_on_dill\managers.py", line 483, in start
self._address = reader.recv()
^^^^^^^^^^^^^
File "C:\Users\mvgfa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\multiprocessing_on_dill\connection.py", line 250, in recv buf = self._recv_bytes()
^^^^^^^^^^^^^^^^^^
File "C:\Users\mvgfa\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\multiprocessing_on_dill\connection.py", line 321, in _recv_bytes
raise EOFError
EOFError

Thanks for making this software available to test!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.