I haven’t read the journals of Ayn Rand, but from trusted sources who have read them – i.e. Dr. Peikoff and other Objectivists who have read them and have commented on them – the affair with Branden was Ayn Rand’s attempt to experience sex with someone who in her estimation was her intellectual equal. Basically, Frank had the spirit but not the mind, whereas she thought that Branden had the mind and the spirit. In other words, Miss Rand thought that Branden really understood Objectivism, and she wanted to know what it would be like to have sex with a confirmed and dedicated Objectivists. It was a purely selfish motivation – in Objectivist ideology this makes her morally perfect – and she was still in love with Frank, so she didn’t want to divorce him. Had Branden not betrayed her and Objectivism, she might have married him, but I think it needs to be kept in mind that in Objectivism, a relationship with another is not as sacrosanct as one’s selfish relationship with oneself and reality. Miss Rand was firm about not deceiving one’s lover and / or spouse, that honesty was a virtue even in a sexual relationship. So she was being honest to have sexual desire for Branden given her estimation of him at the time. She did discuss it with Frank beforehand, and he agreed, so I don’t see why she had to consult anyone else.
If one takes a look at her novels, one can clearly see that sex outside of a marriage is sanctioned – i.e. one does not need to be married before having passionate sex. As to when one can have sex with someone else while being married, she does have Rearden having sex with Dagny as a positive action even though Hank was married at the time. By a rational selfish standard, Lillian was not someone he ought to have remained married to, and having sex with Dagny was very beneficial to him, especially psychologically, since he learned to enjoy sex thoroughly. And it is interesting to note that in one of the Q&A books, she mentions that if Hank would have committed to Dagny in marriage, then she wouldn’t have broken the marriage for the sake of being with Galt.
Would it have been better for her to have divorced Frank and then married Branden? Maybe in the short run, but in the long run she concluded that he betrayed her, so it is a good thing she didn’t divorce Frank, who stood by her all of that time and never betrayed her.
Certainly, in this type of situation, one’s dedication ought to be to one’s spouse, that having an affair behind their back is considered to be immoral. But I can understand why Frank would want her to experience sex with someone who was her intellectual and spiritual equal, so he was not betraying his love for her by saying he agreed to let that happen.
She also mentioned after the fact and after it was over, that having an affair while being married should only be attempted by moral giants – people who could hold the entire context in mind and act accordingly.
Did she regret having the affair? Yes, but only because later in her estimation Branden was not the man she thought he was when agreeing to have the affair with him.
So, I think the context of rational self-interest needs to be kept in mind. In essence, she wanted to experience sex with a John Galt, and she thought Branden was that type of man. And she didn’t betray anyone in the process – including herself – because she cleared it with Frank beforehand; and it is such a personal matter, that I don’t see why it is even anyone else’s concern.