dynadec.com

dynadec user support forums
It is currently Wed Sep 08, 2010 5:12 pm

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: DisequationSystem<LS>
PostPosted: Thu May 07, 2009 9:29 pm 
Offline

Joined: Tue Nov 25, 2008 12:07 pm
Posts: 98
Location: Glasgow, Scotland
Hi,

Is the DisequationSystem<LS> still intended for general use? I notice it's disappeared from the list of classes in the documentation. It implements the methods from the Constraint<LS> interface as well as some other methods which appear like integer versions of the Constraint<LS> differentiation methods igetAssignDelta etc. The igetSwapDelta is especially strange as it has three arguments as opposed to the conventional two for the variables being swapped.

The main reason for the interest is the Comet Book (p.111) indicates that DisequationSystems are a more efficient way of storing series of disequations allowing constant time differentiation. The memory usage and time to close the Solver<LS> in my Disequation based model is significantly better than in an equivalent ConstraintSystem<LS> model.

The main problem I've hit is that in terms of differentiation it appears only the getAssignDelta works properly, the getSwapDelta and the getAssignDelta(var{int}[], int[]) both crash reporting an internal error. I've included an example, uncomment the differentiation calls to reproduce the errors.
Code:
import cotls;

Solver<LS> m();
var{int} array[i in 1..10](m, 1..10) := 5;
DisequationSystem<LS> D(array);
forall(i in 1..10, j in 1..10: j > i+1){
   D.post(array[i],array[j]);
}
D.close();
var{int} violations = D.violations();
m.close();
cout << array << endl;
cout << violations << endl;
cout << D.getAssignDelta(array[5],4) << endl;
array[5] := 4;
cout << violations << endl;

//cout << D.getSwapDelta(array[5], array[4]) << endl;
array[5] :=: array[4];
cout << violations << endl;

var{int} variables[0..1] = [array[1], array[2]];
int values[0..1] = [8, 6];
//cout << D.getAssignDelta(variables, values) << endl;
array[1] := 8;
array[2] := 6;
cout << violations << endl;


Thanks,
Alastair


Top
 Profile E-mail  
 
 Post subject: Re: DisequationSystem<LS>
PostPosted: Thu Aug 06, 2009 1:50 pm 
Offline

Joined: Tue Nov 18, 2008 12:13 pm
Posts: 68
I'll see what we can do for this. But it will be for 2.1 (not the upcoming final 2.0)

_________________
Laurent


Top
 Profile E-mail  
 
 Post subject: Re: DisequationSystem<LS>
PostPosted: Tue Feb 23, 2010 11:03 am 
Offline

Joined: Tue Nov 25, 2008 12:07 pm
Posts: 98
Location: Glasgow, Scotland
As of 2.0.1 the getSwap(var{int},var{int}) and getAssignDelta(var{int}[],int[]) seem to work fine, the getSwap(var{int},var{int},var{int},var{int}) and getAssign(var{int},int,var{int},int) still cause Internal Errors. This isn't such a problem because you can emulate their behaviour using the getAssignDelta(var{int}[],int[]).

Another bug I've found which causes a library exception: [DisequationSystem: Unknown Variable] is if you try to differentiate a variable which isn't part of the DisequationSystem. This is at odds with the way other classes (thinking primarily of ConstraintSystems) behave. They simply return a delta of 0 and don't cause an error.
Code:
import cotls;

range r = 1..5;
Solver<LS> ls();
var{int} x[i in r](ls, r) := 2;
var{int} y(ls, r) := 1;
DisequationSystem<LS> D(x);
ConstraintSystem<LS> S(ls);
forall(i in r, j in r: j > i){
   D.post(x[i],x[j]);
   S.post(x[i] != x[j]);
}
D.close();
S.close();
ls.close();

cout << D.getAssignDelta(x[1], 4) << endl;
var{int} vars[1..2] = [x[1],x[2]];
int vals[1..2] = [4,5];
cout << D.getAssignDelta(vars,vals) << endl;
cout << D.getSwapDelta(x[1],x[2]) << endl;

// These will crash Comet
//cout << D.getAssignDelta(x[1], 4, x[2], 5) << endl;
//cout << D.getSwapDelta(x[1],x[2],x[3],x[4]) << endl;

cout << S.getAssignDelta(y,2) << endl;
//cout << D.getAssignDelta(y, 2) << endl;


Cheers,
Alastair


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group