Maritime Science Life

Calculations with context

TOPSIS ranking calculator

Compare alternatives using benefit and cost criteria; examine vector normalization, distances to ideal points and weight sensitivity.

TOPSIS · 1.0.0

TOPSIS: inspect the distance behind the rank

Compare two to six alternatives using two to six nonnegative criteria. Declare which criteria are benefits and which are costs. This implementation uses classical vector normalization and Euclidean distance.

Decision data and criterion weights

Each column must use one unit and a meaningful nonnegative ratio scale, with consistently better performance in the declared direction. Weights are nonnegative preferences; at least one must be positive. They are explicitly divided by their sum before use.

Use a decimal point or comma, without thousands separators. Scientific notation is accepted. AHP also accepts 1/2 through 1/9.

Only visible criteria and alternatives participate. Reducing a count hides entries; increasing it restores them. Reset returns all entries to the teaching example.

Input matrix
AlternativeCriterion 1Criterion 2Criterion 3

Implementation bounds: Each value is 0 or between 10⁻¹² and 10¹² in its declared unit. Each raw weight is 0 or between 10⁻⁶ and 10⁶. Bounds protect arithmetic, not operating limits. A positive-weight all-zero column must be removed or corrected; calculation is rejected. An all-zero column with zero weight is explicitly inactive, with normalized entries set to zero.

The method and worked example below are readable without JavaScript.

Inputs and CSV files are processed in this page. These tools send no calculator data and use no persistent storage. Download begins only after an explicit click.

Five visible transformations

Two reference points, two distancesA schematic plane has two benefit criteria, both preferred upward or to the right. The ideal lies at the upper right and the nadir at the lower left. Candidate A connects to the ideal by D plus and to the nadir by D minus. The candidate is ranked by D minus divided by the sum of the two distances.Weighted benefit criterion 1Weighted benefit criterion 2Ideal (+)Nadir (−)Candidate AD⁺D⁻
Concept diagram for two benefit criteria only. It is schematic and does not plot the three-criterion worked example. Cost criteria reverse the ideal/nadir choice. Both distances are computed in all active dimensions.

Equations and symbol key

wⱼ = bⱼ/Σb · sⱼ = √Σᵢxᵢⱼ²

rᵢⱼ = xᵢⱼ/sⱼ · vᵢⱼ = wⱼrᵢⱼ

Dᵢ⁺ = √Σⱼ(vᵢⱼ − vⱼ⁺)² · Dᵢ⁻ = √Σⱼ(vᵢⱼ − vⱼ⁻)²

Cᵢ = Dᵢ⁻/(Dᵢ⁺ + Dᵢ⁻)

Symbols used in this implementation
SymbolMeaning
m, nNumber of alternatives and criteria, each 2–6
xᵢⱼAlternative i performance on criterion j, in the stated column unit
bⱼ, wⱼRaw and sum-normalized nonnegative criterion weights
sⱼEuclidean norm of criterion j’s input column
rᵢⱼ, vᵢⱼVector-normalized and weighted normalized performance
vⱼ⁺, vⱼ⁻Ideal and nadir coordinates, selected by benefit/cost direction
Dᵢ⁺, Dᵢ⁻Euclidean distances from alternative i to ideal and nadir
CᵢRelative closeness, dimensionless; larger ranks ahead when defined

Record an m × n decision matrix X, benefit (maximize) or cost (minimize) directions and raw weights bⱼ. Normalize the weights: wⱼ = bⱼ/Σb. A weight of zero removes a criterion’s contribution but remains visible in the data.

For each criterion calculate sⱼ = √Σᵢxᵢⱼ² and rᵢⱼ = xᵢⱼ/sⱼ. The resulting column vector has Euclidean norm 1 unless explicitly inactive. This vector normalization is not min–max scaling, reciprocal cost conversion or sum normalization.

Calculate vᵢⱼ = wⱼrᵢⱼ. For a benefit, the ideal is the largest vᵢⱼ and the nadir the smallest; for a cost, reverse those choices. Cost data are not inverted. The reference points are assembled from this alternative set and may not describe a feasible alternative.

Calculate Dᵢ⁺ = √Σⱼ(vᵢⱼ − vⱼ⁺)² and Dᵢ⁻ = √Σⱼ(vᵢⱼ − vⱼ⁻)². Then Cᵢ = Dᵢ⁻/(Dᵢ⁺ + Dᵢ⁻), from 0 to 1, when the denominator is positive. Higher closeness ranks ahead under this model.

If ideal and nadir coincide, every effective alternative is identical: both distances are zero and closeness is 0/0. This tool displays an indeterminate tie, with no invented 0, 0.5 or 1 score and no numerical rank.

Worked article: compare fictional ship-maintenance programs

Imagine three fictional programs for the same ship-maintenance scope. The invented criteria are avoided failure demands in 100 comparable demands (higher preferred), downtime in hours (lower preferred), and labor in person-hours (lower preferred). No observed reliability or cost data are claimed.

Programs A, B and C have rows (8,16,40), (6,8,32) and (9,24,56). Raw weights (4,2,1) normalize to (4/7,2/7,1/7), matching the deliberately consistent AHP teaching priorities. This is an illustrative hybrid, not a universal recommended weighting.

The norms are √181, √896 and √5760. Divide each input by its column norm, then multiply by the normalized weight. For example, vA,1 = (8/√181) × (4/7). The result tables below carry every value through to ideal/nadir, distances and ranking.

Program A has the highest closeness in this particular example. Its lead is conditional on the values, directions and weights. Change a weight or datum and review the sensitivity rows; do not interpret closeness as a probability of success.

Follow every calculation step
Column vector norms and normalized weights
CriterionUnitPreferenceRaw weightwⱼsⱼ
Avoided failure demandscount / 100Benefit: higher is preferred40.571428571413.45362405
DowntimehCost: lower is preferred20.285714285729.93325909
Laborperson·hCost: lower is preferred10.142857142975.89466384
Input matrix
Avoided failure demandsDowntimeLabor
Program A81640
Program B6832
Program C92456
Vector-normalized matrix R
Avoided failure demandsDowntimeLabor
Program A0.5946353170.53452248380.5270462767
Program B0.44597648770.26726124190.4216370214
Program C0.66896473160.80178372570.7378647874
Weighted matrix V
Avoided failure demandsDowntimeLabor
Program A0.33979160970.15272070970.07529232524
Program B0.25484370730.076360354830.06023386019
Program C0.38226556090.22908106450.1054092553
Ideal and nadir
Criterionvⱼ⁺vⱼ⁻
Avoided failure demands0.38226556090.2548437073
Downtime0.076360354830.2290810645
Labor0.060233860190.1054092553
Follow every calculation step
AlternativeD⁺D⁻ClosenessRank
Program A0.088666215050.11812738630.57123327571
Program B0.12742185360.15926214710.55553203762
Program C0.15926214710.12742185360.44446796243

Tables display up to 10 significant digits; CSV preserves the computed binary64 values. Ties are grouped within 10⁻¹² of each descending group’s highest score, with competition ranks (1, 1, 3). Display rounding never determines rank.

Weight sensitivity: one raw weight −20% or +20%

Each positive raw weight is multiplied by 0.8 or 1.2 in turn, then the entire vector is normalized again. Zero weights remain zero. Inputs, directions and alternative set stay fixed. These are hypothetical scenarios, not confidence bounds or a proof of robustness.

Weight sensitivity: one raw weight −20% or +20%
Changed criterion / factorNew normalized weightsCloseness in input alternative orderRanks in input alternative order
Avoided failure demands × 0.80.5161290323 | 0.3225806452 | 0.16129032260.5565062666 | 0.6097334329 | 0.39026656712 | 1 | 3
Avoided failure demands × 1.20.6153846154 | 0.2564102564 | 0.12820512820.5845052698 | 0.5101802797 | 0.48981972031 | 2 | 3
Downtime × 0.80.6060606061 | 0.2424242424 | 0.15151515150.5892052607 | 0.5055090076 | 0.49449099241 | 2 | 3
Downtime × 1.20.5405405405 | 0.3243243243 | 0.13513513510.5572633115 | 0.5969863384 | 0.40301366162 | 1 | 3
Labor × 0.80.5882352941 | 0.2941176471 | 0.11764705880.5696110307 | 0.5519002983 | 0.44809970171 | 2 | 3
Labor × 1.20.5555555556 | 0.2777777778 | 0.16666666670.5731411457 | 0.5598228973 | 0.44017710271 | 2 | 3

Before applying a ranking

  • TOPSIS is compensatory: strength on one criterion may offset weakness on another. Check mandatory safety, feasibility and legal requirements first. Ranking cannot certify equipment or authorize maintenance or operation.
  • Vector normalization is invariant to multiplying a whole criterion by a positive unit-conversion factor, within numerical bounds. It is generally not invariant to adding a constant, such as changing an arbitrary scale origin. Ordinal labels such as “good = 3” do not automatically become ratio-scale evidence.
  • Adding or removing alternatives changes norms and reference points and can change the order of existing alternatives. Correlated criteria can double-count effects. Data uncertainty, expert disagreement and normalization variants require additional analysis.
  • This tool does not train an ANN, estimate probabilities, infer weights from data or implement fuzzy TOPSIS. The ±20% weight scenarios are limited one-at-a-time comparisons; unchanged ranks are not a global robustness guarantee.

Examine how AHP derives the example weights

Primary methods and further reading

Sources checked 8 October 2026. All ship-maintenance values are invented teaching inputs, not measured data. Model version 1.0.0.

Related context

The method explanation and worked example are on this page. The articles below provide additional context.

All calculators