Using this as a reference, these sound OK, with the exception of "have to" but only because repeating "have" twice like that sounds a bit jarring.
I ought to have finished the homework by the end of the week.
I have to have finished the homework by the end of the week.
I shall have finished the homework by the end of the week.
I have heard this before, it sounds a bit awkward but makes sense.
I had better (typically "I'd better") have finished the homework by the end of the week.
I have also heard this before, it sounds quite awkward but still makes a bit of sense.
I have got to (typically "I've got to") have finished the homework by the end of the week.
This ...
I must have finished the homework by the end of the week.
I must not have finished the homework by the end of the week.
sounds like you are just discovering you have or have not done the homework, rather than using "must" to communicate a requirement or obligation.
However, usually all these sentences are arranged like this, which sounds much more natural to me.
I ought to have the homework finished by the end of the week
And all the modals "work", including the ones not mentioned above, if you keep the sentence like that:
I can(n't)/could(n't)/must(n't)/might (not)/may (not) have the homework finished by the end of the week.
(Even though "I must not have the homework finished by the end of the week" - meaning I am required to not have my homework finished by the end of the week - is a peculiar situation to be in - that would be the right way to say it.)
Best Answer
Sentence B does not sound correct to my ear. "By then" indicates that we're talking about a time in the future when the action in question will already be in the past. This is why the future perfect is used in sentence A, which is correct.
A possible way of correcting sentence B would be to say:
In this modified sentence, at the future time we're discussing, the action will be in the present or the very near future.
You didn't ask about the word choice, but I'm having a little trouble with the verbs "show" and "do". What does it mean, "to show what one means to do"? Is there no better way to say this? Something like the following would be much clearer: