Veterans Reculturation

Veterans Reculturation preview image

1 collaborator

Default-person Artem Serdyuk (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.4.0 • Viewed 7 times • Downloaded 2 times • Run 0 times
Download the 'Veterans Reculturation' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;; NetLogo Veterans Model 5.3: Fixed version with all original features
;; 1 tick = 1 day, balanced costs and efficiency magnitudes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

globals [
  ;; Time settings
  tick-per-year                  ;; 365 days per year

  ;; War and recruitment
  war-intensity
  conscription-rate
  volunteer-rate
  ;target-military-size
  ;service-years

  ;; VA Budget System
  va-total-budget
  va-basic-budget
  va-program-budget
  total-basic-needs
  basic-needs-coverage

  ;; Program allocations (percentages)
  integration-program-share      ;; Percentage of program budget
  community-center-share         ;; Percentage of program budget
  transition-program-share       ;; Percentage of program budget
  crisis-intervention-share      ;; Percentage of program budget

  ;; Population counts by status
  civilian-count
  military-recruit-count
  military-count
  veteran-adapting-count
  veteran-count

  military-deaths
  military-wounded
  civilian-deaths
  civilian-wounded
  veteran-deaths
  civilian-migrants
  veteran-migrants

  ;; Veteran category counts
  integrationist-count
  separationist-count
  assimilationist-count
  marginalized-count

  ;; Efficiency totals (split as requested)
  total-civilian-efficiency
  total-military-efficiency
  combined-system-efficiency

  ;; Interface
  average-service-attitude
  average-attitude-toward-civilians  ;; NEW

  ;; Geographic distribution tracking
  num-cities
  total-city-population
  num-bases
  total-base-population

  ;; Spillover effects tracking
  average-positive-influence
  average-negative-influence
  high-influence-positive-count
  high-influence-negative-count

  ;; NEW: Allocation strategy system
  ;  allocation-strategy            ;; "Equity-First", "Triage-First", "Impact-First", "Prevention-First"
  ;  manual-allocation?             ;; Boolean: true for manual control, false for automatic;; Conversion rates: effect per $1 spent

  dollar-to-civilian-efficiency    ;; 0.01
  dollar-to-military-efficiency    ;; 0.01
  dollar-to-service-attitude       ;; 0.002
  dollar-to-satisfaction           ;; 0.005
  dollar-to-wellbeing             ;; 0.02
  dollar-to-positive-influence     ;; 0.001
  dollar-to-attitude-civilians     ;; 0.002
]

;; Breeds
breed [people person]
breed [community-centers community-center]

;; Person properties
people-own [
  ;; Core attributes
  status                     ;; "civilian", "military-recruit", "military", "veteran-adapting", "veteran"
  aptitude                   ;; Base capability (0-1)
  service-attitude           ;; Attitude toward military service (0-1)
  attitude-toward-civilians  ;; NEW: Attitude toward civilian society (0-1)
  age                        ;; Age in years
  economic-resources         ;; NEW: Wealth/savings based on accumulated efficiency

  ;; Geographic origin and location
  home-city                  ;; The community center this person originated from
  current-city               ;; Current community center (can be different during military service)

  ;; Service record
  service-duration           ;; Time in service (in days)
  combat-exposure            ;; Combat experience level (0-1)
  service-type               ;; "volunteer", "conscript", "recalled"

  ;; Efficiency measures (split as requested) - SCALED UP
  civilian-efficiency        ;; Productivity in civilian roles (0-100)
  military-efficiency        ;; Effectiveness in military roles (0-100)

  ;; Spillover influence tracking
  positive-influence          ;; Positive influence this person exerts (0-1)
  negative-influence          ;; Negative influence this person exerts (0-1)
  influence-radius            ;; How far this person's influence extends
  last-spillover-update       ;; When spillover effects were last calculated

  ;; Psychological state
  extremist?                 ;; Boolean extremist flag
  well-being                 ;; Overall well-being (0-100)

  ;; Veteran-specific (only used when status includes "veteran")
  veteran-category           ;; "integrationist", "separationist", "assimilationist", "marginalized"
  basic-needs-cost           ;; DAILY cost of basic needs ($)
  satisfaction-rate          ;; Proportion of needs being met (0-1)
  receiving-va-support?      ;; Currently receiving VA support

  ;; Progress tracking
  training-progress          ;; Training completion (0-1)
  adaptation-progress        ;; Adaptation completion (0-1)
]

;; Community center properties
community-centers-own [
  community-id
  center-type               ;; "city" or "military-base"
  capacity                  ;; How many people can be stationed here
  current-population        ;; Current number of people here
]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SETUP PROCEDURES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup
  clear-all
  reset-ticks

  setup-globals
  setup-environment
  setup-communities
  setup-population

  update-statistics
  update-va-budget
  ;update-visualization
end 

to setup-globals
  set tick-per-year 365

  ;; War dynamics
  set war-intensity 0.8
  set conscription-rate 0.01
  set volunteer-rate 0.005
  ;set target-military-size round (initial-population * 0.25)  ;; Set your desired military size here

  ;; VA program allocation defaults
  set integration-program-share 25
  set community-center-share 20
  set transition-program-share 30
  set crisis-intervention-share 25

  ;; Initialize counts
  set civilian-count 0
  set military-recruit-count 0
  set military-count 0
  set veteran-adapting-count 0
  set veteran-count 0

  set military-deaths 0
  set military-wounded 0
  set civilian-deaths 0
  set civilian-wounded 0
  set civilian-migrants 0
  set veteran-migrants 0
  set veteran-deaths 0

  ;; Efficiency tracking
  set total-civilian-efficiency 0
  set total-military-efficiency 0
  set combined-system-efficiency 0

  set average-service-attitude 0.5
  set average-attitude-toward-civilians 0.5

  ;; Geographic distribution
  set total-city-population 0
  set total-base-population 0

  ;; Spillover effects
  set average-positive-influence 0
  set average-negative-influence 0
  set high-influence-positive-count 0
  set high-influence-negative-count 0

  ;; Allocation strategy
  ;set allocation-strategy ""Equal-Share"
  ;; set manual-allocation? false
end 

to setup-environment
  ;; Set world size
  resize-world -50 50 -50 50
  set-patch-size 4

  ;; Background
  ask patches [
    set pcolor 2  ;; Dark background
  ]
end 

to setup-communities
  ;; Create cities
  set num-cities 5
  create-community-centers num-cities [
    set community-id who
    set center-type "city"
    set capacity 1000
    set current-population 0
    set shape "house"
    set size 3
    set color white

    ;; Spread cities across the world
    setxy (random-xcor * 0.8) (random-ycor * 0.8)

    ;; Mark surrounding area
    ask patches in-radius 5 [
      set pcolor 3
    ]
  ]

  ;; Create military bases
  set num-bases 2
  create-community-centers num-bases [
    set community-id who
    set center-type "military-base"
    set capacity 500
    set current-population 0
    set shape "triangle"
    set size 3
    set color green

    ;; Place bases away from cities
    setxy (random-xcor * 0.9) (random-ycor * 0.9)

    ;; Mark surrounding area
    ask patches in-radius 4 [
      set pcolor 52
    ]
  ]
end 

to setup-population
  ;; Create initial civilian population
  create-people initial-population [
    set status "civilian"
    setup-person-attributes
    setup-person-appearance

    ;; Assign to random city
    let cities community-centers with [center-type = "city"]
    set home-city one-of cities
    set current-city home-city

    ;; Place near home city
    move-to home-city
    rt random 360
    forward random 5
  ]
end 

to setup-person-attributes
  ;; Core attributes
  set aptitude 0.3 + random-float 0.7
  set service-attitude 0.3 + random-float 0.5
  set attitude-toward-civilians 0.5 + random-float 0.5  ;; NEW
  set age 18 + random 50
  set economic-resources 1000 + random 5000  ;; NEW: Starting resources
  set extremist? false
  set well-being 50 + random 50

  ;; Initialize efficiency (SCALED UP)
  set civilian-efficiency (aptitude * (0.8 + random-float 0.4)) * 100
  set military-efficiency 0

  ;; Initialize spillover influence
  set positive-influence 0
  set negative-influence 0
  set influence-radius 1 + random 5
  set last-spillover-update 0

  ;; Geographic properties
  set home-city nobody
  set current-city nobody

  ;; Service record
  set service-duration 0
  set combat-exposure 0
  set service-type "none"

  ;; Veteran attributes
  set veteran-category ""
  set basic-needs-cost 0
  set satisfaction-rate 0
  set receiving-va-support? false

  ;; Progress tracking
  set training-progress 0
  set adaptation-progress 0
end 

to setup-person-appearance
  set shape "person"
  ifelse status = "civilian" [set color gray]
  [ifelse status = "military-recruit" [set color yellow]
    [ifelse status = "military" [set color green]
      [ifelse status = "veteran-adapting" [set color orange]
        [
          ifelse status = "veteran" [;; Color by category
            ifelse veteran-category = "integrationist" [set color blue]
            [ifelse veteran-category = "separationist" [set color cyan]
              [ifelse veteran-category = "assimilationist" [set color pink]
                [ifelse veteran-category = "marginalized" [set color red]
                  [set color violet]
                ]
              ]
            ]
          ]
          [set color white]
        ]
      ]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MAIN PROCEDURES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  if count people < 5 [ stop ]

  ;; Update war intensity
  ifelse random-float 1 < 0.05 [
    set war-intensity min list 1 (precision (war-intensity + random-float 0.2) 2)
  ] [
    set war-intensity max list 0 (precision (war-intensity - 0.01) 2)
  ]

  ;; Update all people
  ask people [ update-person ]
  process-war-casualties

  ;; Weekly cycles
  if ticks mod 7 = 0 [
    process-spillover-effects
    process-emigration
  ]

  ;; Monthly VA budget update
  if ticks mod 30 = 0 [
    update-va-budget
    allocate-va-resources
  ]

  ;; Update statistics and visualization
  update-statistics
  ;update-visualization
  tick
end 

to update-person
  ;; Natural movement
  natural-movement

  ;; Update economic resources daily
  update-economic-resources

  ;; Update based on current status
  ifelse status = "civilian" [update-civilian]
  [ifelse status = "military-recruit" [update-military-recruit]
    [ifelse status = "military" [update-military]
      [ifelse status = "veteran-adapting" [update-veteran-adapting]
        [if status = "veteran" [update-veteran]
        ]
      ]
    ]
  ]

  ;; Update well-being daily
  update-well-being

  ;; Update efficiency
  update-efficiency
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MOVEMENT PROCEDURES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to natural-movement
  ;; Simplified movement: small chance each day
  if random 100 < 5 [
    ;; Civilians and veterans move toward home city
    ifelse (status = "civilian" or status = "veteran" or status = "veteran-adapting") and home-city != nobody [
      let distance-to-home distance home-city
      ifelse distance-to-home > 8 [
        face home-city
        forward 0.5 + random-float 1
      ] [
        rt random 90 - 45
        forward random-float 1
      ]
    ] [
      ;; Military stay near base
      if (status = "military-recruit" or status = "military") and current-city != nobody [
        let distance-to-base distance current-city
        ifelse distance-to-base > 5 [
          face current-city
          forward 0.5 + random-float 1
        ] [
          rt random 90 - 45
          forward random-float 0.5
        ]
      ]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; STATUS UPDATE PROCEDURES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to update-civilian
  ;; Calculate current military numbers and target
  let current-military count people with [status = "military" or status = "military-recruit"]
  ;; let current-total count people
  ;; let dynamic-target round (current-total * target-army-size / 100)
  let dynamic-target round (initial-population * target-army-size / 100)

  ;; Only recruit if we're below target
  if current-military < dynamic-target and age >= 18 and age <= 60 [

    ;; Calculate shortage factor
    let shortage (dynamic-target - current-military)
    let shortage-factor min list 2.0 (1.0 + (shortage / dynamic-target))

    ;; Adjust recruitment rates based on shortage
    let adjusted-conscription-rate conscription-rate * shortage-factor
    let adjusted-volunteer-rate volunteer-rate * shortage-factor

    ;; Conscription during wartime
    ifelse war-intensity > 0.3 and random-float 1 < (adjusted-conscription-rate * (1 + war-intensity * 0.3))
    [
      ;; EVASION MECHANISM: Higher service-attitude = less likely to evade
      if random-float 1 < service-attitude
      [
        transition-to-status "military-recruit"
        set service-type "conscript"
      ]
    ]
    [
      ;; Voluntary enlistment (no evasion for volunteers)
      if service-attitude > 0.3 and random-float 1 < (adjusted-volunteer-rate * (1 + war-intensity * 0.2))
      [
        transition-to-status "military-recruit"
        set service-type "volunteer"
      ]
    ]
  ]

  ;; WAR INTENSITY EFFECT ON CIVILIAN EFFICIENCY
  ;; High war intensity reduces civilian efficiency due to disruption
  let war-efficiency-penalty war-intensity * 10  ;; 0-10 point penalty
  set civilian-efficiency max list 10 (civilian-efficiency - war-efficiency-penalty * 0.01)
end 

to update-military-recruit
  ;; Daily training progress
  let daily-progress 1 / 30  ;; 1 month training
  set training-progress training-progress + daily-progress

  ;; Complete training
  if training-progress >= 1.0 [
    transition-to-status "military"
    set training-progress 0
  ]
end 

to update-military
  ;; Increment service duration
  set service-duration service-duration + 1

  ;; FIXED: Military efficiency increases with service, decreases with combat
  let service-years service-duration / tick-per-year
  let experience-bonus min list 30 (service-years * 5)  ;; +5 per year, max +30
  let combat-penalty combat-exposure * 20  ;; -20 at max exposure

  ;; Update attitudes based on service
  ifelse combat-exposure > 0.5 [
    ;; High combat decreases attitudes
    set service-attitude max list 0 (service-attitude - 0.001)
    set attitude-toward-civilians max list 0 (attitude-toward-civilians - 0.002)
  ] [
    ;; Positive service increases military attitude
    set service-attitude min list 1 (service-attitude + 0.0005)
  ]

  ;; Combat exposure chance
  if war-intensity > 0.2 and random-float 1 < 0.01 [
    set combat-exposure min list 1 (combat-exposure + 0.1 + random-float 0.2)
  ]

  ;; Check for end of service
  let service-years-check service-duration / tick-per-year
  ;; Check for end of service
  let min-service-years ifelse-value war-intensity > 0.5 [service-years * 1.5] [max-service-years]  ;; Extend service during intense war
  if service-years-check >= min-service-years or (service-years-check >= 2 and service-attitude < 0.3 and war-intensity < 0.5)
  [transition-to-status "veteran-adapting"]
end 

to update-veteran-adapting
  ;; Daily adaptation progress
  let base-progress 1 / (0.5 * tick-per-year)  ;; 6-months base
  let satisfaction-factor ifelse-value satisfaction-rate > 0.7 [1.5] [ifelse-value satisfaction-rate < 0.3 [0.5] [1.0]]
  let daily-adaptation base-progress * satisfaction-factor

  set adaptation-progress adaptation-progress + daily-adaptation

  ;; Complete adaptation
  if adaptation-progress >= 1.0 [
    transition-to-status "veteran"
  ]
end 

to update-veteran
  ;; Update basic needs monthly
  if ticks mod 30 = 0 [
    calculate-basic-needs
  ]

  ;; Check for category changes quarterly
  if ticks mod 90 = 0 [
    check-veteran-category-change
  ]

  ;; Apply veteran effects
  apply-veteran-effects

  ;; Check for extremism risk
  if satisfaction-rate < 0.2 and well-being < 30 and random 1000 < 1 [
    set extremist? true
  ]

  ;; Check for recall during high war intensity
  check-veteran-recall
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; VETERAN CATEGORY MANAGEMENT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to assign-veteran-category
  ;; Initial category based on multiple factors
  let integration-chance 30
  let separation-chance 25
  let assimilation-chance 25
  let marginalized-chance 20

  ;; Adjust based on service experience
  ifelse combat-exposure > 0.5 [
    set separation-chance separation-chance + 10
    set marginalized-chance marginalized-chance + 10
  ] [
    set integration-chance integration-chance + 10
  ]

  ;; Adjust based on attitudes
  if service-attitude > 0.7 [
    set integration-chance integration-chance + 10
    set separation-chance separation-chance + 10
  ]

  if attitude-toward-civilians > 0.7 [
    set assimilation-chance assimilation-chance + 15
    set integration-chance integration-chance + 5
  ]

  ;; Normalize and assign
  let total-chance integration-chance + separation-chance + assimilation-chance + marginalized-chance
  let random-val random total-chance

  ifelse random-val < integration-chance [
    set veteran-category "integrationist"
  ] [
    ifelse random-val < (integration-chance + separation-chance) [
      set veteran-category "separationist"
    ] [
      ifelse random-val < (integration-chance + separation-chance + assimilation-chance) [
        set veteran-category "assimilationist"
      ] [
        set veteran-category "marginalized"
      ]
    ]
  ]
end 

to check-veteran-category-change
  ;; More realistic transitions
  ifelse satisfaction-rate < 0.3 [
    ;; Low satisfaction - negative transitions
    ifelse veteran-category = "integrationist" [
      if random-float 1 < 0.15 [set veteran-category "separationist"]  ;; 15% chance from integrationalist to separationist
    ]
    [
      ifelse veteran-category = "assimilationist" [
        if random-float 1 < 0.30 [set veteran-category "marginalized"] ;; 30% chance from assimilated to marginalized
      ]
      [
        if veteran-category = "separationist" [
          if random-float 1 < 0.10 [set veteran-category "marginalized"] ;; 10% chance from separated to marginalized
        ]
      ]
    ]
  ]
  [
    ;; High satisfaction (>0.8) - positive transitions require larger change
    if satisfaction-rate > 0.8 [
      ifelse veteran-category = "marginalized" [
        if random-float 1 < 1.05 [set veteran-category "assimilationist"]  ;; 15% chance from marginal to separated
      ] [
        if veteran-category = "separationist" [
          if random-float 1 < 0.08 [set veteran-category "integrationist"] ;; Only 8% chance from separated to integrated
        ]
      ]
    ]
  ]

  setup-person-appearance
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; VETERAN EFFECTS (CLARIFIED)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to apply-veteran-effects
  ;; FIXED: Clear effects by category
  ifelse veteran-category = "integrationist" [
    ;; Integrationists: Spread positive attitudes, increase both efficiencies
    ask people in-radius 5 [
      set service-attitude min list 1 (service-attitude + 0.001)
      set civilian-efficiency min list 100 (civilian-efficiency + 0.03)
      set military-efficiency min list 100 (military-efficiency + 0.02)
    ]
  ] [
    ifelse veteran-category = "separationist" [
      ;; Separationists: Increase military efficiency
      ask people in-radius 5 [
        set military-efficiency min list 100 (military-efficiency + 0.05)
      ]
    ] [
      ifelse veteran-category = "assimilationist" [
        ;; Assimilationists: Act as civilians, no special effects
        ;; But decrease military recruitment nearby
        ask people in-radius 3 with [status = "civilian"] [
          set service-attitude max list 0 (service-attitude - 0.0005)
        ]
      ] [
        ;; Marginalized: Spread negative effects
        ifelse extremist? [
          ask people in-radius 5 [
            set service-attitude max list 0 (service-attitude - 0.003)
            set civilian-efficiency max list 0 (civilian-efficiency - 0.05)
            set well-being max list 0 (well-being - 1)
          ]
        ] [
          ask people in-radius 3 [
            set service-attitude max list 0 (service-attitude - 0.001)
            set civilian-efficiency max list 0 (civilian-efficiency - 0.02)
          ]
        ]
      ]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TRANSITION PROCEDURES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to transition-to-status [new-status]
  let old-status status
  set status new-status

  ;; Handle geographic movement
  handle-movement-transition old-status new-status

  ;; Status-specific initialization
  ifelse new-status = "military-recruit" [
    set training-progress 0
    set military-efficiency 30  ;; Base training efficiency
  ] [
    ifelse new-status = "military" [
      set military-efficiency (aptitude * 50 + service-attitude * 30)
    ] [
      ifelse new-status = "veteran-adapting" [
        set adaptation-progress 0
        assign-veteran-category
        calculate-basic-needs
        set civilian-efficiency military-efficiency * 0.6
      ] [
        if new-status = "veteran" [
          set civilian-efficiency military-efficiency * 0.8
          set military-efficiency military-efficiency * 0.3
          calculate-basic-needs
        ]
      ]
    ]
  ]

  setup-person-appearance
end 

to handle-movement-transition [old-status new-status]
  ;; Moving to military - go to base
  if (new-status = "military-recruit" or new-status = "military") [
    move-to-military-base
  ]

  ;; Returning from military - go home
  if (old-status = "military" and (new-status = "veteran-adapting" or new-status = "veteran")) [
    return-to-home-city
  ]
end 

to move-to-military-base
  let military-bases community-centers with [center-type = "military-base"]
  if any? military-bases [
    set current-city min-one-of military-bases [distance myself]
    move-to current-city
    rt random 360
    forward random 3
  ]
end 

to return-to-home-city
  if home-city != nobody [
    set current-city home-city
    move-to home-city
    rt random 360
    forward random 5
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; VA BUDGET AND ALLOCATION (SIMPLIFIED BUT FUNCTIONAL)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to calculate-basic-needs
  let base-cost 2.0  ;; Daily base cost

  ;; Factors that increase needs
  let combat-factor combat-exposure * 1.0
  let health-factor (100 - well-being) / 100 * 0.6
  let economic-factor max list 0 ((50 - well-being) / 50 * 0.3)

  let needs-multiplier 1 + combat-factor + health-factor + economic-factor
  set basic-needs-cost base-cost * needs-multiplier
end 

to update-va-budget
  ;; VA budget as percentage of total civilian efficiency
  set va-total-budget (total-civilian-efficiency * (va-budget-percentage / 100)) * 0.1

  ;; Calculate total basic needs
  set total-basic-needs sum [basic-needs-cost] of people with [
    status = "veteran" or status = "veteran-adapting"
  ]

  ;; NEW: Use slider instead of fixed 60%
  set va-basic-budget (va-total-budget * (basic-needs-percentage / 100))
  set va-basic-budget min list va-basic-budget va-total-budget

  ;; Remaining for programs
  set va-program-budget va-total-budget - va-basic-budget

  ;; Calculate coverage rate
  set basic-needs-coverage ifelse-value total-basic-needs > 0 [
    va-basic-budget / total-basic-needs
  ] [1]
  set basic-needs-coverage min list 1 basic-needs-coverage
end 

to allocate-va-resources
  ;; Basic needs allocation
  allocate-basic-needs

  ;; Program allocation
  allocate-programs-by-strategy

  ;ifelse manual-allocation? [allocate-programs-manual ] [allocate-programs-by-strategy]
end 

to allocate-basic-needs
  ask people with [status = "veteran" or status = "veteran-adapting"] [
    ifelse status = "veteran-adapting" [
      set satisfaction-rate min list 1 (basic-needs-coverage * 1.5)
    ] [
      set satisfaction-rate min list 1 basic-needs-coverage
    ]
    set receiving-va-support? satisfaction-rate > 0
  ]
end 

to allocate-programs-by-strategy
  ifelse allocation-strategy = "Integrationist" [
    allocate-integrationist-focus
  ] [
    ifelse allocation-strategy = "Marginalized" [
      allocate-marginalized-focus
    ] [
      ifelse allocation-strategy = "Assimilationist" [
        allocate-assimilationist-focus
      ] [
        allocate-separationist-focus
      ]
    ]
  ]
end 

to allocate-integrationist-focus
  ;; A) Integrationists → Efficiency Maximization
  let eligible-veterans people with [status = "veteran" and veteran-category = "integrationist"]

  ifelse any? eligible-veterans and va-program-budget > 0 [
    let budget-per-veteran va-program-budget / count eligible-veterans

    ask eligible-veterans [
      ;; Focus on civilian efficiency and positive influence
      let efficiency-boost budget-per-veteran * 0.7 * dollar-to-civilian-efficiency
      let influence-boost budget-per-veteran * 0.2 * dollar-to-positive-influence
      let satisfaction-boost budget-per-veteran * 0.1 * dollar-to-satisfaction

      set civilian-efficiency min list 100 (civilian-efficiency + efficiency-boost)
      set positive-influence min list 1 (positive-influence + influence-boost)
      set satisfaction-rate min list 1 (satisfaction-rate + satisfaction-boost)
    ]
  ] [
    ;; No budget or no eligible veterans - no effects
  ]
end 

to allocate-assimilationist-focus
  ;; B) Assimilationists → Military Readiness Restoration
  let eligible-veterans people with [status = "veteran" and veteran-category = "assimilationist"]

  ifelse any? eligible-veterans and va-program-budget > 0 [
    let budget-per-veteran va-program-budget / count eligible-veterans

    ask eligible-veterans [
      ;; Focus on service attitude and military efficiency
      let attitude-boost budget-per-veteran * 0.5 * dollar-to-service-attitude
      let mil-efficiency-boost budget-per-veteran * 0.3 * dollar-to-military-efficiency
      let satisfaction-boost budget-per-veteran * 0.2 * dollar-to-satisfaction

      set service-attitude min list 1 (service-attitude + attitude-boost)
      set military-efficiency min list 100 (military-efficiency + mil-efficiency-boost)
      set satisfaction-rate min list 1 (satisfaction-rate + satisfaction-boost)
    ]
  ] [
    ;; No budget or no eligible veterans - no effects
  ]
end 

to allocate-marginalized-focus
  ;; C) Marginalized → Crisis Intervention
  let eligible-veterans people with [status = "veteran" and veteran-category = "marginalized"]

  ifelse any? eligible-veterans and va-program-budget > 0 [
    let budget-per-veteran va-program-budget / count eligible-veterans

    ask eligible-veterans [
      ;; Focus on satisfaction and well-being
      let satisfaction-boost budget-per-veteran * 0.6 * dollar-to-satisfaction
      let wellbeing-boost budget-per-veteran * 0.4 * dollar-to-wellbeing

      set satisfaction-rate min list 1 (satisfaction-rate + satisfaction-boost)
      set well-being min list 100 (well-being + wellbeing-boost)

      ;; Extremism prevention - higher budget = higher chance
      if extremist? and random-float 1 < (budget-per-veteran * 0.001) [
        set extremist? false
      ]
    ]
  ] [
    ;; No budget or no eligible veterans - no effects
  ]
end 

to allocate-separationist-focus
  ;; D) Separationists → Civilian Bridge Programs
  let eligible-veterans people with [status = "veteran" and veteran-category = "separationist"]

  ifelse any? eligible-veterans and va-program-budget > 0 [
    let budget-per-veteran va-program-budget / count eligible-veterans

    ask eligible-veterans [
      ;; Focus on civilian efficiency and civilian attitudes
      let civ-efficiency-boost budget-per-veteran * 0.5 * dollar-to-civilian-efficiency
      let civ-attitude-boost budget-per-veteran * 0.3 * dollar-to-attitude-civilians
      let satisfaction-boost budget-per-veteran * 0.2 * dollar-to-satisfaction

      set civilian-efficiency min list 100 (civilian-efficiency + civ-efficiency-boost)
      set attitude-toward-civilians min list 1 (attitude-toward-civilians + civ-attitude-boost)
      set satisfaction-rate min list 1 (satisfaction-rate + satisfaction-boost)
    ]
  ] [
    ;; No budget or no eligible veterans - no effects
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; VETERAN RECALL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to check-veteran-recall
  if not (status = "veteran" or status = "veteran-adapting") [stop]

  ;; Only recall veterans if military still needs personnel
  let current-military count people with [status = "military" or status = "military-recruit"]
  let dynamic-target round (initial-population * target-army-size / 100)
  if current-military >= dynamic-target [stop]  ;; No shortage, no recall needed

  ;; Simple recall probability based on war intensity, health, and service attitude
  let health-factor (well-being + 1) / 100  ;; 0-1 scale
  let shortage-factor (dynamic-target - current-military) / dynamic-target

  let recall-probability war-intensity * health-factor * service-attitude * shortage-factor  ;; Much higher base rate

  ;; Additional category-based willingness
  let category-multiplier (ifelse-value
    veteran-category = "separationist"   [2.0]
    veteran-category = "integrationist"  [1.5]
    veteran-category = "assimilationist" [0.3]
    [0.1] ;; marginalized
  )

  let emergency-multiplier ifelse-value shortage-factor > 0.5 [4][1]

  set recall-probability recall-probability * category-multiplier * emergency-multiplier

  if random-float 1 < recall-probability [
    set service-type "recalled"
    set service-duration 0  ;; RESET service duration for new tour
    transition-to-status "military"
    set combat-exposure min list 1 (combat-exposure + 0.1)
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CASUALTIES AND EMIGRATION
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to process-war-casualties
  ;; Military casualties
  ask people with [status = "military"]
  [
    let casualty-risk calculate-military-casualty-risk

    if random-float 1 < casualty-risk
    [
      ;; Higher efficiency = more likely to survive as wounded rather than die
      ifelse random-float 1 < (military-efficiency / 100)
      [
        ;; Wounded
        set military-wounded military-wounded + 1
        set well-being max list 10 (well-being - 30)
        set combat-exposure min list 1 (combat-exposure + 0.3)
        transition-to-status "veteran-adapting"
      ]
      [
        ;; Killed
        set military-deaths military-deaths + 1
        die
      ]
    ]
  ]

  ;; Civilian casualties
  ask people with [status = "civilian"] [
    let casualty-risk calculate-civilian-casualty-risk
    ifelse random-float 1 < casualty-risk [
      set civilian-deaths civilian-deaths + 1
      die
    ] [
      if random-float 1 < (casualty-risk * 2) [
        set civilian-wounded civilian-wounded + 1
        set well-being max list 20 (well-being - 20)
      ]
    ]
  ]

  ;; Veteran casualties (lower risk)
  ask people with [status = "veteran"] [
    let casualty-risk calculate-civilian-casualty-risk * 0.5
    if random-float 1 < casualty-risk [
      set veteran-deaths veteran-deaths + 1
      die
    ]
  ]
end 

to-report calculate-military-casualty-risk
  let base-risk war-intensity * 0.008
  let combat-factor combat-exposure * 0.020
  let service-factor service-duration / (5 * tick-per-year) * 0.0005
  let efficiency-reduction military-efficiency / 100 * 0.005
  report max list 0.0001 (base-risk + combat-factor + service-factor - efficiency-reduction)
end 

to-report calculate-civilian-casualty-risk
  let base-risk war-intensity * 0.0008
  let age-factor ifelse-value (age < 18 or age > 65) [0.0001] [0]
  let health-factor (100 - well-being) / 100 * 0.0001
  report base-risk + age-factor + health-factor
end 

to process-emigration
  ;; FIXED: New emigration based on unhappiness AND resources
  ;; Veterans emigrate if unhappy AND have enough money
  ask people with [status = "veteran"] [
    let emigration-risk calculate-veteran-emigration-risk
    let can-afford-emigration economic-resources > 3000  ;; Need resources

    if random-float 1 < emigration-risk and can-afford-emigration [
      set veteran-migrants veteran-migrants + 1
      die
    ]
  ]

  ;; Civilians emigrate similarly
  ask people with [status = "civilian"] [
    let emigration-risk calculate-civilian-emigration-risk
    let can-afford-emigration economic-resources > 2000  ;; Lower threshold

    if random-float 1 < emigration-risk and can-afford-emigration [
      set civilian-migrants civilian-migrants + 1
      die
    ]
  ]
end 

to-report calculate-veteran-emigration-risk
  ;; Base risk when unhappy
  let base-risk 0.0004

  ;; Satisfaction is main factor
  let satisfaction-factor (1 - satisfaction-rate) * 0.002

  ;; Category factors
  let category-factor 0
  ifelse veteran-category = "marginalized" [
    set category-factor 0.01
  ] [
    ifelse veteran-category = "assimilationist" [
      set category-factor 0.001
    ] [
      ifelse veteran-category = "separationist" [
        set category-factor 0.0002
      ] [
        set category-factor 0.0001
      ]
    ]
  ]

  ;; Other factors
  let trauma-factor combat-exposure * 0.0002
  let well-being-factor (100 - well-being) / 100 * 0.0003
  let war-factor war-intensity * 0.0002

  report base-risk + satisfaction-factor + category-factor + trauma-factor + well-being-factor + war-factor
end 

to-report calculate-civilian-emigration-risk
  let base-risk 0.001

  ;; War intensity is main driver
  let war-factor war-intensity * 0.005
  ;; Personal factors
  let well-being-factor (100 - well-being) / 100 * 0.0002
  let service-factor (1 - service-attitude) * 0.0002

  report base-risk + war-factor + well-being-factor + service-factor
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; EFFICIENCY AND WELL-BEING
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to update-well-being
  ;; Daily well-being changes
  let daily-change 0

  ;; Base factors
  ifelse status = "military" and combat-exposure > 0.5 [
    set daily-change daily-change - 0.03
  ] [
    if status = "veteran" or status = "veteran-adapting" [
      set daily-change daily-change + (satisfaction-rate - 0.5) * 0.01
    ]
  ]

  ;; Update well-being
  set well-being max list 0 min list 100 (well-being + daily-change)
end 

to update-efficiency
  ;; 1. Apply time-based decay first
  apply-efficiency-decay

  ;; 2. Then apply role-based adjustments
  apply-role-efficiency

  ;; 3. Finally apply well-being modifier
  let wellbeing-factor (0.5 + well-being / 200)
  set civilian-efficiency civilian-efficiency * wellbeing-factor
  set military-efficiency military-efficiency * wellbeing-factor

  ;; Keep within bounds
  set civilian-efficiency max list 1 (min list 100 civilian-efficiency)
  set military-efficiency max list 1 (min list 100 military-efficiency)
end 

to apply-efficiency-decay
  ;; Everyone loses skills they're not using
  ifelse status = "military" or status = "military-recruit" [
    ;; Military: lose civilian skills slowly
    set civilian-efficiency civilian-efficiency * 0.9995
  ] [
    ;; Civilians/Veterans: lose military skills
    set military-efficiency military-efficiency * 0.999
  ]
end 

to apply-role-efficiency
  ;; Boost the skills you're actively using
  ifelse status = "civilian" [
    set civilian-efficiency min list 100 (civilian-efficiency + 0.1)
  ] [
    ifelse status = "military" [
      set military-efficiency min list 100 (military-efficiency + 0.2)
    ] [
      if status = "veteran" [
        ;; Veterans slowly recover civilian skills
        set civilian-efficiency min list 100 (civilian-efficiency + 0.05)
      ]
    ]
  ]
end 

to update-economic-resources
  ;; NEW: Update economic resources based on efficiency
  ifelse status = "civilian" or status = "veteran" [
    ;; Earn based on civilian efficiency
    set economic-resources economic-resources + (civilian-efficiency * 0.1)
  ] [
    if status = "military" [
      ;; Military salary
      set economic-resources economic-resources + 5
    ]
  ]

  ;; Living costs
  set economic-resources economic-resources - 2

  ;; Veterans pay for unmet needs
  if status = "veteran" and satisfaction-rate < 1 [
    set economic-resources economic-resources - (basic-needs-cost * (1 - satisfaction-rate))
  ]

  ;; Can't go below zero
  set economic-resources max list 0 economic-resources
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SPILLOVER EFFECTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to process-spillover-effects
  ;; Calculate influence for everyone
  ask people [
    calculate-influence-strength
  ]

  ;; Apply spillover effects
  ask people [
    apply-spillover-effects
    set last-spillover-update ticks
  ]
end 

to calculate-influence-strength
  ;; Reset influence
  set positive-influence 0
  set negative-influence 0
  set influence-radius 5

  ;; Calculate based on status and category
  let total-efficiency civilian-efficiency + military-efficiency

  ifelse status = "veteran" [
    ifelse veteran-category = "integrationist" [
      set positive-influence total-efficiency / 100 * 0.8
      set influence-radius 7
    ] [
      ifelse veteran-category = "marginalized" or extremist? [
        set negative-influence total-efficiency / 100 * 0.9
        set influence-radius 6
      ] [
        ifelse veteran-category = "separationist" [
          set positive-influence total-efficiency / 100 * 0.4
          set influence-radius 5
        ] [
          ;; Assimilationist
          set positive-influence total-efficiency / 100 * 0.2
          set influence-radius 3
        ]
      ]
    ]
  ] [
    ;; Non-veterans have less influence
    if total-efficiency > 80 [
      set positive-influence total-efficiency / 100 * 0.3
    ]
  ]
end 

to apply-spillover-effects
  ;; Skip if updated recently
  if ticks - last-spillover-update < 7 [stop]

  ;; Get nearby people
  let nearby-people other people in-radius influence-radius

  if any? nearby-people [
    ask nearby-people [
      ;; Calculate net influence received
      let positive-change sum [positive-influence / (distance myself + 1)] of
      other people in-radius influence-radius with [positive-influence > 0]
      let negative-change sum [negative-influence / (distance myself + 1)] of
      other people in-radius influence-radius with [negative-influence > 0]

      ;; Apply influence effects
      if positive-change > negative-change [
        set service-attitude min list 1 (service-attitude + positive-change * 0.001)
        set well-being min list 100 (well-being + positive-change * 0.5)
      ]

      if negative-change > positive-change [
        set service-attitude max list 0 (service-attitude - negative-change * 0.001)
        set well-being max list 0 (well-being - negative-change * 0.5)
      ]

      ;; Extremism risk from high negative influence
      if status = "veteran" [
        if negative-change > 0.3 and well-being < 30 and satisfaction-rate < 0.2 [
          if random-float 1 < (negative-change * 0.1) [
            set extremist? true
          ]
        ]
      ]

      ;; Positive influence can help marginalized veterans
      if status = "veteran" and veteran-category = "marginalized" [
        if positive-change > 0.2 and random-float 1 < (positive-change * 0.2) [
          set veteran-category "separationist"
        ]
      ]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; STATISTICS AND VISUALIZATION
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to update-statistics
  ;; Count by status
  set civilian-count count people with [status = "civilian"]
  set military-recruit-count count people with [status = "military-recruit"]
  set military-count count people with [status = "military"]
  set veteran-adapting-count count people with [status = "veteran-adapting"]
  set veteran-count count people with [status = "veteran"]

  ;; Count by veteran category
  set integrationist-count count people with [veteran-category = "integrationist"]
  set separationist-count count people with [veteran-category = "separationist"]
  set assimilationist-count count people with [veteran-category = "assimilationist"]
  set marginalized-count count people with [veteran-category = "marginalized"]

  ;; Calculate total efficiency
  set total-civilian-efficiency sum [civilian-efficiency] of people with [status = "civilian" or status = "veteran-adapting" or status = "veteran"]
  set total-military-efficiency sum [military-efficiency] of people with [status = "military" or status = "military-recruit"]
end 

There is only one version of this model, created 4 days ago by Artem Serdyuk.

Attached files

File Type Description Last updated
Veterans Reculturation.png preview Preview for 'Veterans Reculturation' 4 days ago, by Artem Serdyuk Download

This model does not have any ancestors.

This model does not have any descendants.