R9482/Homework1ede824a264e9master
README.md
SP4E - Homework 1
General info
This file provides a brief documentation and information related to the first Homework of the course Scientific Programming for Engineers, fall 2019. This homework is done by O. Ashtari and A. Sieber Last update: 16.10.2019
Project Description
This project is intended to solve a minimization problem on n-dimensional quadratic functions defined as S(X)= X<sup>T</sup>AX - X<sup>T</sup>b, where X<sup>T</sup>=[x, y], T represents the transpose, A is an n by n square matrix and b a column vector.
Setup
The project is created with Python 3.7. It moreover requires the following libraries to be installed:
- numpy
- scipy
- matplotlib
- sys
Use
optimizer.py
This script solves minimization problems using the scipy.optimize.minimize routine. The minimization solver can be specified as an input argumeent by entering the following command line:
$ python3 optimizer.py method
Where the variable method is one of the following:
- Nelder-Mead
- Powell
- CG (default)
- BFGS
- L-BFGS-B
- TNC
- SLSQP
The initial guess of the minimization process has to be specified directly in the optimizer.py file by changing the value of the variable X0. The matrix A and vector B can also be modified directly in the file.
conjugate_gradient.py
post_processing.py
Post-processing file that takes as inputs the value of A, B as well as the intermediate solutions of the iterative minimization process and the method used. The file generates a 3D plot displaying the function to be minimized as well as the intermediate solutions.