Thank you for the reply Uwe
I am trying to model a scheduling process that is made up of multiple actors Agent
. Basically there are three kinds of Agent
s that are able to make decisions that influence what is actually scheduled, each optimizing a different part of the scheduling process (Each agent is optimizing a known problem, multi-dimension multi-knapsack problem (scheduler), resource-constrained project scheduling problem (work planner) and a variant of the flexible job shop (worker)). Each type of Agent
has a mutable struct that holds its state (simplified here):
mutable struct SchedulerAgent <: Agent
backlog::Vector{WorkOrder}
scheduled_work_orders::Vector{WorkOrder}
periods::Vector{Period}
inbox::Channel{SchedulerMessage}
end
mutable struct WorkerAgent <: Agent
id::Int
skill::Symbol
availability::Vector{Availability}
assigned::Vector{WorkOrder}
inbox::Channel{Message}
end
mutable struct WorkPlannerAgent <: Agent
orders::Vector{WorkOrder}
inbox::Channel{Message}
end
The Channel{Message}
allow the agents to send messges to each other where the messages are subtypes of abstract type Message end
Each of these agent the run an asynchronous function on their state like so:
for sa in scheduler_agents # Vector{SchedulerAgent}
@async scheduler_internal!(sa::SchedulerAgent, message_channel::Channel{Message})
end
for wp in work_planner_agents # Vector{WorkPlannerAgent}
@async work_planner_internal!(wpa::WorkPlannerAgent, message_channel::Channel{Message})
end
for worker in workers # Vector{Worker}
@async worker_internal!(wa::WorkerAgent, message_channel::Channel{Message})
end
The different agent operate on different time lines as shown below. The SchedulerAgent
aggregates jobs into two week periods, optimizing priority against supply chain, aggregated capacity. The WorkPlannerAgent
schedules all activities that make up the scheduled jobs coming from the SchedulerAgent
and provides specific start and finish times (For the next six weeks). The WorkerAgent
takes the activities scheduled by the WorkPlannerAgent
and allocates them to specific workers in the current two week period.
The idea is that there should run in real-time with user-inputs into the Agent
s with 1 SchedulerAgent
, 1 WorkPlannerAgent
, and up to 50 WorkerAgent
s.
I have coded a lot in Julia and somehow Julia does not feel completely right for this. I am far from having implemented all of this with only the SchedulerAgent
are currently running with the implemented message system, and the WorkPlannerAgent
is so far only running in isolation.
Cycle times are becoming increasingly bothersome (mostly fixing bugs that a static type checker would catch) and I am a little worried about this kind of concurrency in Julia. Julia seems for geared for a different kind of concurrency, focused more handling large number of computations, but I do not have enough experience to tell it that matters in any practical sense.
But again, Julia may be a good option. I lack the experience to tell for myself.
Using RemoteChannel together with something like ClusterManagers and Network-Topology may allow for a good setup. (See links below to Distributed.jl)
https://docs.julialang.org/en/v1/manual/distributed-computing/#ClusterManagers
https://docs.julialang.org/en/v1/manual/distributed-computing/#Specifying-Network-Topology-(Experimental)