Microsoft Dynamics Consultant services

Microsoft Dynamics 365 Advisors | CRM ConsultingMicrosoft Dynamics Programming

Dynamic Programming is the most appropriate design technique for solving optimization problems.

Problem is partitioned into disjoint sub-problems by Divide & Conquer algorithm, solves the sub problems repeatedly and then combines their solution to solve the original problems.

When the sub-problems are not independent Microsoft Dynamic Programming is used, for instance, sharing the same sub-problems. In this situation, divide and conquer is evil necessary, because it solves the same sub problem several times.

Dynamic Programming solves each sub-problem only once and stores the result in a table so that it can be frequently retrieved if required again.

Dynamic Programming is a **Bottom-up approach-** so we can solve all problems systematically from smaller to bigger problems.

Dynamic Programming is a model of algorithm design in which an optimization problem is solved by the grouping of sub-problem solutions and appearing to the "**principle of optimality**".

Dynamic Programming works when a problem has the following features:-

**Optimal Substructure:**If an optimal solution consists of optimal sub solutions then a problem can be stated as optimal substructure.**Overlapping sub-problems:**When a repeated algorithm would visit the same sub-problems frequently, then a problem has overlapping sub-problems.

When a problem has optimal substructure, then we can repeatedly define an optimal solution. When a problem has overlapping sub-problems, then we can improvise its implementation by computing each sub-problem at one time in a repeated manner.

When a problem doesn't have optimal substructure, there is no focus point for recursive algorithm to have an optimal solutions. When a problem doesn't have overlapping sub problems, we don't have anything to do with dynamic programming.

If the space of sub-problems is enough then dynamic programming can be more efficient than recursion.

There are three basic elements of Microsoft Dynamic Programming algorithm:-

**Substructure:**divide the given problem into smaller sub-problems. Provide the solution of the original problem in terms of the solution for smaller problems.**Table Structure:**After having the sub-problems, these are stored in a table. This is because sub-problem solutions are repeatedly used over and over again.**Bottom-up Computation:**Combine the solution of smaller sub-problems to solve larger sub-problems using table, and ultimately arrives at a solution to complete problem.

**Note: Bottom-up means:-**

- Begin with smallest sub-problems.
- Combining their solutions get the solution to sub-problems of growing size.
- Till solving at the solution of the original problem.

**Stages:**Stages is known as the problem which can be divided into multiple sub-problems, stage is a minute portion of a certain problem. For instance, in the shortest path problem, they were explained by the structure of the graph.**States:**Several states are associated with each stage. Node reached were the states for the shortest path problem.**Decision:**At every stage, one of the best decisions should be taken out of given several choices. The decision should be optimal taken at every stage; this is what we called a stage decision.**Optimal policy:**At each stage, it is a rule which determine the decision; a policy is an optimal policy if it is optimal globally. This Bellman principle of optimality.- At recent state, the optimal choices for each of the lasting states do not depend on the decisions or previous states. It was not compulsory to know in the shortest path problem, how we got a node only that we did.
- There is recursive relationship that identifies the optimal decisions for stage j, given that stage j+1, has been solved already.
- The last stage has to be solved by itself.

It can be divided into four steps:

- Distinguish the structure of an optimal solution.
- Repeatedly defined the value of the optimal solution. Similar to Divide and Conquer, divide the problem into two or more optimal parts repeatedly. This helps to decide what the solution will look alike.
- Calculate the value of the optimal solution from the bottom up.
- Build the optimal solution for the complete problem form the calculated values of smaller sub-problems.

- 0/1 knapsack problem
- Longest common subsequence (LCS)
- Mathematical optimization problem
- Flight control and robotics control
- Time-sharing: It schedules the job to maximize CPU usage
- All pair Shortest path problem
- Reliability design problem