Mormonism, like many religions, involves free will and an all-knowing God. The combination of these two principles can lead to serious paradoxes and cognitive dissonance when certain forms of deterministic interpretations are used - see theological explorations of free will. Even scientific attempts at defining concepts like omniscience runs into problems - see Laplace's demon for a problem approaching this classically. While my own views are certainly not flawless, I do feel that as we step away from the deterministic interpretations which were often popular in the century Mormonism arose out of, a more robust approach to reconciling free will and the knowledge of God can be found.
My current view on agency and foresight of God is very much informed by more of a quantum interpretation. That in front of all of us lies an infinity of possibilities one could express as a probability wave with some outcomes that are more likely than others. Then as I make choices it sends ripples through that wave: opening increasing some possibilities or collapsing others making them less probable (or even impossible). From moment to moment, that wave of future possibilities is in flux. And I believe that what God is eager to tune us to is, through our use of agency, maximize this probability wave's alignment with the outcomes God desires for us: intelligence, love, immortality, and eternal life.
Perhaps what God understands and comprehends (computes if you will) is the total set of outcomes or at least a set large enough to God's knowledge to be omniscience for all of God's intents and purposes. When God learned/computed, learns/computes, or will learn/compute that I don't know. Whether God learns/computes it all to minute individual degree on everything I don't know, but God could have a superimposed understanding of how these possibility waves can expand and contract at individual and (likely more importantly) societal levels such that it creates a clear enough understanding of what actions are required of God to ensure God's purposes are met: again, maximizing intelligence, love, immortality, and eternal life.
So, in this view there are an infinite number of possibilities within God's plan for all of us. This rejects classical deterministic notions of necessarily marrying "the one", binary "yes" or "no" approaches to whether something is God's will, sheds light on the fact that revelation is often contingent (e.g. Jonah), sees religion as a process rather than as a fixed destination, and highlights how God is able to call others in place of those who fall from their potential (see Matthew 3:9). We have an infinite set of possibilities ahead of us, though some that may be eternally prohibited. One could say that God may not know exactly what our choices will necessarily be and thus we have true, independent free will. However, God could have a clear enough understanding of outcomes of our possible choices and seeks to guide us to the best outcomes from where we are (practical omniscience).
This creates a perspective where our relationship to God is much more of a partnership rather than ourselves as deterministic pawns in God's plan. This partnership speaks strongly about the rather unique Mormon doctrine of co-eternality -- that we aren't automatons doomed to the prison of deterministic predestination and that we have a true in-born freedom (even radically so al la Sartre). This makes us much more masters of our own destiny where our choices are truly our own and yet to be determined. God, with sufficient comprehension of a multitude of possible outcomes, can fully project the reality of a possible set of choices and provide a warning not just based on a theory of what will likely happen but what will actually happen if that set of choices are made. God provides revelation, inspires prophets about impending possibility waves and prophets provide warnings as best as they can (limited by how they "see through the glass, darkly" as they decode revelation). But those prophecies are not deterministic edicts of doom but instead warnings to change course and exercise our free will. Revelation becomes an outstretched hand from God asking us to join with Them.
I believe this gives true free will (agency) to all, illuminates the Mormon theology of co-eternality, but also makes God the God of creation - seeing how God can know how to most optimally influence if some combination of possibility waves to maximize God's purposes.
What's interesting to think about is the combination of agencies from collections of people and that it gets even more complex than just comprehending the individual probability waves of free will for individuals. At a basic level you have the combination of wills through friendship, family, marriage, tribe, nation, etc. With each combination there is the possibility of the probability waves of free will aligning and magnifying possibilities (either good or bad). And there is also the possibility of the waves clashing canceling out possibilities which may be mutually tempering or which may lead to conflict.
Ultimately, I see God as a Society which has found a way to unite the wills of many to maximize towards righteous ends. This can be called Zion, the Kingdom of God, or heaven. And I find it interesting that Christ mentions the sacredness of this kind of combination ("where two or three are gathered in my name -- there I am").
A really fascinating quote from Wilford Woodruff in early Mormonism creates an interesting perspective on this whole idea of wills combining. This idea came about during a conversation he had with with Orson Pratt and Albert Carrington. Woodruff notes this in his journal on that day:
"June 26, 1847: During our travels today I walked most of the way with Professors Pratt and Carrington and our conversation turned upon the subject of the original formation of God, angels, man and devils, the begetting of spirits in the eternal worlds, and who by the begetting of children on the earth, the death of man and children and the resurrection of all. Each one gave his views, opinions, and reasoning and many interesting remarks were truly made." (source)
What I wouldn't give to have been on that walk with them!
Here's his musing on this notion of a combination of wills he discussed with Pratt and Carrington as being a possible environment out of which God emerges and which God encourages:
"It may reasonably have been the case with the first being formed which may be called God. An eternity was filled as it were with particules [sp] of intelligences who had their agency, two of these particles in the process of time might have joined their interest together exchanged ideas & found by perusing this course that they gained double strength to what one particle of intelligence would have & afterwards were joined by other particles & continued until they organized a combination or body through a long process & as they had power over other intelligences in consequence of their combination, organization & strength and in process of time this being- or God seeing the advantage of such an organization desired company or a companion and having some experience got to work & organized other beings by prevailing on intelligences to come together & may form something better than at the first and after trials of this kind & the most perfect way sought it was found to be the most expeditious & best way to receive there formations or bodies either spiritual or temporal through the womb." (Journal, June 26, 1847)
This perspective can create fertile ground which gives place for genuine free will of the individual, allows for God's omniscience (even if it is merely functional omniscience), and underscores the Mormon theology of co-eternality. It can go a long way in reconciling these principles which, through the lens of determinism, are often pitted against each other in paradox. And as I'm much more inspired by our taking responsibility for our own destiny while we seek a relationship with God rather than abdicating our responsibility to God, an approach such as this gives me more faith and a determination to create and be the good in the world.