Multiagent System With Periodic and Event-Triggered Communications for Solving Distributed Resource Allocation Problem