HxModel Class¶
- class Hexaly.Optimizer.HxModel¶
Mathematical optimization model. A model is composed of expressions (some of which are decisions), organized as a tree. Then, some expressions of the model can be constrained or optimized. Once your optimization model is created and closed, the optimizer can be launched to resolve it. Note that you cannot modify a model which has been closed: you must reopen it (with
HxModel.open
) or instantiate another Hexaly Optimizer environment to optimize another model.- See:
- See:
Summary¶
Returns the Hexaly Optimizer object associated to this model. |
|
Creates a constant expression representing the given value. |
|
Creates an expression of the given type, with the given ordered operands. |
|
Creates a lambda function with arguments. |
|
Creates an integer external function. |
|
Creates a double external function. |
|
Creates an integer array external function. |
|
Creates a double array external function. |
|
Returns the number of expressions added to this model. |
|
Gets the expression with the given index in this model. |
|
Gets the number of decisions in the model. |
|
Gets the decision with the given index. |
|
Adds the given expression to the list of constraints. |
|
Shortcut for AddConstraint(expr). |
|
Removes the given expression from the list of constraints. |
|
Returns the number of constraints added to this model. |
|
Gets the constraint with the given index in this model. |
|
Adds the given expression to the list of objectives to optimize. |
|
Shortcut for AddObjective(HxObjectiveDirection.Minimize, expr). |
|
Shortcut for AddObjective(HxObjectiveDirection.Maximize, expr). |
|
Removes the objective at the given position in the list of objectives. |
|
Returns the number of objectives added to this model. |
|
Gets the objective with the given index in this model. |
|
Gets the direction of the objective with the given index. |
|
Gets the number of operands in the model. |
|
Closes the model. |
|
Reopens the model. |
|
Returns true if the model is closed, false otherwise. |
|
Creates a boolean decision. |
|
Creates a float decision. |
|
Creates an integer decision. |
|
Creates an interval decision included in [minStart, maxEnd). |
|
Creates a list decision with the given length. |
|
Creates a set decision with the given length. |
|
Creates a sum expression. |
|
Creates a substraction expression. |
|
Creates a product expression. |
|
Creates a maximum expression. |
|
Creates a minimum expression. |
|
Creates an equality expression. |
|
Creates a disequality expression. |
|
Creates an inequality expression greater than or equal to. |
|
Creates an inequality expression less than or equal to. |
|
Creates an inequality expression greater than. |
|
Creates an inequality expression less than. |
|
Creates a ternary conditional expression. |
|
Creates a NOT expression. |
|
Creates an AND expression. |
|
Creates a OR expression. |
|
Creates a XOR expression. |
|
Creates an absolute value expression. |
|
Creates a distance expression. |
|
Creates a division expression. |
|
Creates a modulo expression. |
|
Creates a new array. |
|
Creates a step array. |
|
Creates a “at” expression for N-dimensional array. |
|
Creates an expression for the scalar product between two arrays. |
|
Creates a ceil expression. |
|
Creates a floor expression. |
|
Creates a rounding expression. |
|
Creates a square root expression. |
|
Creates a log expression. |
|
Creates an exponential expression. |
|
Creates a power expression. |
|
Creates a cosine expression. |
|
Creates a sine expression. |
|
Creates a tangent expression. |
|
Creates a piecewise linear expression. |
|
Creates a start expression. |
|
Creates an end expression. |
|
Creates a length expression. |
|
Creates a count expression. |
|
Creates an indexOf expression. |
|
Creates a distinct expression. |
|
Creates an intersection expression. |
|
Creates a hull expression. |
|
Creates a contains expression. |
|
Creates a partition expression. |
|
Creates a disjoint expression. |
|
Creates a cover expression. |
|
Creates a find expression. |
|
Creates a sort expression. |
|
Creates an integer external function. |
|
Creates a double external function. |
|
Creates an integer array external function. |
|
Creates a double array external function. |
|
Creates a lambda function expression. |
|
Creates a call expression. |
|
Creates a range expression, where a is the lower bound (inclusive) and b is the upper bound (exclusive). |
|
Returns a string representation of this model. |
Instance methods¶
- HexalyOptimizer GetOptimizer()¶
Returns the Hexaly Optimizer object associated to this model.
- Returns:
HexalyOptimizer object
- Return type:
- HxExpression CreateConstant(long value)¶
- HxExpression CreateConstant(double value)
Creates a constant expression representing the given value. Only allowed in state
Modeling
. Note that if a constant has been already created with the same value, this method can return the same expression, but it is not guaranteed. The exact behavior is implementation defined.- Arguments:
value (
long
ordouble
) – Value of the constant- Returns:
Created constant expression
- Return type:
- HxExpression CreateExpression(HxOperator op)¶
- HxExpression CreateExpression(HxOperator op, params HxExpression[] operands)
- HxExpression CreateExpression(HxOperator op, params long[] operands)
- HxExpression CreateExpression(HxOperator op, params double[] operands)
- HxExpression CreateExpression(HxOperator op, IEnumerable<HxExpression> operands)
- HxExpression CreateExpression(HxOperator op, IEnumerable<long> operands)
- HxExpression CreateExpression(HxOperator op, IEnumerable<double> operands)
- HxExpression CreateExpression(HxOperator op, HxExpression a, long b)
- HxExpression CreateExpression(HxOperator op, long a, long b, HxExpression c)
- HxExpression CreateExpression(HxOperator op, long a, HxExpression b, long c)
- HxExpression CreateExpression(HxOperator op, long a, HxExpression b, HxExpression c)
- HxExpression CreateExpression(HxOperator op, HxExpression a, long b, long c)
- HxExpression CreateExpression(HxOperator op, HxExpression a, long b, HxExpression c)
- HxExpression CreateExpression(HxOperator op, HxExpression a, HxExpression b, long c)
- HxExpression CreateExpression(HxOperator op, double a, HxExpression b)
- HxExpression CreateExpression(HxOperator op, HxExpression a, double b)
- HxExpression CreateExpression(HxOperator op, double a, double b, HxExpression c)
- HxExpression CreateExpression(HxOperator op, double a, HxExpression b, double c)
- HxExpression CreateExpression(HxOperator op, double a, HxExpression b, HxExpression c)
- HxExpression CreateExpression(HxOperator op, HxExpression a, double b, double c)
- HxExpression CreateExpression(HxOperator op, HxExpression a, double b, HxExpression c)
- HxExpression CreateExpression(HxOperator op, HxExpression a, HxExpression b, double c)
Creates an expression of the given type, with the given ordered operands. Only allowed in state
Modeling
. The operands can be doubles, longs or previously declared HxExpressions. It is also possible to use this method with arrays or enumerables.This method can be called with a variable number of arguments thanks to the
params
keyword. The following code is valid as long as all the arguments share the same type (i.elong
,double
orHxExpression
):// all the arguments (a, b, c, ...) must be of the same data type CreateExpression(op, a, b, c, d, e, f, g)
- Arguments:
op (HxOperator) – Type of expression to create
a (
long
,double
orHxExpression
) – Operand 0b (
long
,double
orHxExpression
) – Operand 1c (
long
,double
orHxExpression
) – Operand 2operands – Operands.
- Returns:
Created expression.
- Return type:
- HxExpression CreateLambdaFunction(HxLambdaFunction0 functor)¶
- HxExpression CreateLambdaFunction(HxLambdaFunction1 functor)
- HxExpression CreateLambdaFunction(HxLambdaFunction2 functor)
- HxExpression CreateLambdaFunction(HxLambdaFunction3 functor)
- HxExpression CreateLambdaFunction(int nbArgs, HxLambdaFunction functor)
Creates a lambda function with arguments. A lambda function is a particular expression composed of two parts:
The arguments of the function (which are also HxExpressions of type
Argument
).The body of the function. The body is an HxExpression that will be used to evaluate the result of the function. The body can be any HxExpression composed of any operands and operators supported by Hexaly Optimizer. Thus, the body expression can use the arguments of the function but can also capture and refer to expressions declared outside of the function.
The functor you provide will not be used directly during the solving process, but will be evaluated once by the API, with a number of HxExpression of type
Argument
that corresponds to the number of arguments you want and your function expects. At the end of the evaluation of your function, the returned HxExpression will be used as the body of the Hexaly Optimizer function.- Since:
9.5
- Arguments:
nbArgs – Number of arguments you want for your function. Only useful if you want a function with more than 3 arguments. Otherwise, you can use the dedicated shortcuts HxLambdaFunction0, HxLambdaFunction1, HxLambdaFunction2 and HxLambdaFunction3.
function – A function (HxLambdaFunction) that accepts
HxExpression
as arguments and returns anHxExpression
that will be used as the body of the new Hexaly Optimizer function you want to create.
- Returns:
Expression of type
LambdaFunction
.
- HxExpression CreateIntExternalFunction(HxIntExternalFunction function)¶
Creates an integer external function. The argument must implement
HxIntExternalFunction
. When the external function is called, the argument values will be made accessible to your function through theHxExternalArgumentValues
.Once you have instantiated it, you have to use
HxModel.Call()
to call it in your model.Note 1: Most of the time your external function will be called when the optimizer is in state
Running
. Do not attempt to call any method of the optimizer (to retrieve statistics, values of HxExpressions or whatever) in that state or an exception will be thrown. The only accessible function isHexalyOptimizer.Stop()
.Note 2: Your functions must be thread-safe. According to the “nbThreads” parameter, Hexaly Optimizer can be multi-threaded. In that case, your external functions must be thread safe. If you cannot guarantee the thread-safety of your code, we strongly recommend you to limit the search of Hexaly Optimizer to one thread with
HxParam.SetNbThreads
.Note 3: You can provide additional data for your function (such as lower and upper bounds) with the help of the
HxExternalContext
associated with your function (seeHxExpression.GetExternalContext()
.- Since:
9.5
- Arguments:
function (HxIntExternalFunction) – External function to call, passed as a delegate.
- Returns:
The expression associated to the function.
- Return type:
- HxExpression CreateDoubleExternalFunction(HxDoubleExternalFunction function)¶
Creates a double external function. The argument must implement
HxDoubleExternalFunction
. When the external function is called, the argument values will be made accessible to your function through theHxExternalArgumentValues
.Once you have instantiated it, you have to use
HxModel.Call()
to call it in your model.Note 1: Most of the time your external function will be called when the optimizer is in state
Running
. Do not attempt to call any method of the optimizer (to retrieve statistics, values of HxExpressions or whatever) in that state or an exception will be thrown. The only accessible function isHexalyOptimizer.Stop()
.Note 2: Your functions must be thread-safe. According to the “nbThreads” parameter, Hexaly Optimizer can be multi-threaded. In that case, your external functions must be thread safe. If you cannot guarantee the thread-safety of your code, we strongly recommend you to limit the search of Hexaly Optimizer to one thread with
HxParam.SetNbThreads
.Note 3: You can provide additional data for your function (such as lower and upper bounds) with the help of the
HxExternalContext
associated with your function (seeHxExpression.GetExternalContext()
.- Since:
9.5
- Arguments:
function (HxDoubleExternalFunction) – External function to call, passed as a delegate.
- Returns:
The expression associated to the function.
- Return type:
- HxExpression CreateIntArrayExternalFunction(HxIntArrayExternalFunction function)¶
Creates an integer array external function. The argument must implement
HxIntArrayExternalFunction
. When the external function is called, the argument values will be made accessible to your function through theHxExternalArgumentValues
.Once you have instantiated it, you have to use
HxModel.Call()
to call it in your model.- Since:
11.0
- Arguments:
function (HxIntArrayExternalFunction) – External function to call, passed as a delegate.
- Returns:
The expression associated to the function.
- Return type:
- HxExpression CreateDoubleArrayExternalFunction(HxDoubleArrayExternalFunction function)¶
Creates a double array external function. The argument must implement
HxDoubleArrayExternalFunction
. When the external function is called, the argument values will be made accessible to your function through theHxExternalArgumentValues
.Once you have instantiated it, you have to use
HxModel.Call()
to call it in your model.- Since:
11.0
- Arguments:
function (HxDoubleArrayExternalFunction) – External function to call, passed as a delegate.
- Returns:
The expression associated to the function.
- Return type:
- int GetNbExpressions()¶
Returns the number of expressions added to this model.
- See:
- Returns:
Number of expressions.
- Return type:
int
- HxExpression GetExpression(int exprIndex)¶
Gets the expression with the given index in this model. Throws an exception if
exprIndex < 0
orexprIndex >= GetNbExpressions()
- See:
- Arguments:
exprIndex (
int
) – Index of the expression.- Returns:
Expression with the given index.
- Return type:
- HxExpression GetExpression(string exprName)
Gets the expression with the given name. Throws an exception if no expression with the given name exists.
- Arguments:
exprName (
name
) – Name.- Returns:
Expression with the given name.
- Return type:
- int GetNbDecisions()¶
Gets the number of decisions in the model. This corresponds to the number of decision variables (
HxOperator.Bool
,HxOperator.Float
,HxOperator.Int
,HxOperator.List
orHxOperator.Set
) declared in the model.- See:
- Returns:
Number of decisions.
- Return type:
int
- HxExpression GetDecision(int decisionIndex)¶
Gets the decision with the given index. Throws an exception if
decisionIndex < 0
ordecisionIndex >= GetNbDecisions()
- See:
- Arguments:
exprIndex – Index of the decision.
- Returns:
Decision with the given index.
- Return type:
- void AddConstraint(HxExpression expr)¶
Adds the given expression to the list of constraints. It means that the value of this expression must be constrained to be equal to 1 in any solution found by the optimizer. Hence, only boolean expressions (that is, expressions whose value is boolean) can be constrained. Only allowed in state
Modeling
. If the expression is already a constraint, this method does nothing and returns immediately.- Arguments:
expr (HxExpression) – Expression to constraint.
- void Constraint(HxExpression expr)¶
Shortcut for
AddConstraint(expr)
.- Since:
5.5
- See:
- Arguments:
expr (HxExpression) – Expression to constraint.
- void RemoveConstraint(HxExpression expr)¶
Removes the given expression from the list of constraints. If the expression was not constrained, this method does nothing and returns immediately. Only allowed in state
Modeling
.- Since:
5.0
- Arguments:
expr (HxExpression) – Expression
- void RemoveConstraint(int constraintIndex)
Removes the constraint at the given position in the list of constraints. Only allowed in state
Modeling
.- Since:
5.0
- See:
- Arguments:
constraintIndex (
int
) – Index of the constraint to remove
- int GetNbConstraints()¶
Returns the number of constraints added to this model.
- See:
- Returns:
Number of constraints.
- Return type:
int
- HxExpression GetConstraint(int constraintIndex)¶
Gets the constraint with the given index in this model. Throws an exception if
constraintIndex < 0
orconstraintIndex >= GetNbConstraints()
.- See:
- Arguments:
constraintIndex (
int
) – Index of the constraint.- Returns:
Constraint with the given index.
- Return type:
- void AddObjective(HxExpression expr, HxObjectiveDirection direction)¶
Adds the given expression to the list of objectives to optimize. The same expression can be added more than once. Only allowed in state
Modeling
. Note that the objectives will be optimized in the order in which they have been added to the model. It is useful for lexicographic multiobjective optimization, and more particularly for goal programming.- Arguments:
expr (HxExpression) – Expression.
direction (HxObjectiveDirection) – Optimisation direction of this objective
- void Minimize(HxExpression expr)¶
Shortcut for
AddObjective(HxObjectiveDirection.Minimize, expr)
.- Since:
5.5
- See:
- Arguments:
expr (HxExpression) – Expression to minimize.
- void Maximize(HxExpression expr)¶
Shortcut for
AddObjective(HxObjectiveDirection.Maximize, expr)
.- Since:
5.5
- See:
- Arguments:
expr (HxExpression) – Expression to maximize.
- void RemoveObjective(int objectiveIndex)¶
Removes the objective at the given position in the list of objectives. Note that the objectives created after the removed one have their index decreased by 1. Phases are not modified when an objective is removed. It is the user’s responsibility to change the objective index of each phase to keep it coherent (with
HxPhase.SetOptimizedObjective(int)
), or to disable it (withHxPhase.SetEnabled(bool)
).Only allowed in state
Modeling
.- Since:
5.0
- Arguments:
objectiveIndex (int) – position of the objective to remove.
- int GetNbObjectives()¶
Returns the number of objectives added to this model.
- See:
- Returns:
Number of objectives.
- Return type:
int
- HxExpression GetObjective(int objectiveIndex)¶
Gets the objective with the given index in this model. Throws an exception if
objectiveIndex < 0
orobjectiveIndex >= GetNbObjectives()
.- See:
- Arguments:
objectiveIndex (int) – Index of the objective.
- Returns:
Objective with the given index.
- Return type:
- HxObjectiveDirection GetObjectiveDirection(int objectiveIndex)¶
Gets the direction of the objective with the given index.
- See:
- Arguments:
objectiveIndex (int) – Index of the objective.
- Returns:
Objective direction.
- Return type:
- int GetNbOperands()¶
Gets the number of operands in the model. This corresponds to the number of operands for all expressions declared in the model. It is an analog of the number of non zeros in matrix model encountered in mathematical programming: it gives an hint about the size and the density of your model.
- See:
- Returns:
Number of operands.
- Return type:
int
- void Close()¶
Closes the model. Only allowed in state
Modeling
. When this method is called, the optimizer is placed in stateStopped
.Once the model is closed, no expressions, constraints or objectives can be added or removed unless the model is reopened. The model must be closed before starting its resolution.
- See:
- void Open()¶
Reopens the model. Only allowed in state
Stopped
. When this method is called, the optimizer is placed in stateModeling
.In this state, the model can be modified: it is possible to add new expressions, constraints or objectives, modify expression operands, and remove existing constraints and objectives. However, existing expressions cannot be deleted.
- See:
- bool IsClosed()¶
Returns true if the model is closed, false otherwise.
- Returns:
True if the model is closed.
- Return type:
bool
- HxExpression Bool()¶
Creates a boolean decision. Binary decision variable with domain { 0, 1 }. This method is a shortcut for
CreateExpression(HxOperator.Bool)
.- See:
- See:
- Since:
5.5
- HxExpression Float(double lb, double ub)¶
Creates a float decision. Decision variable with domain [lb, ub]. This method is a shortcut for
CreateExpression(HxOperator.Float, lb, ub)
.- Arguments:
lb (double) – Lower bound of the decision variable.
ub (double) – Upper bound of the decision variable.
- See:
- See:
- Since:
5.5
- HxExpression Int(long lb, long ub)¶
Creates an integer decision. Decision variable with domain [lb, ub]. This method is a shortcut for
CreateExpression(HxOperator.Int, lb, ub)
.- Arguments:
lb (long) – Lower bound of the decision variable.
ub (long) – Upper bound of the decision variable.
- See:
- See:
- Since:
5.5
- HxExpression Interval()¶
Creates an interval decision included in [minStart, maxEnd). Start is inclusive and end is exclusive. This method is a shortcut for
CreateExpression(HxOperator.Interval)
.- Arguments:
minStart (long) – Min start of the decision variable.
maxEnd (long) – Max end of the decision variable.
- See:
- See:
- Since:
12.0
- HxExpression List(long n)¶
Creates a list decision with the given length. A list is an ordered collection of integers within a domain [0, n-1]. This method is a shortcut for
CreateExpression(HxOperator.List, n)
.- Arguments:
n (long) – Collection size.
- See:
- See:
- Since:
5.5
- HxExpression Set(long n)¶
Creates a set decision with the given length. A set is an unordered collection of integers within a domain [0, n-1]. This method is a shortcut for
CreateExpression(HxOperator.Set, n)
.- Arguments:
n (long) – Collection size.
- See:
- See:
- Since:
8.0
- HxExpression Sum()¶
- HxExpression Sum(params HxExpression[] operands)
- HxExpression Sum(IEnumerable<HxExpression> operands)
- HxExpression Sum(HxExpression a)
- HxExpression Sum(long a)
- HxExpression Sum(double a)
- HxExpression Sum(long a, HxExpression b)
- HxExpression Sum(double a, HxExpression b)
- HxExpression Sum(HxExpression a, long b)
- HxExpression Sum(HxExpression a, double b)
- HxExpression Sum(HxExpression a, HxExpression b)
Creates a sum expression. This method is a shortcut for
CreateExpression(HxOperator.Sum, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Sub(HxExpression a, HxExpression b)¶
- HxExpression Sub(long a, HxExpression b)
- HxExpression Sub(double a, HxExpression b)
- HxExpression Sub(HxExpression a, long b)
- HxExpression Sub(HxExpression a, double b)
Creates a substraction expression. This method is a shortcut for
CreateExpression(HxOperator.Sub, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Prod()¶
- HxExpression Prod(params HxExpression[] operands)
- HxExpression Prod(IEnumerable<HxExpression> operands)
- HxExpression Prod(HxExpression a)
- HxExpression Prod(long a)
- HxExpression Prod(double a)
- HxExpression Prod(long a, HxExpression b)
- HxExpression Prod(double a, HxExpression b)
- HxExpression Prod(HxExpression a, long b)
- HxExpression Prod(HxExpression a, double b)
- HxExpression Prod(HxExpression a, HxExpression b)
Creates a product expression. This method is a shortcut for
CreateExpression(HxOperator.Prod, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Max()¶
- HxExpression Max(params HxExpression[] operands)
- HxExpression Max(IEnumerable<HxExpression> operands)
- HxExpression Max(HxExpression a)
- HxExpression Max(long a)
- HxExpression Max(double a)
- HxExpression Max(long a, HxExpression b)
- HxExpression Max(double a, HxExpression b)
- HxExpression Max(HxExpression a, long b)
- HxExpression Max(HxExpression a, double b)
- HxExpression Max(HxExpression a, HxExpression b)
Creates a maximum expression. This method is a shortcut for
CreateExpression(HxOperator.Max, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Min()¶
- HxExpression Min(params HxExpression[] operands)
- HxExpression Min(IEnumerable<HxExpression> operands)
- HxExpression Min(HxExpression a)
- HxExpression Min(long a)
- HxExpression Min(double a)
- HxExpression Min(long a, HxExpression b)
- HxExpression Min(double a, HxExpression b)
- HxExpression Min(HxExpression a, long b)
- HxExpression Min(HxExpression a, double b)
- HxExpression Min(HxExpression a, HxExpression b)
Creates a minimum expression. This method is a shortcut for
CreateExpression(HxOperator.Min, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Eq(long a, HxExpression b)¶
- HxExpression Eq(double a, HxExpression b)
- HxExpression Eq(HxExpression a, long b)
- HxExpression Eq(HxExpression a, double b)
- HxExpression Eq(HxExpression a, HxExpression b)
Creates an equality expression. This method is a shortcut for
CreateExpression(HxOperator.Eq, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Neq(HxExpression a, HxExpression b)¶
- HxExpression Neq(long a, HxExpression b)
- HxExpression Neq(double a, HxExpression b)
- HxExpression Neq(HxExpression a, long b)
- HxExpression Neq(HxExpression a, double b)
Creates a disequality expression. This method is a shortcut for
CreateExpression(HxOperator.Neq, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Geq(HxExpression a, HxExpression b)¶
- HxExpression Geq(long a, HxExpression b)
- HxExpression Geq(double a, HxExpression b)
- HxExpression Geq(HxExpression a, long b)
- HxExpression Geq(HxExpression a, double b)
Creates an inequality expression greater than or equal to. This method is a shortcut for
CreateExpression(HxOperator.Geq, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Leq(HxExpression a, HxExpression b)¶
- HxExpression Leq(long a, HxExpression b)
- HxExpression Leq(double a, HxExpression b)
- HxExpression Leq(HxExpression a, long b)
- HxExpression Leq(HxExpression a, double b)
Creates an inequality expression less than or equal to. This method is a shortcut for
CreateExpression(HxOperator.Leq, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Gt(HxExpression a, HxExpression b)¶
- HxExpression Gt(long a, HxExpression b)
- HxExpression Gt(double a, HxExpression b)
- HxExpression Gt(HxExpression a, long b)
- HxExpression Gt(HxExpression a, double b)
Creates an inequality expression greater than. This method is a shortcut for
CreateExpression(HxOperator.Gt, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Lt(HxExpression a, HxExpression b)¶
- HxExpression Lt(long a, HxExpression b)
- HxExpression Lt(double a, HxExpression b)
- HxExpression Lt(HxExpression a, long b)
- HxExpression Lt(HxExpression a, double b)
Creates an inequality expression less than. This method is a shortcut for
CreateExpression(HxOperator.Lt, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression If(HxExpression a, HxExpression b, HxExpression c)¶
- HxExpression If(HxExpression a, HxExpression b, long c)
- HxExpression If(HxExpression a, long b, HxExpression c)
- HxExpression If(HxExpression a, long b, long c)
- HxExpression If(HxExpression a, HxExpression b, double c)
- HxExpression If(HxExpression a, double b, HxExpression c)
- HxExpression If(HxExpression a, double b, double c)
Creates a ternary conditional expression. This method is a shortcut for
CreateExpression(HxOperator.If, condExpr, trueExpr, falseExpr)
.- See:
- See:
- Since:
5.5
- HxExpression Not(HxExpression a)¶
Creates a NOT expression. This method is a shortcut for
CreateExpression(HxOperator.Not, a)
.- See:
- See:
- Since:
5.5
- HxExpression And()¶
- HxExpression And(HxExpression a)
- HxExpression And(params HxExpression[] operands)
- HxExpression And(IEnumerable<HxExpression> operands)
- HxExpression And(HxExpression a, HxExpression b)
Creates an AND expression. This method is a shortcut for
CreateExpression(HxOperator.And, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Or()¶
- HxExpression Or(HxExpression a)
- HxExpression Or(params HxExpression[] operands)
- HxExpression Or(IEnumerable<HxExpression> operands)
- HxExpression Or(HxExpression a, HxExpression b)
Creates a OR expression. This method is a shortcut for
CreateExpression(HxOperator.Or, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Xor()¶
- HxExpression Xor(HxExpression a)
- HxExpression Xor(params HxExpression[] operands)
- HxExpression Xor(IEnumerable<HxExpression> operands)
- HxExpression Xor(HxExpression a, HxExpression b)
Creates a XOR expression. This method is a shortcut for
CreateExpression(HxOperator.Xor, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Abs(HxExpression a)¶
Creates an absolute value expression. This method is a shortcut for
CreateExpression(HxOperator.Abs, a)
.- See:
- See:
- Since:
5.5
- HxExpression Dist(HxExpression a, HxExpression b)¶
- HxExpression Dist(long a, HxExpression b)
- HxExpression Dist(double a, HxExpression b)
- HxExpression Dist(HxExpression a, long b)
- HxExpression Dist(HxExpression a, double b)
Creates a distance expression. This method is a shortcut for
CreateExpression(HxOperator.Dist, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Div(HxExpression a, HxExpression b)¶
- HxExpression Div(long a, HxExpression b)
- HxExpression Div(double a, HxExpression b)
- HxExpression Div(HxExpression a, long b)
- HxExpression Div(HxExpression a, double b)
Creates a division expression. This method is a shortcut for
CreateExpression(HxOperator.Div, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Mod(HxExpression a, HxExpression b)¶
- HxExpression Mod(long a, HxExpression b)
- HxExpression Mod(HxExpression a, long b)
Creates a modulo expression. This method is a shortcut for
CreateExpression(HxOperator.Mod, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Array()¶
- HxExpression Array(params HxExpression[] operands)
- HxExpression Array(params long[] operands)
- HxExpression Array(params double[] operands)
- HxExpression Array(IEnumerable<HxExpression> operands)
- HxExpression Array(IEnumerable<double> operands)
- HxExpression Array(IEnumerable<long> operands)
Creates a new array. This method behaves as a shortcut for
CreateExpression(HxOperator.Array, operands)
, but attempts to create an N-dimensional array in a recursive way: if an operand is iterable, it will be turned into an array too, and so on.Any object inheriting from IEnumerable is accepted. Thus, lists, tuples, sets and their comprehensions counterpart are accepted. It is also possible to use this method with a variadic number of arguments. Each operand can be an HxExpression, a boolean, an integer or a double.
- See:
- See:
- Since:
5.5
- HxExpression StepArray(HxExpression expr0, HxExpression expr1)¶
Creates a step array. This method is a shortcut for
CreateExpression(HxOperator.StepArray, operands)
.- See:
- See:
- Since:
13.0
- HxExpression At(HxExpression array, params HxExpression[] indices)¶
- HxExpression At(HxExpression array, params long[] indices)
- HxExpression At(HxExpression array, IEnumerable<HxExpression> indices)
- HxExpression At(HxExpression array, IEnumerable<long> indices)
Creates a “at” expression for N-dimensional array. This method is a shortcut for
CreateExpression(HxOperator.At, arrayExpr, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Scalar(HxExpression a, HxExpression b)¶
Creates an expression for the scalar product between two arrays. This method is a shortcut for
CreateExpression(HxOperator.Scalar, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Ceil(HxExpression a)¶
Creates a ceil expression. This method is a shortcut for
CreateExpression(HxOperator.Ceil, a)
.- See:
- See:
- Since:
5.5
- HxExpression Floor(HxExpression a)¶
Creates a floor expression. This method is a shortcut for
CreateExpression(HxOperator.Floor, a)
.- See:
- See:
- Since:
5.5
- HxExpression Round(HxExpression a)¶
Creates a rounding expression. This method is a shortcut for
CreateExpression(HxOperator.Round, a)
.- See:
- See:
- Since:
5.5
- HxExpression Sqrt(HxExpression a)¶
Creates a square root expression. This method is a shortcut for
CreateExpression(HxOperator.Sqrt, a)
.- See:
- See:
- Since:
5.5
- HxExpression Log(HxExpression a)¶
Creates a log expression. This method is a shortcut for
CreateExpression(HxOperator.Log, a)
.- See:
- See:
- Since:
5.5
- HxExpression Exp(HxExpression a)¶
Creates an exponential expression. This method is a shortcut for
CreateExpression(HxOperator.Exp, a)
.- See:
- See:
- Since:
5.5
- HxExpression Pow(HxExpression a, HxExpression b)¶
- HxExpression Pow(long a, HxExpression b)
- HxExpression Pow(double a, HxExpression b)
- HxExpression Pow(HxExpression a, long b)
- HxExpression Pow(HxExpression a, double b)
Creates a power expression. This method is a shortcut for
CreateExpression(HxOperator.Pow, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Cos(HxExpression a)¶
Creates a cosine expression. This method is a shortcut for
CreateExpression(HxOperator.Cos, a)
.- See:
- See:
- Since:
5.5
- HxExpression Sin(HxExpression a)¶
Creates a sine expression. This method is a shortcut for
CreateExpression(HxOperator.Sin, a)
.- See:
- See:
- Since:
5.5
- HxExpression Tan(HxExpression a)¶
Creates a tangent expression. This method is a shortcut for
CreateExpression(HxOperator.Tan, a)
.- See:
- See:
- Since:
5.5
- HxExpression Piecewise(HxExpression abscissae, HxExpression ordinates, HxExpression x)¶
Creates a piecewise linear expression. This method is a shortcut for
CreateExpression(HxOperator.Piecewise, expr, b, c)
.- See:
- See:
- Since:
5.5
- HxExpression Start(HxExpression a)¶
Creates a start expression. This method is a shortcut for
CreateExpression(HxOperator.Start, a)
.- See:
- See:
- Since:
12.0
- HxExpression End(HxExpression a)¶
Creates an end expression. This method is a shortcut for
CreateExpression(HxOperator.End, a)
.- See:
- See:
- Since:
12.0
- HxExpression Length(HxExpression a)¶
Creates a length expression. This method is a shortcut for
CreateExpression(HxOperator.Length, a)
.- See:
- See:
- Since:
12.0
- HxExpression Count(HxExpression a)¶
Creates a count expression. This method is a shortcut for
CreateExpression(HxOperator.Count, a)
.- See:
- See:
- Since:
5.5
- HxExpression IndexOf(HxExpression a, HxExpression val)¶
- HxExpression IndexOf(HxExpression a, long val)
Creates an indexOf expression. This method is a shortcut for
CreateExpression(HxOperator.IndexOf, a, b)
.- See:
- See:
- Since:
5.5
- HxExpression Distinct(HxExpression array)¶
- HxExpression Distinct(HxExpression it, HxExpression func)
Creates a distinct expression. This method is a shortcut for
CreateExpression(HxOperator.Distinct, operands)
.- See:
- See:
- Since:
12.5
- HxExpression Intersection(HxExpression expr0, HxExpression expr1)¶
Creates an intersection expression. This method is a shortcut for
CreateExpression(HxOperator.Intersection, operands)
.- See:
- See:
- Since:
12.5
- HxExpression Hull(params HxExpression[] operands)¶
- HxExpression Hull(HxExpression array)
- HxExpression Hull(IEnumerable<HxExpression> operands)
- HxExpression Hull()
Creates a hull expression. This method is a shortcut for
CreateExpression(HxOperator.hull, operands)
.- See:
- See:
- Since:
13.0
- HxExpression Contains(HxExpression expr, HxExpression val)¶
- HxExpression Contains(HxExpression expr, long val)
Creates a contains expression. This method is a shortcut for
CreateExpression(HxOperator.Contains, a, b)
.- See:
- See:
- Since:
7.5
- HxExpression Partition()¶
- HxExpression Partition(params HxExpression[] operands)
- HxExpression Partition(IEnumerable<HxExpression> operands)
Creates a partition expression. This method is a shortcut for
CreateExpression(HxOperator.Partition, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Disjoint()¶
- HxExpression Disjoint(params HxExpression[] operands)
- HxExpression Disjoint(IEnumerable<HxExpression> operands)
Creates a disjoint expression. This method is a shortcut for
CreateExpression(HxOperator.Disjoint, operands)
.- See:
- See:
- Since:
5.5
- HxExpression Cover()¶
- HxExpression Cover(params HxExpression[] operands)
- HxExpression Cover(IEnumerable<HxExpression> operands)
Creates a cover expression. This method is a shortcut for
CreateExpression(HxOperator.Cover, operands)
.- See:
- See:
- Since:
10.5
- HxExpression Find()¶
- HxExpression Find(HxExpression array, long val)
- HxExpression Find(HxExpression array, HxExpression val)
Creates a find expression. This method is a shortcut for
CreateExpression(HxOperator.Find, a, b)
.- See:
- See:
- Since:
10.5
- HxExpression Sort(HxExpression array)¶
Creates a sort expression. This method is a shortcut for
CreateExpression(HxOperator.Sort, array)
.The first operand must be an HxExpression representing a one-dimensional array containing integers or doubles.
- See:
- See:
- Since:
11.0
- HxExpression Sort(HxExpression array, HxExpression lambda)
Creates a sort expression. This method is a shortcut for
CreateExpression(HxOperator.Sort, array, lambda)
.The first operand must be an HxExpression representing a one-dimensional array containing integers or doubles. The second argument is optional and, if specified, must be an HxExpression with lambda function value.
- See:
- See:
- Since:
12.5
- HxExpression IntExternalFunction(HxIntExternalFunction function)¶
Creates an integer external function. This method is a shortcut for
CreateIntExternalFunction
.- See:
- See:
- Since:
9.5
- HxExpression DoubleExternalFunction(HxDoubleExternalFunction function)¶
Creates a double external function. This method is a shortcut for
CreateDoubleExternalFunction
.- See:
- See:
- Since:
9.5
- HxExpression IntArrayExternalFunction(HxIntArrayExternalFunction function)¶
Creates an integer array external function. This method is a shortcut for
CreateIntArrayExternalFunction
.- See:
- See:
- Since:
11.0
- HxExpression DoubleArrayExternalFunction(HxDoubleArrayExternalFunction function)¶
Creates a double array external function. This method is a shortcut for
CreateDoubleArrayExternalFunction
.- See:
- See:
- Since:
11.0
- HxExpression LambdaFunction(HxLambdaFunction0 functor)¶
- HxExpression LambdaFunction(HxLambdaFunction1 functor)
- HxExpression LambdaFunction(HxLambdaFunction2 functor)
- HxExpression LambdaFunction(HxLambdaFunction3 functor)
- HxExpression LambdaFunction(int nbArgs, HxLambdaFunction functor)
Creates a lambda function expression. This method is a shortcut for
CreateLambdaFunction(functor)
.- See:
- See:
- Since:
9.5
- HxExpression Call()¶
- HxExpression Call(HxExpression func)
- HxExpression Call(HxExpression func, params HxExpression[] arguments)
- HxExpression Call(HxExpression func, IEnumerable<HxExpression> arguments)
- HxExpression Call(params HxExpression[] operands)
- HxExpression Call(IEnumerable<HxExpression> operands)
Creates a call expression. The first operand must be an HxExpression of type
LambdaFunction
orExternalFunction
. The other operands may be HxExpressions, booleans, integers, and doubles. They are passed to the function as arguments. This method is a shortcut forCreateExpression(HxOperator.Call, operands)
.- See:
- See:
- Since:
6.0
- HxExpression Range(HxExpression a, HxExpression b)¶
- HxExpression Range(HxExpression a, long b)
- HxExpression Range(long a, HxExpression b)
- HxExpression Range(long a, long b)
Creates a range expression, where a is the lower bound (inclusive) and b is the upper bound (exclusive). This method is a shortcut for
CreateExpression(HxOperator.Range, a, b)
.- See:
- See:
- Since:
7.0
- string ToString()¶
Returns a string representation of this model. This representation provides: * The number of expressions, decisions, constraints, and objectives. * The density of the model.
Useful for debugging or logging purposes.
- Returns:
String representation.
- Return type:
string