I want to do a bubble sort on a two-dimensional set, but to do so means swapping the index position of elements of the set and that means referencing specific members of the set, which is what I’m having problems with. To illustrate the issues consider the following.
ampl: delete B;
ampl: delete A;
ampl: set A;
ampl: set B {A};
ampl: let A := {1,2};
ampl: let B[1] := {3,4};
ampl: let B[2] := {5,6};
ampl: display B;
set B[1] := 3 4;
set B[2] := 5 6;
How do you refer to item B[2,4] or 6? Do we have to define these as ordered sets? Even then I’m unclear how to assign a specific member a value in an ordered set. In this case we have:
ampl: set A ordered;
ampl: set B {A} ordered;;
ampl: let A := {1,2};
ampl: let B[1] := {3,4};
ampl: let B[2] := {5,6};
ampl: display member(2,B[2]);
member(2, B[2]) = 6
But I still cannot specifically change this items value using any of these function that return values from ordered sets:
ampl: let member(2,B[2]) := 7;
syntax error
context: let >>> member( <<< 2,B[2]) := 7;
I expect that I’m missing something here, but if not how would one implement, say, a bubble sort on a set (as opposed to parameter vectors) where I have to reassign the value of one element in the set to the position of another element?
Thanks in Advance,
Martin
Martin Smith
Managing Director
Mine Smith Pty Ltd
Phone: +61 (4) 0395 5332
Email: msm...@minesmith.com.au