As seething motorists and impatient pedestrians have long suspected, Washington's traffic lights are frequently on the blink.

So the city is going to spend $25 million over the next five years to transform its aging signals into a computer-controlled network of lights that can be programmed to ease rush-hour congestion and improve traffic flow.

The District is expected to sign a formal contract shortly with Dynalectric, a subsidiary of the McLean-based Dynalectron Corp.; Network Technical Services, a D.C. company, and Computran Systems Corp. of New Jersey for the new system, which will be one of the most technologically advanced and the most expensive in North America. It marks a diversification effort for the two local companies and an opportunity for the city to take advantage of the latest technology to unsnarl its traffic problems.

"The project is a citywide effort to connect the 1,300 signalized intersections that are located throughout the Washington metropolitan area into an integrated, centrally supervised, digitally controlled computer system," says H. Nathan Yagoda, president of Computran Systems Corp., the company that will be providing the computer expertise.

What American Telegraph & Telephone Co. does for phones, the proposed system here would do for traffic lights. The new system would link the city's traffic signals in a giant computer network that could monitor each signal and program it to display red or green depending on the intensity of traffic.

By the end of the decade, every signal intersection will be equipped with a powerful computer chip to control the lights. Three hundred miles of cable will link the traffic lights to a central cluster of seven large computers that monitor the signals, allowing traffic engineers to change the timing sequences.

Traffic control experts estimate the system could cut travel times by as much as 25 percent along some routes, as well as account for $4 million in fuel savings by minimizing the number of automobile starts and stops.

The system will help maximize the effectiveness of "green time" to reduce congestion on the busiest streets, says Computran's Yagoda. "There are 16 ounces in a pound -- not 17 -- but you can divide it up more effectively. That's what this system will do for Washington."

The District now relies on a 30-year-old system from Motorola that is teetering on the edge of collapse. The signals, which can be radio-controlled, rely on electromechanical timers, much like egg timers, that constantly fall into disrepair -- to the dismay of the city's traffic controllers and the outrage of its roughly 600,000 daily commuters. What's more, there's no technical way to monitor whether the lights are working or not.

"It's obsolete," says Marshall Jacks, the associate administrator for safety, traffic engineering and motor carriers at the Federal Highway Administration. "More than that, it's worn out. It's like a Model-T Ford that's gone to pot. The system just isn't functioning as it should."

"At any given time, 20 percent of the lights don't do what we want them to do," says George Schoene, who runs the District's traffic control operations. "For example, they'll continue to flash instead of going back on color." Some observers put the actual number even higher.

Regardless of the number, the planned system may be the city's most cost-effective hope to manage its rush hours and the increasing flow of traffic. It also underscores just how difficult it is to create a system that effectively serves the city's needs without infuriating its citizens.

In effect, says Computran's Yagoda, doing a better job of controlling the signals that regulate traffic can have as much of an impact on city travel as building a new road. Under appropriate computer control and mathematical equations, traffic lights can become an information highway speeding the traffic on real highways. That's why traffic jams are Computran's bread and butter. Since 1969, the privately held Hackensack, N.J., firm has built a multimillion-dollar business applying the fruits of computer technology to traffic lights.

Bringing traffic lights into the information age is not a trivial exercise. Urban traffic, with its elaborate ecology of main roads, side streets, cars, buses and pedestrians, is an enormously complex systems problem. Everything interacts; everything is interdependent. A traffic light doesn't just control an intersection; it's also part of a system -- one pedestrian's green is a motorist's red.

What's more, this ecology of traffic is very delicate. When the District's Schoene says that 20 percent of the city's traffic signals aren't working in synch, the problem is actually far worse. Because they're part of a system, one poorly timed light in a signal sequence produces a ripple effect that can ensnarl a well-mannered flow of traffic. A traffic signal irregularity at 14th and Constitution or 14th and Pennsylvania -- critical District intersections -- can create gridlock throughout downtown.

The real trick, says Yagoda, a noted traffic expert who has authored such traffic control classics as "A Discrete Markov Renewal Model of a Gap-Acceptance Entrance Ramp Controller for Expressways" and "Effects of Vertical Geometry on Vehicular Stream Dynamics," is to figure out how to fix the traffic lights in a way that maximizes the green time for the greatest number of people while assuring that the frequency and duration of the red lights is endurable.

At the same time, the traffic engineers have to keep other vital statistics in mind. When designing a crosswalk, for example, traffic engineers are supposed to assume that a healthy pedestrian can walk at four feet per second. So even if there are no pedestrians, a car at a red light will have to wait at least half a minute if the intersection is 120 feet wide.

"It's like a constrained optimization program in linear programming," Yagoda explains. "What you want to do is optimize an objective function -- in this case, you want to minimize the number of stops and delays within the constraints -- like you can't trap someone on a side street for too long; you can't have a progression time above the speed limit; you allow for pedestrian crossing times; an amber-light time that allows people to slow down, etc."

In other words, traffic control is the mathematical art of compromise. Reds and greens have to be balanced against pedestrians and machines. But it takes high-powered computers and sophisticated software to assure that those compromises can be modeled, calculated and then successfully implemented in the real world of traffic.

"If you didn't have computers doing the calculations, figuring all this out would be impossible," says Robert Kelly, a traffic planner with New York's Port Authority.

Using signals to optimize traffic flow is particularly tough in Washington, a city whose layout can best be described as irregular. When Pierre L'Enfant designed a series of large circles into the city's roadways in 1791 to house artillery, he assured that future generations of Washingtonians would have to endure excruciatingly time-consuming confrontations with traffic lights.

"With a Dupont Circle, we have no flexibility with the lights at all," says the District's Schoene. "There's just too much going on."

"There will be special logic built into the controllers to handle the lights at the circles ," says Jack L. Kay, a consultant who supervised the feasibility study for the new system. "The geometry really does screw up traffic flow."

The real flexibility of the new system, says Schoene, will be seen in the variety of new traffic signal patterns the new technology allows. Schoene says the city has amassed considerable data about how traffic moves in various parts of the District. The problem is, the existing system isn't sophisticated enough to allow traffic engineers to apply that knowledge. The new system could calibrate traffic lights in a sequence down to the precise second and make the difference between a steady flow of traffic and the fits and starts familiar to most of Washington's motorists today.

Similarly, the new system would allow the District's traffic engineers to customize traffic patterns to meet special situations. During the times just before and after school, for example, traffic lights by neighborhood schools can be programmed to favor the pedestrians -- presumably young children -- over the automobiles.

Similarly, as traffic patterns change, the timing sequences and patterns at key intersections can be modified to assure that the signals can accommodate the change without creating unnecessary congestion.

Washington is not the only major city about to try out computerized traffic control. New York Deputy Commissioner Stephen Schwartz says that this year Manhattan will begin networking its street lights.

"Depending on the direction and time of day, it will reduce time of travel anywhere from 20 percent to 50 percent," says Schwartz. "I'd say that it can accomplish for a city what a highway costing 10 times that much can do."

Although Washington's traffic signal system is one of the oldest, it never had one crucial flaw that created massive problems for New York. Figuring that they would be one-third cheaper, New York bought street lights that had only red and green signals. Both the red and green lights on simultaneously meant "caution." During the two-light era, New York had the highest pedestrian fatality rate in the nation.