[gecode-users] Re: Waiting for stability
Christian Schulte
schulte at imit.kth.se
Fri Jun 16 02:13:01 CEST 2006
Please, don't use LinExpr as this is really something that is only to be
used for modelling. A much simpler interface is to first create arrays of
integer ceofficients and variables and then post a linear constraint on
them.
Christian
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Luis Quesada
Sent: Thursday, June 15, 2006 3:02 PM
To: users at gecode.org
Subject: [gecode-users] Re: Waiting for stability
Dear all,
I am trying to use LinExpr in order to implement a (naive) order
propagator for graph variables.
Is the following use of LinExpr correct?
template <class SPACE>
LinExpr
graph_order(SPACE* space, OutAdjSetsGraphView g){
OutAdjSetsGraphView::LubNodeIterator g_ub = g.iter_nodes_UB();
LinExpr Sum(IntVar(space,0,0));
for (;g_ub();++g_ub){
int n=g_ub.val();
BoolVar a(space,0,1);
dom(space, g.nodes, SRT_SUP, n, a);
LinExpr BoolVarLinExpr(a);
Sum=LinExpr(Sum,BoolVarLinExpr,1);
}
return Sum;
}
In order to post the constraint, what I am doing is the following:
LinExpr SumBoolVars(graph_order(this,fg));
LinRel Order(SumBoolVars,IRT_LQ,fg_lubOrder);
Order.post(this,true,ICL_DOM);
Where fg_lubOrde is an integer.
However, it seems I am doing something wrong since there is no
propagation taking place.
Thanks in advance for your answer,
Luis
_______________________________________________
Gecode users mailing list
users at gecode.org https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list