OpenRules Platform

Decision Optimization

Inside/Outside Production

Determine which products to manufacture internally and which to purchase while respecting capacity and cost constraints.

Problem

We need to help a manufacturer decide how much of each demanded product should be produced internally and how much should be sourced from outside. Whether a product is made inside or outside, it has an associated cost. A product can consume a given amount of internal resources that have limited capacities. The general objective is to minimize the total production cost while ensuring the company meets the demand exactly or with a certain tolerance. This DMCommunity challenge provides the following data samples with products, resources, and capacity requirements:

image

The manufacturer wants to consider various production decisions to choose the most suitable ones based on the long-term resource availability and uncertain future demand. This sample demonstrates how OpenRules Decision Playground can be used to find the best production decision.

Decision Model

The proper decision model is implemented as a simple project, “InsideOutsideProduction” coming with OpenRules Rule Solver. This example is based on the decision model “InsideOutsideProduction” located in “openrules.solver/ADVANCED”.

Here is the Glossary:

image

Here are two main methods, “Define” and “Solve”, that are pretty common for decision models utilizing Rule Solver:

image

The table “DefineProductVariables” for each product P in the input array “Products” defines the proper constrained decision variables with names like “InsideP1” or “OutsideP2” with possible values from 0 to the Demand of this particular product:

image

It also adds the product variables to the arrays “InsideVariables” and “OutsideVariables” that will be needed to specify optimization objectives.

The table “DefineDemanVariables” defines the demand variables like “DemandP1” that should be equal to the sum of variables “InsideP1” and “OutsideP1”:

image

The table “PostDemandConstraints” for each product P in the input array “Products” posts a constraint that states that the proper demand decision variable should not be less than the required demand of this product:

image

The table “ConsumptionConstraints”

image

for each resource R in the array “Resources” does the following. First, it executes this table to define an array with all resource consumption variables for each consumption in the array “Consumptions”:

image

Then it executes this table to post the main consumption constraint for each resource:

image

To define optimization objectives, first we need to use temporary arrays “InsideCosts” and “OutsideCosts” that can be easily filled out by the regular OpenRules decision table “DefineInOutCosts”:

image

The following table defines all optimization objectives as new constrained decision variables:

image

The table “Solve” relies on the standard solving method “SolveWithOptions“. When a solution is found, this method automatically invokes the method “SaveSolution” if it exists. This decision model saves every solution using the following table:

image

Here are the execution results for the first test case:

image

Try Rule Solver

Build decision models that find the best answer.

Start with the free evaluation, then install Rule Solver and explore its optimization examples.