Beispiel #1
0
def build_linear_constraint():
    """Build a linear_constraint with no references to external
    objects so its size can be computed."""
    return linear_constraint(variables=build_linear_constraint.xlist,
                             coefficients=build_linear_constraint.clist,
                             lb=0,
                             ub=1)
Beispiel #2
0
def build_linear_constraint_list():
    """Build a constraint_list of linear_constraints with no references to external
    objects so its size can be computed."""
    return constraint_list(
        linear_constraint(variables=(X_kernel[A_indices[p]] for p in range(A_indptr[i], A_indptr[i+1])),
                          coefficients=(A_data[p] for p in range(A_indptr[i], A_indptr[i+1])),
                          rhs=1)
        for i in range(N))
Beispiel #3
0
    def _generate_model(self):
        self.model = pmo.block()
        model = self.model
        model._name = self.description

        model.x = pmo.variable(domain=NonNegativeReals)
        model.obj = pmo.objective(0.0)
        model.con = pmo.linear_constraint(terms=[(model.x, 1.0)], rhs=1.0)
Beispiel #4
0
    def _generate_model(self):
        self.model = pmo.block()
        model = self.model
        model._name = self.description

        model.x = pmo.variable(domain=NonNegativeReals)
        model.obj = pmo.objective(0.0)
        model.con = pmo.linear_constraint(terms=[(model.x,1.0)],
                                          rhs=1.0)
Beispiel #5
0
def build_linear_constraint():
    """Build a linear_constraint with no references to external
    objects so its size can be computed."""
    return linear_constraint(variables=build_linear_constraint.xlist,
                             coefficients=build_linear_constraint.clist,
                             lb=0, ub=1)