How can I make the dimensions of parts in my assembly act as variables in my optimization study?

 

Hello, everyone, I'm very new to SolidWorks, and I'm trying to use an optimization study to minimize an equation's value. My assembly looks like the following, to give an idea of what I'm working with:

I want to be able to make the length of that arm right there be a variable in my design study, and have a custom formula that depends on the masses and distances from the bottom axis of the overall part (k = M1L1 + M2L2 + M3L3). I'm currently really lost, because first of all, sensors look totally useless, because I can't use the values they find in a formula anyway (at least not that I can see). Second of all, I tried to do something really simple where I tried to just minimize the moment of inertia of everything by making a global variable that equaled "SW_Lxx" and told it to minimize it as a goal, but I get the error:

And I just don't even know what this is supposed to mean.

 

I'd seriously appreciate some guidance. I'd imagine it's much simpler to do this in a part-level design study, but this is an assembly, and I want the changing of the arm length and some parameters of the wheel to impact my calculations. How can I make part-level dimensions variables of my study, and how do I make a formula at the assembly level to act as a goal that depends on these dimensions? Thank you so much for your help