def getMin(*args): """Solves an unconstrained optimization problem Basic solve: getMin(X,msg,fns,state) Solve with a state manipulator: getMin(X,msg,fns,state,smanip) """ # Check the number of arguments if len(args) != 4 and len(args) != 5: raise Exception( "The getMin function requires either 4 or 5 arguments, " "but %d given." % len(args)) # Extract the arguments X = args[0] msg = args[1] fns = args[2] state = args[3] smanip = Optizelle.StateManipulator() if len(args) == 4 else args[4] # Check the arguments Optizelle.checkVectorSpace("X", X) Optizelle.checkMessaging("msg", msg) Optizelle.Unconstrained.Functions.checkT("fns", fns) Optizelle.Unconstrained.State.checkT("state", state) Optizelle.checkStateManipulator("smanip", smanip) # Call the optimization Optizelle.Utility.UnconstrainedAlgorithmsGetMin(X, msg, fns, state, smanip)
def getMin(*args): """Solves an equality constrained optimization problem Basic solve: getMin(X,Y,msg,fns,state) Solve with a state manipulator: getMin(X,Y,msg,fns,state,smanip) """ # Check the number of arguments if len(args)!=5 and len(args)!=6: raise Exception("The getMin function requires either 5 or 6 arguments, " "but %d given." % len(args)) # Extract the arguments X=args[0] Y=args[1] msg=args[2] fns = args[3] state = args[4] smanip = Optizelle.StateManipulator() if len(args)==5 else args[5] # Check the arguments Optizelle.checkVectorSpace("X",X) Optizelle.checkVectorSpace("Y",Y) Optizelle.checkMessaging("msg",msg) Optizelle.EqualityConstrained.Functions.checkT("fns",fns) Optizelle.EqualityConstrained.State.checkT("state",state) Optizelle.checkStateManipulator("smanip",smanip) # Call the optimization Optizelle.Utility.EqualityConstrainedAlgorithmsGetMin( X,Y,msg,fns,state,smanip)
def read_restart(X, msg, fname, x, state): """Reads a json restart file""" # Check our arguments Optizelle.checkVectorSpace("X", X) Optizelle.checkMessaging("msg", msg) Optizelle.checkString("fname", fname) Optizelle.Unconstrained.State.checkT("state", state) # Do the read Optizelle.Utility.UnconstrainedRestartReadRestart(X, msg, fname, x, state)
def read(X, msg, fname, state): """Read parameters from file""" # Check our arguments Optizelle.checkVectorSpace("X", X) Optizelle.checkMessaging("msg", msg) Optizelle.checkString("fname", fname) Optizelle.Unconstrained.State.checkT("state", state) # Do the read Optizelle.Utility.UnconstrainedStateReadJson(X, msg, fname, state)
def write_restart(X, msg, fname, state): """Writes a json restart file""" # Check our arguments Optizelle.checkVectorSpace("X", X) Optizelle.checkMessaging("msg", msg) Optizelle.checkString("fname", fname) Optizelle.Unconstrained.State.checkT("state", state) # Do the write Optizelle.Utility.UnconstrainedRestartWriteRestart(X, msg, fname, state)
def read_restart(X,msg,fname,x,state): """Reads a json restart file""" # Check our arguments Optizelle.checkVectorSpace("X",X) Optizelle.checkMessaging("msg",msg) Optizelle.checkString("fname",fname) Optizelle.Unconstrained.State.checkT("state",state) # Do the read Optizelle.Utility.UnconstrainedRestartReadRestart(X,msg,fname,x,state)
def write_restart(X,msg,fname,state): """Writes a json restart file""" # Check our arguments Optizelle.checkVectorSpace("X",X) Optizelle.checkMessaging("msg",msg) Optizelle.checkString("fname",fname) Optizelle.Unconstrained.State.checkT("state",state) # Do the write Optizelle.Utility.UnconstrainedRestartWriteRestart(X,msg,fname,state)
def read(X,msg,fname,state): """Read parameters from file""" # Check our arguments Optizelle.checkVectorSpace("X",X) Optizelle.checkMessaging("msg",msg) Optizelle.checkString("fname",fname) Optizelle.Unconstrained.State.checkT("state",state) # Do the read Optizelle.Utility.UnconstrainedStateReadJson(X,msg,fname,state)
def __init__(self, X, msg, x): """Constructor""" # Check our arguments Optizelle.checkVectorSpace("X", X) Optizelle.checkMessaging("msg", msg) # Allocate memory for our vectors allocateVectors(self, X, x) # Create the state Optizelle.Utility.UnconstrainedStateCreate(self, X, msg, x)
def __init__(self,X,msg,x): """Constructor""" # Check our arguments Optizelle.checkVectorSpace("X",X) Optizelle.checkMessaging("msg",msg) # Allocate memory for our vectors allocateVectors(self,X,x) # Create the state Optizelle.Utility.UnconstrainedStateCreate(self,X,msg,x)
def release(X,msg,state,xs,reals,nats,params): """Release the data into structures controlled by the user""" # Check the arguments Optizelle.checkVectorSpace("X",X) Optizelle.checkMessaging("msg",msg) Optizelle.Unconstrained.State.checkT("state",state) # Release the information from the state Optizelle.Utility.UnconstrainedRestartRelease( X,msg,state,xs,reals,nats,params) # Return nothing. We've modified the passed in lists. return None
def release(X, msg, state, xs, reals, nats, params): """Release the data into structures controlled by the user""" # Check the arguments Optizelle.checkVectorSpace("X", X) Optizelle.checkMessaging("msg", msg) Optizelle.Unconstrained.State.checkT("state", state) # Release the information from the state Optizelle.Utility.UnconstrainedRestartRelease(X, msg, state, xs, reals, nats, params) # Return nothing. We've modified the passed in lists. return None
def __init__(self,X,Z,msg,x,z): """Constructor""" # Check our arguments Optizelle.checkVectorSpace("X",X) Optizelle.checkEuclidean("Z",Z) Optizelle.checkMessaging("msg",msg) # Allocate memory for our vectors Optizelle.Unconstrained.State.allocateVectors(self,X,x) allocateVectors(self,X,Z,x,z) # Create the state Optizelle.Utility.InequalityConstrainedStateCreate(self,X,Z,msg,x,z)
def capture(X,msg,state,xs,reals,nats,params): """Capture data from structures controlled by the user.""" # Check the arguments Optizelle.checkVectorSpace("X",X) Optizelle.checkMessaging("msg",msg) Optizelle.Unconstrained.State.checkT("state",state) Optizelle.checkVectors('xs',xs) Optizelle.checkReals('reals',reals) Optizelle.checkNaturals('nats',nats) Optizelle.checkParams('params',params) # Capture the restart information Optizelle.Utility.UnconstrainedRestartCapture( X,msg,state,xs,reals,nats,params) # Return nothing. The state has been modified. return None
def capture(X, msg, state, xs, reals, nats, params): """Capture data from structures controlled by the user.""" # Check the arguments Optizelle.checkVectorSpace("X", X) Optizelle.checkMessaging("msg", msg) Optizelle.Unconstrained.State.checkT("state", state) Optizelle.checkVectors('xs', xs) Optizelle.checkReals('reals', reals) Optizelle.checkNaturals('nats', nats) Optizelle.checkParams('params', params) # Capture the restart information Optizelle.Utility.UnconstrainedRestartCapture(X, msg, state, xs, reals, nats, params) # Return nothing. The state has been modified. return None