Our Creator, The Almighty Allah has given us the solution, If we are really seeking the solution,
In chapter 24 Verse 30, Almighty addresses men and ask them to lower their gaze.
24:30 "Say to the believing men that they should lower their gaze and guard their modesty: that will make for greater purity for them: And Allah is well acquainted with all that they do."
Allah continues with following orders for believing women,
24:31 And say to the believing women that they should lower their gaze and guard their modesty; that they should not display their beauty and ornaments except what (must ordinarily) appear thereof; that they should draw their veils over their bosoms and not display their beauty except to their husbands, their fathers, their husband's fathers, their sons, their husbands' sons, their brothers or their brothers' sons, or their sisters' sons, or their women, or the slaves whom their right hands possess, or male servants free of physical needs, or small children who have no sense of the shame of sex; and that they should not strike their feet in order to draw attention to their hidden ornaments. And O ye Believers! turn ye all together towards Allah, that ye may attain Bliss."
Also,
33:59 "O Prophet! Tell thy wives and daughters, and the believing women, that they should cast their outer garments over their persons (when abroad): that is most convenient, that they should be known (as such) and not molested. And Allah is Oft-Forgiving, Most Merciful" (Surah 33 Verse 59).
Now imagine a society who follows the above, there would be no chance for males getting attracted out of wed to women. But if still some one does commit the crime, Islam gives the highest punishment.
100 lashes for the rapist (if he is not married)
and stoning to death if he is married and still rapes.

if any of you think this is brutal punishment,
Ask a rape victim or family of the victim.

The solution starts with 1st layer. Prevention for males, 2nd layer. Prevention for females 3. Sever punishment for offenders.

The solution for society is given by Almighty, any takers?