Class: NoSE::Search::SpaceConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- NoSE::Search::SpaceConstraint
- Defined in:
- lib/nose/search/constraints.rb
Overview
The single constraint used to enforce a maximum storage cost
Class Method Summary collapse
-
.apply(problem) ⇒ Object
Add space constraint if needed.
Methods inherited from Constraint
Class Method Details
.apply(problem) ⇒ Object
Add space constraint if needed
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/nose/search/constraints.rb', line 40 def self.apply(problem) return unless problem.data[:max_space].finite? fail 'Space constraint not supported when grouping by ID graph' \ if problem.data[:by_id_graph] space = problem.total_size constr = MIPPeR::Constraint.new space, :<=, problem.data[:max_space] * 1.0, 'max_space' problem.model << constr end |