A large retail chain had a problem. It sold three similar power drills: one for about $90, a purportedly better one at $120 and a top-tier one at $130. The higher the price, the more the store profited. But while drill know-it-alls flocked to the $130 model and price-fretters grabbed its $90 cousin, shoppers often ignored the middle one. So the store sought advice from a new breed of "price-optimization" software from DemandTec Inc. What followed offers us a clue about important shifts that technology is bringing to retail shopping.

After analyzing an array of variables, including sales history and competitors' prices, the software suggested cutting the middle drill to $110.

That might have made the top drill seem more expensive. But drill aficionados still were fine shelling out $130. Sales of that drill didn't change. However, now that the $90 version seemed less of a bargain, the store sold 4 percent fewer low-end drills -- and 11 percent more of the mid-range model. Profits rose.

Because of insights like this, price-optimization software is often credited with boosting retail profits by a few percentage points -- a huge leap in an industry that lives on margins slimmer than a 25-cent pack of gum.

Even so, the software is just beginning to make its mark. Although major software providers such as SAP AG and Oracle Corp. have joined the market, analysts estimate no more than 150 retailers worldwide are using it -- including such big names as Wal-Mart Stores Inc. and 7-Eleven Inc. The CEO of Albertson's grocery stores told analysts in 2005 that the chain was reaping "big dividends" after pricing software advised charging less for such items as paper towels, toilet paper, ketchup and soup.

For now the software is enough of a competitive advantage that chains are reluctant to publicize their experiences. Still, it's clear that price-setting software and similar, more-established technologies such as markdown optimization figure to make stores more efficient and savvy at promoting precisely what consumers want. Or at least what we think we want.

It won't always lead to cheaper power drills. As often as not, the software gives store managers support for raising prices. "It's really about that intelligent trade-off of where you're going to take higher margins versus where you're going to take lower margins," says AMR Research analyst Janet Suleski.

Similarly, markdown optimization software, often used by clothing retailers to determine what to put on sale and at what discount, also is a mixed bag. Bob Buchanan, an analyst at AG Edwards & Sons, says the software tends to recommend putting things on sale sooner, in hopes of moving product faster.

Great -- who doesn't love a sale? But earlier markdowns tend to mean shallower discounts -- 20 percent off instead of 40 percent, for example. If that advice is right, stores will have fewer mega-clearances that delight bargain hunters.

Sometimes it means no discount at all. Recently, ALDO Group Inc., a Canadian shoe company with stores worldwide, began selling two kinds of sneakers it wanted off shelves by the end of June. One pair was $29, the other $49.

According to Bob Raven, ALDO's vice president of finance, the $29 version was a smash and figures to sell out by May. The $49 pairs seemed to be doing so-so. So a merchandise manager, following his instinct, prepared to cut the price, perhaps all the way to $29. Until the company cranked up its new markdown-optimization system from Oracle.

The verdict: Keep the shoes at $49. The software showed that based on current and historic sales figures, the shoes would still sell out by June. "You start to see a lot of stuff you didn't see before," Raven says.

It might seem odd that stores need help figuring out what to charge. Aren't we consumers the ones with no clue about what things should cost? How else could people guessing on "The Price is Right" survive on TV all these years, leggy models notwithstanding?

The truth is that for all the sophistication of the retail industry, prices often have been set with a simple formula: the cost to the retailer plus a set markup to ensure a profit. Sometimes there's even less math. Retailers often match a competitor's price or replicate what they charged last year.

The problem with marking all items up by roughly similar percentages is that some products are more "price sensitive" than others. For many everyday items, like milk, stores can't get away with a high markup. On specialty products, however, the stores might be leaving money on the table by charging only their set markup. They probably could demand more.

In fairness, retailers long have been hip to this. Hence the common concept of a "loss leader" -- a routine item like soda is sold at cost or a slight loss, to entice people into a store and establish a bargain reputation. The store hopes to more than make up the difference on other products.

But much of that has been trial and error. Enter price-optimization software, and computers' ability to calculate inhuman degrees of variables.

Packed with years of data from stores and their competitors, the software predicts how much of something will sell at given prices. And it hunts for items that correlate with each other. So a store can ask many questions at once: If we lower the price of Coke, how much more Coke will we sell? How many fewer store-brand sodas will we sell? And what do soda buyers also tend to purchase that we could bump up by a few cents? Chips? Beer? Shoe polish?

The software can factor in multiple elements, such as whether a store has a cheap or premium "price image"; the proximity of the nearest rival (often known as Wal-Mart); seasonal factors (sleds sell better in January than July); or whether an item is featured on coupons.

The results can be surprising. For example, store brands of cereal and pasta commonly are priced about 20 percent less than national brands, according to Praveen Kopalle, a professor in Dartmouth College's Tuck School of Business. Price optimization, Kopalle says, has shown that discount is smart for breakfast cereals -- consumers shun generics if the price goes much higher. But it's unnecessarily steep for pasta. People will buy knockoff pasta even if the discount is less than 20 percent.

This technology began to emerge about a decade ago, but stores were skeptical it could work because "it sounded like 'Star Wars,'" says Ken Ouimet, a pioneer in the field who founded price-optimization provider Khimetrics with his brother, Tim. Khimetrics was acquired last year by SAP.

Khimetrics arose from an unusual linkage. The Ouimets were reared in retail -- their parents run a firm that sells price data to stores, wholesalers and manufacturers. But Ken went on to study theoretical physics and chemical engineering. In the early 1990s, while examining equations that predict the behavior of billions of atoms in gases or other complex systems, Ouimet realized that the buying decisions of consumers could be plotted in much the same way.

In other words, we think we have free will when we walk into a store and decide whether to purchase something. But en masse, we have very predictable responses to the prices we encounter. "It's really amazing to look at that," Ouimet says.

Other price-optimization vendors have similar roots in the scientific study of probability, which is why the technology works on more than just physical retail goods. SAP, for example, wants to expand price-optimization to help banks sell certificates of deposits.

Another vendor, Zilliant Inc., sets the science loose on helping manufacturing and services companies negotiate contracts with clients. Zilliant's vice president of marketing, Eric Hills, says its software recommends raising prices about 80 percent of the time. Those increases are small -- generally around 1 to 3 percent -- but they can improve profits by at least $10 million a year, Hills says.

Considering that pricing software can cost seven figures, what's going to come of all the money being spent on figuring out how to get us to spend our money?

For one thing, expect stores of the future to adopt a trick from the airline industry: variable pricing. More often than happens now, goods will be priced higher in certain neighborhoods and lower in others. That's because price-optimization software gives fine-grained views of how demographic and regional factors influence demand.

Also, as companies uncover products that tend to be bought together -- buyers of some expensive wine, let's say, grab a certain kind of cheese -- expect retailers to be sharper about promotions. Instead of deals in which "anyone who walks in the door gets a buck off mayonnaise," says DemandTec CEO Dan Fishback, a store can focus on promoting the items it knows its best customers buy.

Here's the thing about these "optimized" discounts: Consumer psychology is such that we're likely to notice price decreases more than their countervailing price increases. We're hard-wired to love sales. "When we see a good deal, a different part of the brain lights up than with a loss," Kopalle says.

Which means one piece of advice should remain timeless: Buyer beware.