Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
baol committed Oct 21, 2009
1 parent 9d7a258 commit 6fe70d7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion metslib/mets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include <cassert>
#include "mets.h"

//________________________________________________________________________
Expand Down Expand Up @@ -57,7 +58,11 @@ mets::invert_subsequence::apply(mets::feasible_solution& s)
int top = p1 < p2 ? (p2-p1+1) : (size+p2-p1+1);
for(int ii(0); ii!=top/2; ++ii)
{
sol.swap((p1+ii)%size, (p2-ii)%size);
int from = (p1+ii)%size;
int to = (size+p2-ii)%size;
assert(from >= 0 && from < size);
assert(to >= 0 && to < size);
sol.swap(from, to);
}
}

Expand Down

0 comments on commit 6fe70d7

Please sign in to comment.