pyepo.model.mpax.mpaxmodel
Abstract optimization model based on MPAX
Attributes
Classes
This is an abstract class for MPAX-based optimization model |
Module Contents
- pyepo.model.mpax.mpaxmodel._HAS_MPAX = True
- class pyepo.model.mpax.mpaxmodel.optMpaxModel(A=None, b=None, G=None, h=None, l=None, u=None, use_sparse_matrix=True, minimize=True)
Bases:
pyepo.model.opt.optModel
This is an abstract class for MPAX-based optimization model
- A
The matrix of equality constraints.
- Type:
jnp.ndarray, BCOO or BCSR
- b
The right hand side of equality constraints.
- Type:
jnp.ndarray
- G
The matrix for inequality constraints.
- Type:
jnp.ndarray, BCOO or BCSR
- h
The right hand side of inequality constraints.
- Type:
jnp.ndarray
- l
The lower bound of the variables.
- Type:
jnp.ndarray
- u
The upper bound of the variables.
- Type:
jnp.ndarray
- use_sparse_matrix
Whether to use sparse matrix format, by default True.
- Type:
bool
- minimize
Whether to minimize objective, by default True.
- Type:
bool
- l
- u
- use_sparse_matrix = True
- modelSense = 1
- device = None
- jitted_solve = None
- batch_optimize
- __repr__()
- property num_cost
number of cost to be predicted
- setObj(c)
A method to set objective function
- Parameters:
c (np.ndarray / list) – cost of objective function
- solve()
A method to solve model
- Returns:
optimal solution (list) and objective value (jnp.float32)
- Return type:
tuple
- static _jitted_solve(c, A, b, G, h, l, u, use_sparse_matrix)
A static method for JIT complile
- addConstr(coefs, rhs)
A method to add new constraint
- Parameters:
coefs (np.ndarray / list) – coeffcients of new constraint
rhs (jnp.float32) – right-hand side of new constraint
- Returns:
new model with the added constraint
- Return type:
- _getModel()
Placeholder method for MPAX. MPAX does not require an explicit model creation.
- pyepo.model.mpax.mpaxmodel.num_vars = 10