Equation Module

Equation, as the name implies, are to be used where calculations are to be performed on a number of input variables in order to obtain the value of an output one.


Endpoint

The Equation endpoint provides a RESTful interface to interact with Equation objects in the database. It allows authenticated users to create, update, and delete their own Equations objects.

The base URL for the Equation endpoint is https://datamanagerapi.solver-ai.com/api/data/equations/.


HTTP Methods

  • GET equations: Retrieves a list of all Equation objects associated with the authenticated user.
  • POST equations: Creates a new Equation object associated with the authenticated user.
  • GET equations/{id}: Retrieves the Equation object with the specified id.
  • PUT equations/{id}: Updates the Equation object with the specified id.
  • PATCH equations/{id}: Updates part of an Equation object with the specified id.
  • DELETE equations/{id}: Deletes the Equation object with the specified id.

Data

An Equation can be set up via the Browsable API (2 - Module Management) or programmatically (more on this here).

The parameters required for creating an Equation module are:

  • Name: Unique name identifying the Equation.
  • EquationString: Is the equation.
  • VariablesString: Is the list of the input variables (the output variable is deducted from the EquationString).
  • VectorizationIndices (optional): Indices used for vectorizing the equation.

Following is an example of the data when setup through the Browsable API:

Name: Example Equation
EquationString: z = x + y
VariablesString: x, y
VectorizationIndices: 3-5

More on VectorizationIndices

The VectorizationIndices can be left:

  • empty
  • be specified as a range (e.g., 3-5)
  • or be specified as a list of comma separated indices (e.g., 7, 8, 10)

For the example above, VariablesString represents the inputs to the equation, which are 'x' and 'y'. The VectorizationIndices field is set to '3-5', indicating that this equation should be vectorized over the indices 3, 4, and 5. This is equivalent to defining three separate equations:

  • z_3 = x_3 + y_3
  • z_4 = x_4 + y_4
  • z_5 = x_5 + y_5'

If VectorizationIndices is left empty, then the code will not be vectorized and the naming of the variables will remain as defined by the VariablesStringIn and VariablesStringOut.

More on the EquationString

The EquationString is python 3.9 compatible. Together with the equation string most numpy operations are supported, except those involving file operations. numpy can be used within the equation as for example:

z = x + np.cos(y)

The supported functions are:

  • np.abs
  • np.sqrt
  • np.log
  • np.log2
  • np.log10
  • np.exp
  • np.sin
  • np.cos
  • np.tan
  • np.arcsin
  • np.arccos
  • np.arctan
  • np.sinh
  • np.cosh
  • np.tanh
  • np.arcsinh
  • np.arccosh
  • np.arctanh
  • np.ceil
  • np.floor
  • np.round

Permissions

Only authenticated users can interact with this endpoint, this can be done via the API page or pragrammatically via a token, which can be obtained from the Account page.

All Equation created will be associated with the authenticated user, and and will not be accessible by other users.


Notes

  • If you attempt to delete an Equation that is used in a problem, the request will be denied with a 403 Forbidden status code.
  • For information on doing the same programmatically follow the documentation relative to the API Clients.

Privacy Policy Cookie Policy 
Website Terms and Conditions Platform Terms and Conditions 
X



//


SOLVER-AI ® is a registered trademark in the UK.
Copyright © 2022-2024 SOLVER-AI Ltd. All Rights Reserved.