Showing
2 changed files
with
19 additions
and
19 deletions
... | @@ -276,25 +276,6 @@ SecondaryStructure MOIP::solve_objective(int o, double min, double max) | ... | @@ -276,25 +276,6 @@ SecondaryStructure MOIP::solve_objective(int o, double min, double max) |
276 | 276 | ||
277 | void MOIP::define_problem_constraints(void) | 277 | void MOIP::define_problem_constraints(void) |
278 | { | 278 | { |
279 | - // Force basepairs between the end of a component and the beginning of the next | ||
280 | - if (verbose_) cout << "\t>forcing basepairs between bounds of inserted components..." << endl; | ||
281 | - for (size_t i = 0; i < insertion_sites_.size(); i++) { | ||
282 | - Motif& x = insertion_sites_[i]; | ||
283 | - IloExpr c6p = IloExpr(env_); | ||
284 | - if (allowed_basepair(x.comp[0].pos.first, x.comp.back().pos.second)) | ||
285 | - c6p += y(x.comp[0].pos.first, x.comp.back().pos.second); | ||
286 | - if (verbose_) cout << "\t\t" << (C(i, 0) <= c6p) << endl; | ||
287 | - model_.add(C(i, 0) <= c6p); | ||
288 | - if (x.comp.size() == 1) // This constraint is for multi-component motives. | ||
289 | - continue; | ||
290 | - for (size_t j = 0; j < x.comp.size() - 1; j++) { | ||
291 | - IloExpr c6 = IloExpr(env_); | ||
292 | - if (allowed_basepair(x.comp[j].pos.second, x.comp[j + 1].pos.first)) | ||
293 | - c6 += y(x.comp[j].pos.second, x.comp[j + 1].pos.first); | ||
294 | - model_.add(C(i, j) <= c6); | ||
295 | - if (verbose_) cout << "\t\t" << (C(i, j) <= c6) << endl; | ||
296 | - } | ||
297 | - } | ||
298 | 279 | ||
299 | // ensure there only is 0 or 1 pairing by nucleotide: | 280 | // ensure there only is 0 or 1 pairing by nucleotide: |
300 | if (verbose_) cout << "\t>ensuring there are at most 1 pairing by nucleotide..." << endl; | 281 | if (verbose_) cout << "\t>ensuring there are at most 1 pairing by nucleotide..." << endl; |
... | @@ -391,6 +372,25 @@ void MOIP::define_problem_constraints(void) | ... | @@ -391,6 +372,25 @@ void MOIP::define_problem_constraints(void) |
391 | model_.add(c5 == jm1 * C(i, 0)); | 372 | model_.add(c5 == jm1 * C(i, 0)); |
392 | if (verbose_) cout << "\t\t>motif " << i << " : " << (c5 == jm1 * C(i, 0)) << endl; | 373 | if (verbose_) cout << "\t\t>motif " << i << " : " << (c5 == jm1 * C(i, 0)) << endl; |
393 | } | 374 | } |
375 | + // Force basepairs between the end of a component and the beginning of the next | ||
376 | + if (verbose_) cout << "\t>forcing basepairs between bounds of inserted components..." << endl; | ||
377 | + for (size_t i = 0; i < insertion_sites_.size(); i++) { | ||
378 | + Motif& x = insertion_sites_[i]; | ||
379 | + IloExpr c6p = IloExpr(env_); | ||
380 | + if (allowed_basepair(x.comp[0].pos.first, x.comp.back().pos.second)) | ||
381 | + c6p += y(x.comp[0].pos.first, x.comp.back().pos.second); | ||
382 | + if (verbose_) cout << "\t\t" << (C(i, 0) <= c6p) << endl; | ||
383 | + model_.add(C(i, 0) <= c6p); | ||
384 | + if (x.comp.size() == 1) // This constraint is for multi-component motives. | ||
385 | + continue; | ||
386 | + for (size_t j = 0; j < x.comp.size() - 1; j++) { | ||
387 | + IloExpr c6 = IloExpr(env_); | ||
388 | + if (allowed_basepair(x.comp[j].pos.second, x.comp[j + 1].pos.first)) | ||
389 | + c6 += y(x.comp[j].pos.second, x.comp[j + 1].pos.first); | ||
390 | + model_.add(C(i, j) <= c6); | ||
391 | + if (verbose_) cout << "\t\t" << (C(i, j) <= c6) << endl; | ||
392 | + } | ||
393 | + } | ||
394 | // Forbid pseudoknots | 394 | // Forbid pseudoknots |
395 | if (!this->allow_pk_) { | 395 | if (!this->allow_pk_) { |
396 | if (verbose_) cout << "\t>forbidding pseudoknots..." << endl; | 396 | if (verbose_) cout << "\t>forbidding pseudoknots..." << endl; | ... | ... |
example_data/pseudoknots.dbn
0 → 100644
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment