Closed codykarcher closed 8 years ago
Reverted to 61394ebe155464089d416a015806cd763467aa3f
and at least things are working again.
as_posyslt1
to raise a TypeError
instead of ValueError
.working version of the original example (main change is switching ValueError to TypeError):
from gpkit import VectorVariable, Variable, Model, units
from gpkit.constraints.set import ConstraintSet
CD = Variable("C_D", "-", "Drag Coefficient")
# Aero Model
class XFOIL():
def __init__(self):
self.pathname = "/Users/codykarcher/Xfoil/bin/./xfoil"
def cd_model(self, x0, max_iter=100):
return 0.05
class SimpleCDModel(ConstraintSet):
def as_posyslt1(self):
raise TypeError("SimpleCDModel is not allowed to solve as a GP.")
def as_gpconstr(self, x0):
if not x0:
return (CD >= 0.01)
else:
xfoilcd = XFOIL().cd_model(x0)
return (CD >= xfoilcd)
constraints = [SimpleCDModel([])]
objective = CD
m = Model(objective, constraints)
# m.controlpanel(fn_of_sol=Weights_pie)
sol=m.localsolve()
Yup, that was it. Not sure about your third point... It is a mystery.
Thanks for the assistance!
So something has happened in the last 4 hours that made all my stuff break:
This is pretty high priority for me... I can't really do anything as long as this isn't working...