Giter Site home page Giter Site logo

optimizationhomework's Introduction

OptimizationHomeWork

Run pytest

This repository contains a Python implementation of an optimization algorithm for solving linear programming problems. The algorithm uses the simplex method to find the optimal solution to a given linear programming problem.

Dependencies

To run this program, you will need to have the following dependencies installed:

  • Python 3.x
  • NumPy
  • Pytest

How to run

git clone https://github.com/SergePolin/OptimizationHomeWork
cd OptimizationHomeWork
pip install -r requirements.txt
python homework1.py
# or
python homework2.py
# or
python homework3.py

How to run tests

pytest tests.py

Example

Homework 1 & 2

# input
Enter the coefficients of the objective function: 2 3 -1
Enter the size of matrix A (Example: 3 4): 2 3
Enter the coefficients of constraint functions:
1 1 1
2 -1 1
Enter the right-hand side numbers of constraint functions: 4 2
Enter the approximation accuracy: 1e-6
# output
The optimal solution is:
0.0 0.0 2.0
The minimum value of the objective function is: -2.0

Homework 3

Enter vector of coefficients of supply: 10 15
Enter the size of matrix C (Example: 3 4): 2 3
Enter matrix of coefficients of costs:
6 7 8
15 80 78
Enter vector of coefficients of demand: 15 5 5
-------------------
Vector S
[10. 15.]
Matrix C
[[ 6.  7.  8.]
 [15. 80. 78.]]
Vector D
[15.  5.  5.]
-------------------
North-West method:
The initial basic feasible solution is:
[10.0, 0.0, 0.0, 5.0, 5.0, 5.0]
Vogel's approximation method:
The initial basic feasible solution is:
[0, 5, 5, 15, 0, 0]
Russell's approximation method:
The initial basic feasible solution is:
[0, 5, 5, 15, 0, 0]

optimizationhomework's People

Contributors

thevilfer avatar sergepolin avatar milanaaaa avatar deeprecession avatar

Watchers

 avatar

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.