I sometimes talk to professional planners. One recently said to me that affordable housing was a tough nut to crack. This part of where I get the idea that most people have no idea how to solve it.
As I have the time and energy, I'm trying to do my own research. I still hope to find viable answers.
As a thought experiment, how many more people could live in San Francisco city limits if you added three stories to the current limit (which is three I believe). You double the available supply, reduce / address demand and increase the opportunity for transit usage. However, if you proposed this idea, you do not have to worry about re election.
The politicians will say it is difficult, then use public funds to add 1,000 affordable homes, which is a drop in the bucket to addressing the supply issue. Do note, that when the affordable housing allotted to the skyscraper in New York City, the affordable housing facilities were given out by the city and conveniently, if I recall, a city counselor's relative got one of the homes.