/** * Adds a new upper bounded constraint to the problem. The two array arguments must be the same * length, as their elements correspond to each other. Variables whose coefficients are zero * need not be mentioned. Variables that are mentioned must have previously been added via * {@link #addBooleanVariable(double)} or {@link #addDiscreteVariable(double[])}. The resulting * constraint has the form: <blockquote> <code>x<sub>i</sub> * a <= b</code> </blockquote> * where <code>x<sub>i</sub></code> represents the inference variables whose indexes are * contained in the array <code>i</code> and <code>*</code> represents dot product. * * @param i The indexes of the variables with non-zero coefficients. * @param a The coefficients of the variables with the given indexes. * @param b The upper bound for the new constraint. **/ public void addLessThanConstraint(int[] i, double[] a, double b) { addConstraint(i, a, b, GRB.LESS_EQUAL); }
/** * Adds a new lower bounded constraint to the problem. The two array arguments must be the same * length, as their elements correspond to each other. Variables whose coefficients are zero * need not be mentioned. Variables that are mentioned must have previously been added via * {@link #addBooleanVariable(double)} or {@link #addDiscreteVariable(double[])}. The resulting * constraint has the form: <blockquote> <code>x<sub>i</sub> * a >= b</code> </blockquote> * where <code>x<sub>i</sub></code> represents the inference variables whose indexes are * contained in the array <code>i</code> and <code>*</code> represents dot product. * * @param i The indexes of the variables with non-zero coefficients. * @param a The coefficients of the variables with the given indexes. * @param b The lower bound for the new constraint. **/ public void addGreaterThanConstraint(int[] i, double[] a, double b) { addConstraint(i, a, b, GRB.GREATER_EQUAL); }
/** * Adds a new fixed constraint to the problem. The two array arguments must be the same length, * as their elements correspond to each other. Variables whose coefficients are zero need not be * mentioned. Variables that are mentioned must have previously been added via * {@link #addBooleanVariable(double)} or {@link #addDiscreteVariable(double[])}. The resulting * constraint has the form: <blockquote> <code>x<sub>i</sub> * a = b</code> </blockquote> where * <code>x<sub>i</sub></code> represents the inference variables whose indexes are contained in * the array <code>i</code> and <code>*</code> represents dot product. * * @param i The indexes of the variables with non-zero coefficients. * @param a The coefficients of the variables with the given indexes. * @param b The new constraint will enforce equality with this constant. **/ public void addEqualityConstraint(int[] i, double[] a, double b) { addConstraint(i, a, b, GRB.EQUAL); }
/** * Adds a new fixed constraint to the problem. The two array arguments must be the same length, * as their elements correspond to each other. Variables whose coefficients are zero need not be * mentioned. Variables that are mentioned must have previously been added via * {@link #addBooleanVariable(double)} or {@link #addDiscreteVariable(double[])}. The resulting * constraint has the form: <blockquote> <code>x<sub>i</sub> * a = b</code> </blockquote> where * <code>x<sub>i</sub></code> represents the inference variables whose indexes are contained in * the array <code>i</code> and <code>*</code> represents dot product. * * @param i The indexes of the variables with non-zero coefficients. * @param a The coefficients of the variables with the given indexes. * @param b The new constraint will enforce equality with this constant. **/ public void addEqualityConstraint(int[] i, double[] a, double b) { addConstraint(i, a, b, GRB.EQUAL); }
/** * Adds a new upper bounded constraint to the problem. The two array arguments must be the same * length, as their elements correspond to each other. Variables whose coefficients are zero * need not be mentioned. Variables that are mentioned must have previously been added via * {@link #addBooleanVariable(double)} or {@link #addDiscreteVariable(double[])}. The resulting * constraint has the form: <blockquote> <code>x<sub>i</sub> * a <= b</code> </blockquote> * where <code>x<sub>i</sub></code> represents the inference variables whose indexes are * contained in the array <code>i</code> and <code>*</code> represents dot product. * * @param i The indexes of the variables with non-zero coefficients. * @param a The coefficients of the variables with the given indexes. * @param b The upper bound for the new constraint. **/ public void addLessThanConstraint(int[] i, double[] a, double b) { addConstraint(i, a, b, GRB.LESS_EQUAL); }
/** * Adds a new lower bounded constraint to the problem. The two array arguments must be the same * length, as their elements correspond to each other. Variables whose coefficients are zero * need not be mentioned. Variables that are mentioned must have previously been added via * {@link #addBooleanVariable(double)} or {@link #addDiscreteVariable(double[])}. The resulting * constraint has the form: <blockquote> <code>x<sub>i</sub> * a >= b</code> </blockquote> * where <code>x<sub>i</sub></code> represents the inference variables whose indexes are * contained in the array <code>i</code> and <code>*</code> represents dot product. * * @param i The indexes of the variables with non-zero coefficients. * @param a The coefficients of the variables with the given indexes. * @param b The lower bound for the new constraint. **/ public void addGreaterThanConstraint(int[] i, double[] a, double b) { addConstraint(i, a, b, GRB.GREATER_EQUAL); }