ORMSwareTM is a proprietary quantitative modeling and programming system developed by US Army veteran Reginald Joules at Ushar Enterprises Inc, Littleton, Colorado, USA, with keen interest in national defense problems

Home Modeling Examples Programming Examples Contact Us

Problem 1: Optimal Machine Replacement Plan

A company wants to develop a rolling plan for replacing a machine in a production operation. Alternatives are numerous as the company has the option to trade in the machine every year and get either a new model or an earlier model. Older models have lower purchase costs, but higher maintenance costs and lower trade-in values.



  • Planning is done over a 4-year time horizon. With a model, the company will have the capability to continually reevaluate the plan every year for another 4 year horizon.

  • Proper formulation of this problem is a normative model which prescribes an optimal replacement plan. But, the purpose of this example is to show how to build a descriptive model of a situation to facilitate what-if analysis.

  • The company wants to look at ten alternative plans. This model will calculate all possible alternatives, but display only the top ten choices.

  • Upon studying contents of each node and arc in the formulation readers will be able to see how the model can be expanded with ease to accommodate more choices in equipment age, price changes of new equipment over time, present value of alternatives, changeover costs, etc.


Modeling requirements for this problem can be handled by using a trivial short path method. A non-naive short path algorithm would find the optimal replacement plan by intelligently searching through the solution space to quickly converge on the answer. But, in this case, we will start with the beginning year and explicitly evaluate the consequences of every decision choice and follow each consequence thread to evaluate the next year's choices, and so on.

As one can easily imagine, the total number of choices expand by a factor of 3 for each year in the rolling planning horizon, but the NMOD modeling environment will automatically expand to accommodate the choices, constrained only by the memory available in the computer platform used to run the model.

ReplacementPlan.a[4]EndOfYear--->|Total costs

To select the top n alternatives calculated in this manner, we can manipulate the duration property of the arc (a[4]) going into the results writing node (see left). Setting duration equal to the total cost of each alternative will cause the lowest cost alternative to arrive at the results writing node first, the second lowest cost alternative next, and so on.

NMOD also has a method called TravelNotes, which can be used to track travel history of an entity through the network. In this case, we can call this method each time we want to record an event/decision as an entity travels through the network. When the entity gets to the results writing node, the entire sequence of decisions that entity has been through, along with the related costs, can be written to the results file by using NMOD's ShowTravelNotes method.

To see how the results written this way turn out, click here to preview the results file from this model.


Formulation of this problem is more easily understood through its ORMSware network diagram and supplemental data files. Click the links below as desired to open these files in separate windows for reference while reading this document.

VSD file: Image of Visio network file describing the model
Results: Preview of results of this model.

Following section describes the model:

  • In any given year in the planning horizon the company has the choice of trading in existing machine for a brand new model or for an older model, or not replacing the machine at all.

  • Trade-in values, purchase prices, and operation and maintenance costs are pulled from the table shown above based on the age of the machines involved.

  • Model starts with two choices, viz. whether to buy a new machine or an older machine. Model ends at the end of 4th year when the machine in use at the time is traded in and not replaced. The model can easily be changed to start with an existing machine and end without trading in the machine in use at the time, or in any number of other ways.


Model starts execution with the Start node (green color) in the network diagram. In this model that node is named "Initializations." It happens to be object number 1 in this case, indicated as [1] in the top line of the node display. Analysts usually model the middle parts of a model first before dealing with the start node. So, the object ID which an initialization node typically gets assigned by Visio is something other than 1.

Start node in the top level network of a model is often used to set up and initialize various variables, perform various non-repetitive tasks, and to launch repeated executions of various cycles (loops) in the model.

There is only one cycle (n[2]-a[6]-n[3]-{a[5],a[11],a[12]}-n[2]) in this model.

All arcs in this model are OR arcs. This means that the target/terminating node of each arc fires as soon as a calculation flow gets to the node through that arc. AND arcs, on the other hand, could cause delay in the execution of successor nodes, pending arrival of matching flows. You will see how AND arcs work in other examples posted at this site.

Contents of key nodes and arcs

{a[9],a[10]}Initializations--->|StartOfNewYear: When execution of n[1]Initializations is finished, two execution threads (entities) are launched along these arcs (i.e. a[9]Initializations--->|StartOfNewYear and a[10]Initializations--->|StartOfNewYear) to n[2]StartOfNewYear. Entities are transformed as they travel along these arcs (i.e. their properties change). As an entity travels along a[9], its Type property takes on the value "Old" to carry the initial decision alternative of buying an earlier model machine; the Type property of the other entity traveling along a[10] takes on the value "New" to indicate the initial decision choice of buying a brand new machine.

n[2]StartOfNewYear: When this node is reached the first time (through [9] and [10]), no machine is yet on hand for trade-in. Therefore, the first time around this node calculates only the cost of buying a machine (i.e. no trade-in involved). It retrieves the purchase price from the table provided ({Table.D}PurchasePrices in Excel file Tables.HTM provided by the analyst) based on the Type property (old or new machine) of the calculation entity. The node does this for both entities coming from n[1]Initializations.

After the first time, this node calculates purchase costs only if the TradeIn property of entities coming from n[3]EndOfYear indicates that existing machine is to be traded in. And, if they are to be traded in, the node calculates purchase price depending on the Type property of the entity set on either a[11] or a[12] and subtracts the trade-in value from total costs.

The decision and associated costs are then added to entity's travel history by calling NMOD's TravelNotes method.

a[6]StartOfNewYear--->|EndOfYear: This arc calculates the age property of an entity traveling along this arc and fetches the cost of operating and maintaining that machine during the current year based on the age of the machine. Then, it adds to the entity's Travel Notes the O&M costs and running total of the alternative it is pursuing.

n[3]EndOfYear: This node facilitates generating three decision alternatives the analyst wants to pursue for every year in the time horizon, viz. trade in existing machine for a new one, trade in for an older model, or continue to use existing machine. As such, the role of this node is somewhat of a supportive nature. To indicate this, the analyst has set the Role property of the node to Support. That setting causes the node outline to turn gray or dashed gray (for display purposes), pushing it a little into the background visually. Primary and Support nodes/arcs have the same functionality. Analysts use Role property simply to help a reviewer/stakeholder grasp the essence of a model easily by pushing certain model details to the back.

The two alternatives that existed at the beginning of the planning horizon become six alternatives the first time they pass through this node. They multiply further as chasing each alternative till the end of the planning horizon continues. As this multiplication occurs at this node, every entity's Travel Notes up to that point are stored into all entities branching out along the three successor arcs. As you can see, the total number of alternatives for a given planning horizon of n years can be computed with the formula 2 * 3 ** (n-1). i.e. 2 times 3 raised to the power of n-1. Thus, in the case of a 4-year initial planning horizon, the total number of alternatives generated will be 2 * 3 ** 3 = 54.

a[5]EndOfYear--->|StartOfNewYear: This arc represents the decision choice of not trading in current machine in a new year. So, it sets the TradeIn property of entities to False so that n[2]StartOfNewYear will not calculate cost of trading in current machine for another one.

a[11]EndOfYear--->|StartOfNewYear: This arc represents the decision choice to trade in current machine for a machine that is not brand new. It sets the TradeInValue property of the entity to reflect how much money the current machine will get when traded in at n[2]StartOfNewYear. It also sets the user-defined Type property of the entity to communicate to n[2]StartOfNewYear that next purchase decision for this alternative is to buy a machine that is not brand new.

a[12]EndOfYear--->|StartOfNewYear: This arc represents the decision choice to trade in current machine for a brand new machine. Just as a[11] it sets the TradeInValue property of the entity to reflect how much money the current machine will get when traded in at n[2]StartOfNewYear. It also sets the user-defined Type property of the entity to communicate to n[2]StartOfNewYear that next purchase decision for this alternative is to buy brand new machine.

a[4]EndOfYear--->|Total costs: This arc helps order the alternatives (threads/entities) in ascending order of total costs. This is accomplished by setting the arc's duration property equal to the total cost property of the alternative (see above in the image of the dialog box for this arc the definition of duration property). When NMOD schedules the time at which each of these entities is to arrive along this arc at n[7]Total costs, it will automatically schedule the arrivals to occur from the lowest total cost to the highest. Capturing the top 10 alternatives then is simply a matter of writing them to a results file as they arrive at n[7]Total costs.


Click here to view the file containing results calculated by this model.


Click to go to summaries of all examples