Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

values clobbering new substitutions because of constraint ordering choice #1175

Closed
mjburton11 opened this issue Oct 13, 2017 · 2 comments
Closed

Comments

@mjburton11
Copy link

Looking at commit convexengineering/solar@e99e9e7 in solar, solving solar.py and convexengineering/gplibrary@c6da5c0 in gpkitmodels. I am subbing in tau in HTail.

class HorizontalTail(AeroSurf):
    "horizontal tail model"
    flight_model = TailAero
    sparModel = None

    def setup(self, N=3, lam=0.8):
        self.ascs = AeroSurf.setup(self, N, lam)
        self.planform.substitutions.update({"AR": 4, "\\tau": 0.08})

But when I solve the model I get this:

In [2]: sol("\\tau")
Out[2]: 
{\tau_Mission/Aircraft/Empennage/HorizontalTail/Planform: 0.115,
 \tau_Mission/Aircraft/Empennage/VerticalTail/Planform.1: 0.115,
 \tau_Mission/Aircraft/AeroSurf/Planform.2: 0.115}

In [3]: M.substitutions["\\tau_Mission/Aircraft/Empennage/VerticalTail/Planform.
   ...: 1"]
Out[3]: 0.115

In [4]: sol("AR")
Out[4]: 
{AR_Mission/Aircraft/Empennage/HorizontalTail/Planform: 4,
 AR_Mission/Aircraft/Empennage/VerticalTail/Planform.1: 3.7197870897370509,
 AR_Mission/Aircraft/AeroSurf/Planform.2: 26.66897625889953}

Pretty weird that AR got changed, but not tau

@bqpd
Copy link
Contributor

bqpd commented Oct 13, 2017

the problem is in

https://github.com/convexengineering/solar/blob/e0d1f51459d945b3c71ff23012c9001c358168bf/solar/solar.py#L320

because self.mission contains \\tau (in the performance models), but no substitutions for it, it pulls the value out of the variable. Because it comes second in the list, its substitutions replace those of self.solar

In the short term this can be fixed by reordering them: return self.mission, self.solar

In the medium term this requires a different approach to substitutions

@mjburton11
Copy link
Author

Interesting. The reordering worked. Feels like this shouldn't be a problem. Maybe a design discussion question??

@bqpd bqpd changed the title substitution in submodel not changed in main model values clobbering new substitutions because of constraint ordering choice Oct 19, 2017
@bqpd bqpd added this to the Middle Release milestone Nov 3, 2017
@bqpd bqpd modified the milestones: Middle Release, Next release Nov 12, 2017
@bqpd bqpd removed this from the Next release milestone Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants