Electron microscopy
 
PythonML
Linear Programming (LP) Algorithm
- Python Automation and Machine Learning for ICs -
- An Online Book -
Python Automation and Machine Learning for ICs                                                           http://www.globalsino.com/ICs/        


Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

=================================================================================

Linear Programming (LP) is a method to achieve the best outcome (such as maximum profit or lowest cost) in a mathematical model whose requirements are represented by linear relationships. In other words, linear programming is a mathematical technique for finding the optimal values of decision variables that satisfy a set of linear equality and inequality constraints while minimizing or maximizing a linear objective function. The algorithm used to solve linear programming problems is called the Linear Programming Algorithm. 

There are various methods to solve linear programming problems, and one common approach is the Simplex algorithm. The Simplex algorithm iteratively moves from one feasible solution to another, improving the objective function at each step until an optimal solution is reached. Other algorithms, like the Interior Point methods, can also be used to solve linear programming problems. Linear programming is widely used in various fields such as operations research, economics, finance, and logistics for optimization purposes. 

In linear programming, the goal is to optimize (minimize or maximize) a linear cost function subject to linear equality and inequality constraints, along with variable bounds. The general form of an LP problem is as follows:

  1. Minimize (or Maximize): 

     ----------------------------------------- [3594a]

This cost function is the objective function that we aim to maximize.

  1. Subject to: 

    ----------------------------------------- [3594b]

      ----------------------------------------- [3594c]

      ----------------------------------------- [3594d]

      ----------------------------------------- [3594e]

      ----------------------------------------- [3594f]

  2. With Bounds:

      ----------------------------------------- [3594g]

      ----------------------------------------- [3594h]

      ----------------------------------------- [3594i]

where,

c1, c2, …, cn are coefficients of the objective function. 

 aij are coefficients of the constraint equations. 

 b1, b2, …, bm are constants on the right-hand side of inequality constraints. 

 li and ui are lower and upper bounds on the variables xi

The goal is to find values for x1, x2, …, xn that minimize (or maximize) the given cost function while satisfying all the constraints and variable bounds. 

An example of applications of linear programming algorithms is a financial portfolio optimization problem. Suppose we have a budget of $1,000,000 to invest in three different assets: stocks (x1), bonds (x2), and real estate (x3). The expected returns per unit of investment are given as 8%, 5%, and 4%, respectively. We want to maximize the total expected return while ensuring that no more than 40% of the portfolio is invested in stocks and the risk (measured by standard deviation) does not exceed a certain threshold. This linear programming problem can be solved using LP algorithms to find the optimal allocation of the budget across the different assets, considering the expected returns, risk constraints, and individual asset constraints. The solution will provide the proportion of the budget to be invested in each asset to achieve the maximum expected return. 

In this problem, the variables are x1, x2, and x3, which represent the proportion of the total investment allocated to different financial assets or securities. Our objective function is to maximize c1x1 + c2x2 + c3x3. Here, c1 , c2, and care the expected returns per unit of investment for each asset. The budget constraint is that the sum of the investments should not exceed the total budget x1 + x2 + x3 ≤ B. The risk constraint is that the overall risk (variance or standard deviation) of the portfolio should not exceed a certain limit. The individual asset constraints is that the minimum and maximum allocations for each asset is li ≤ xi ≤ ui. This code  with the scipy.optimize.linprog function can be used to address the problem here.

============================================

         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         

 

 

 

 

 



















































 

 

 

 

 

=================================================================================