The distributed constrained optimization problem over an undirected communication topology is investigated in this study. It focuses on addressing a global coupled equality constraint that applies to all agents. To tackle this problem, a distributed approach with arbitrary initialization is developed by virtue of the aperiodic sampling control idea and the consensus-based multi-agent system(MAS) technology. This approach is developed to address constrained optimization problems within a pre-specified time. In addition, this predefined time is freely defined by users and irrelevant to the initial states, control coefficients, and network structure of systems. The Lyapunov stability theory completes the convergence proof of the developed method. Then, the developed method is extended to handle distributed nonlinear constrained optimization problems. Finally, The availability of two developed methods is demonstrated through two simulation examples.