Note that this question is cross posted from OR-exchange
Although we have a software that solves this for us, I'd like to understand the background behind the scenes as well as build a validation program perhaps in Python to solve this. The problem:
'ASSETS' are physical assets that need to be maintained and preserved. Each 'ASSET' has the following attributes: age, volume, and condition_index.
Through time and usage assets will require maintenance. When performed on an asset, each treatment resets the age of the asset to zero and its condition index to 100 based on the following. Note that condition index takes precedence over age:
Treatment_A: 5 <= ASSET.AGE <= 10 OR 70 <= ASSET.CONDITION_INDEX <= 85
Treatment_B: 11 <= ASSET.AGE <= 15 OR 50 <= ASSET.CONDITION_INDEX <= 69
Treatment_C: 16 <= ASSET.AGE <= 20 OR 30 <= ASSET.CONDITION_INDEX <= 49
Treatment_D: ASSET.AGE >= 21 OR ASSET.CONDITION_INDEX <= 29
Note that only one treatment per period can be applied to an asset. Each treatment has a different cost:
TREATMENT_A: $10,000 per unit of volume
TREATMENT_B: $20,000 per unit of volume
TREATMENT_C: $30,000 per unit of volume
TREATMENT_D: $40,000 per unit of volume
Assets deteriorate over time based on the following: relationship (age: condition_index):
[(0: 100), (5: 80), (10: 70), (15: 50), (20: 30), (30: 10), (35: 0)]
Asset condition is determined by its age and/or condition index:
Excellent_assets: condition_index >= 90
Good_assets: condition_index >= 75
Fair_assets: condition_index >= 50
Poor_assets: condition_index <= 30
The question is: Develop a linear programming model to maximize (Excellent + good + fair - poor assets) for a constraint budget of $50,000 for all assets for 2 years
Solution Attempt:
let's say we have 4 assets:
assets = {
"a_1": [10, .500, 50],
"a_2": [02, .300, 86],
"a_3": [30, .900, 15],
"a_4": [07, 1.30, 78],
}
Constraints and Variables:
p = period
t = treated_volume
ut = untreated
The following constraints ensure that no work to be treated on an asset per year is larger than the available volume
t_a_1_p_1 + ut_a_1_p_1 <= 0.5
t_a_1_p_2 + ut_a_1_p_2 <= 0.5
t_a_2_p_1 + ut_a_2_p_1 <= 0.3
t_a_2_p_2 + ut_a_2_p_2 <= 0.3
t_a_3_p_1 + ut_a_3_p_1 <= 0.9
t_a_3_p_2 + ut_a_1_p_1 <= 0.9
t_a_4_p_1 + ut_a_4_p_1 <= 1.3
t_a_4_p_2 + ut_a_4_p_2 <= 1.3
Based on the conditions of the assets, the following is a potential of work done (volume) for each asset per period:
Period 1 - Treatment A:
t_a_2_p_1 + t_a_4_p_1 <= t_p_1_treatment_a
Period 1 - Treatment B:
t_a_1_p_1 <= t_p_1_treatment_b
Period 1 - Treatment C:
0 <= ut_p_1_treatment_c
Period 1 - Treatment D:
t_a_3_p_1 <= t_p_1_treatment_d
Period 2 - Treatment A:
t_a_2_p_2 + t_a_4_p_2 <= t_p_2_treatment_a
Period 2 - Treatment B:
0 <= t_p_2_treatment_d
Period 2 - Treatment C:
t_a_1_p_2 <= t_p_2_treatment_c
Period 2 - Treatment D:
t_a_3_p_2 <= t_p_2_treatment_d
Conditions of assets:
excellent_p_1 = t_a_2_p_1 + t_a_4_p_1 + t_a_1_p_1 + t_a_3_p_1
excellent_p_2 = t_a_2_p_2 + t_a_4_p_2 + t_a_1_p_2 + t_a_3_p_2
good_p_1 = ut_a_4_p_1
good_p_2 = ut_a_4_p_1
fair_p_1 = ut_a_1_p_1
fair_p_2 = 0
poor_p_1 = ut_a_3_p_1
poor_p_2 = ut_a_1_p_2
Cost Variables:
cost_t_p_1_treatment_a = t_p_1_treatment_a * 10000
cost_t_p_1_treatment_b = t_p_1_treatment_b * 20000
cost_t_p_1_treatment_c = t_p_1_treatment_c * 30000
cost_t_p_1_treatment_d = t_p_1_treatment_d * 40000
cost_t_p_2_treatment_a = t_p_2_treatment_a * 10000
cost_t_p_2_treatment_b = t_p_2_treatment_b * 20000
cost_t_p_2_treatment_c = t_p_2_treatment_c * 30000
cost_t_p_2_treatment_d = t_p_2_treatment_d * 40000
So Objective function becomes:
Maximize (excellent_p_1 + excellent_p2 + good_p_1 + good_p_2 + fair_p_1 + fair_p_2 - poor_p_1 - poor_p_2)
subject to:
cost_t_p_1_treatment_a + cost_t_p_1_treatment_b + cost_t_p_1_treatment_c + cost_t_p_1_treatment_d <= 50000
cost_t_p_2_treatment_a + cost_t_p_2_treatment_b + cost_t_p_2_treatment_c + cost_t_p_2_treatment_d <= 50000
My question is: I'd like to solve the problem using linear programming formulation and so far, I think my solution is a bit ad-hoc and perhaps not correct. I'm curious to know your thoughts and suggested ways on how a potential solution