input
stringlengths
10
828
output
stringlengths
5
107
public void propagate sup event int evt cause throws contradiction exception abstract var v get modified var partially stored vector constraints v get constraint vector partially stored int vector indices v get index vector for int iterator cit constraints get index iterator cit has next int idx cit next if idx evt cause real listener c real listener constraints get idx if c is active int i indices get idx c awake on sup i
propagates the update to the upper bound
public void propagate inf event int evt cause throws contradiction exception abstract var v get modified var partially stored vector constraints v get constraint vector partially stored int vector indices v get index vector for int iterator cit constraints get index iterator cit has next int idx cit next if idx evt cause real listener c real listener constraints get idx if c is active int i indices get idx c awake on inf i
propagates the update to the lower bound
public void propagate bounds event int evt cause throws contradiction exception abstract var v get modified var partially stored vector constraints v get constraint vector partially stored int vector indices v get index vector for int iterator cit constraints get index iterator cit has next int idx cit next if idx evt cause real listener c real listener constraints get idx if c is active int i indices get idx c awake on inf i c awake on sup i
propagates the update to the domain lower and upper bounds
public object clone throws clone not supported exception abstract large real constraint newc abstract large real constraint super clone newc vars new real var this vars length system arraycopy this vars 0 newc vars 0 this vars length c indices new int this c indices length system arraycopy this c indices 0 newc c indices 0 this c indices length return newc
makes a copy of this constraint
public void set constraint index final int i final int idx if i 0 i vars length c indices i idx else throw new error bug in set constraint index i i this this
sets this constraint index according to the variable i
public int get constraint idx final int i if i 0 i vars length return c indices i else return 1
returns this constraint index according to the variable i
public int get nb vars return vars length
returns the number of variables
public var get var final int i if 0 i i vars length return vars i return null
returns the variable with the index i
public void set var final int i final var v if v instanceof real var if i 0 i vars length this vars i real var v else throw new error bug in csp network management too large index for set var else throw new error bug in csp network management wrong type of var for set var
sets a variable involved by the constraint
public real var get real var final int i if 0 i i vars length return vars i return null
returns the variable with the index i
public int get real var nb return vars length
returns the number of real variables
public boolean is completely instantiated todo return false
checks if the constrait is completely instantiated
public int get self index todo return 0
returns the index associated with this constraint by the problem
public real var get real var int i if i 0 return v0 else return null
returns the only one variable if i 0 null otherwise
public int get real var nb return 1
returns the number of real variables
public int get constraint idx int idx if idx 0 return c idx0 else return 1
returns the index of this constraints in all constraints involving v0
public int get nb vars return 1
returns the number of variables
public var get var int i if i 0 return v0 else return null
returns the only one variable v0 if i 0 null otherwise
public boolean is completely instantiated return v0 is instantiated
checks if the only one variable of the constraint is instantiated
public real var make real var string name double inf double sup return problem make real var name inf sup
builds an interval variable
public constraint make equation real exp exp real interval constant cst collect the variables set collected vars new hash set exp collect vars collected vars real var tmp vars new real var 0 tmp vars real var collected vars to array tmp vars return new equation problem tmp vars exp cst
makes an equation from an expression and a constantt interval
public real exp plus real exp exp1 real exp exp2 return new real plus problem exp1 exp2
addition of two expressions
public real exp minus real exp exp1 real exp exp2 return new real minus problem exp1 exp2
substraction of two expressions
public real exp mult real exp exp1 real exp exp2 return new real mult problem exp1 exp2
multiplication of two expressions
public void end tree search for int i 0 i limits size i abstract global search limit lim abstract global search limit limits get i lim reset false pop trace until base world problem world pop until base world
called before a new search tree is explored
public real exp power real exp exp int power return new real integer power problem exp power
power of an expression
public real exp cos real exp exp return new real cos problem exp
cosinus of an expression
public real exp sin real exp exp return new real sin problem exp
sinus of an expression
public void set bound double objval get objective value if do maximize lower bound math max lower bound objval else upper bound math min upper bound objval
resetting the optimization bounds
public real interval constant cst double a double b return new real interval constant a b
makes a constant interval between two doubles a b
public boolean update sup int x int idx throws contradiction exception if update sup x int cause var event nocause if get sup x cause idx if get inf get sup instantiate get sup cause else problem get propagation engine post update sup variable cause return true else return false
internal var update on the variable upper bound caused by its i th
public int get coefficient int index return coefficients index
retrieve the i th coefficient
public int var get variable int index return variables index
retrieve the i th variable
public void set coefficient int index int coef coefficients index coef
sets the i th coefficient
public void set variable int index int var var variables index var
sets the i th variable
public int get size return nb vars
returns the term capacity
protected boolean update sup int x throws contradiction exception if x get sup if x get inf if x istate int minint throw new contradiction exception this else update sup x return true else return false
improving the upper bound
public int get constant return constant
returns the integer constant involved in the linear term
public void set constant int constant this constant constant
sets the integer constant involved in the linear term
protected boolean remove val int x throws contradiction exception int infv get inf supv get sup if infv x x supv if x infv update inf x 1 if get inf supv instantiate supv return true else if x supv update sup x 1 if get sup infv instantiate infv return true else return remove x else return false
removing a value from the domain of a variable
public int get event type return event type return bit set get heavier bit event type
retrieves the event type
public void set event type int evt type event type bit set set bit event type evt type with bit codes incinf 0 decsup 1 remval 2 remmanyvals 3 instint 4
records the event type
public void clear this event type emptyevent cause noevent get int var get domain clear delta domain
clears the var delegates to the basic events
public int iterator get event iterator return get int var get domain get delta iterator
returns an iterator over the set of removed values
public void propagate inst event int evt cause throws contradiction exception abstract var v get modified var partially stored vector constraints v get constraint vector partially stored int vector indices v get index vector for int iterator cit constraints get index iterator cit has next int idx cit next if idx evt cause int constraint c int constraint constraints get idx if c is active int i indices get idx c awake on inst i
propagates the instantiation event
public void propagate sup event int evt cause throws contradiction exception abstract var v get modified var partially stored vector constraints v get constraint vector partially stored int vector indices v get index vector for int iterator cit constraints get index iterator cit has next int idx cit next if idx evt cause int constraint c int constraint constraints get idx if c is active int i indices get idx c awake on sup i
propagates the update to the upper bound
public void propagate inf event int evt cause throws contradiction exception abstract var v get modified var partially stored vector constraints v get constraint vector partially stored int vector indices v get index vector for int iterator cit constraints get index iterator cit has next int idx cit next if idx evt cause int constraint c int constraint constraints get idx if c is active int i indices get idx c awake on inf i
propagates the update to the lower bound
public void propagate bounds event int evt cause throws contradiction exception abstract var v get modified var partially stored vector constraints v get constraint vector partially stored int vector indices v get index vector for int iterator cit constraints get index iterator cit has next int idx cit next if idx evt cause int constraint c int constraint constraints get idx if c is active int i indices get idx c awake on bounds i
propagates the update to the domain lower and upper bounds
public int get self index abstract problem pb get problem for int i 0 i pb get nb int constraints i constraint c pb get int constraint i if c this return i return 1
returns the global index of the constraint among all constraints of the problem
public object clone throws clone not supported exception int lin comb newc int lin comb super clone newc init this coeffs return newc
builds a copy of this contraint
public void init final int lcoeffs this coeffs new int lcoeffs length system arraycopy lcoeffs 0 this coeffs 0 lcoeffs length
initializes the constraint by copying the coefficent array
public void propagate throws contradiction exception filter true 2
launchs the filtering algorithm
public void awake on var final int idx throws contradiction exception
generic propagation when a variable is modified
public void awake on inf final int idx throws contradiction exception if idx nb pos vars filter true 1 else filter false 1
propagation whenever the lower bound of a variable is modified
public void set constraint index final int i final int val if i 0 c idx0 val else if i 1 c idx1 val else if i 2 c idx2 val else throw new error bug in set constraint index i i this this
let v be the i th var of c
public void awake on sup final int idx throws contradiction exception if idx nb pos vars filter false 1 else filter true 1
propagation whenever the upper bound of a variable is modified
public int get constraint idx final int idx if idx 0 return c idx0 else if idx 1 return c idx1 else if idx 2 return c idx2 else return 1
returns the index of the constraint in the specified variable
public var get var final int i if i 0 return v0 else if i 1 return v1 else if i 2 return v2 else return null
gets the specified variable
public void set var final int i final var v if v instanceof int domain var if i 0 this v0 int domain var v else if i 1 this v1 int domain var v else if i 2 this v2 int domain var v else throw new error bug in csp network management too large index for set var else throw new error bug in csp network management wrong type of var for set var
sets the association between variable and index of this variable
public void propagate throws contradiction exception awake on var 0 awake on var 1 awake on var 2
propagation for the constraint awake var
public int domain var get int var final int i if i 0 return v0 else if i 1 return v1 else if i 2 return v2 else return null
gets the code i code th search valued variable
public boolean is entailed if op eq int a compute lower bound int b compute upper bound if b 0 a 0 return boolean false else if a 0 b 0 return boolean true else return null else if op geq if compute upper bound 0 return boolean false else if compute lower bound 0 return boolean true else return null else assert op neq int a compute lower bound if a 0 return boolean true else int b compute upper bound if b 0 return boolean true else if b 0 a 0 return boolean false else return null
checks if the constraint is entailed
public boolean is satisfied int s cste int nb vars get nb vars int i for i 0 i nb vars i s vars i get val coeffs i if op eq return s 0 else if op geq return s 0 else assert op neq return s 0
checks if the constraint is satisfied when all variables are instantiated
protected void awake on x throws contradiction exception if v2 is instantiated to 0 v0 can be instantiated to 0 v1 instantiate 0 c idx1 else if v2 can be instantiated to 0 update yand x else if v2 is instantiated to 0 shave on yand x if v2 is instantiated to 0 v2 update inf get zmin c idx2 v2 update sup get zmax c idx2
reaction when x v0 is updated
protected int compute upper bound int s cste int nb vars get nb vars int i for i 0 i nb pos vars i s vars i get sup coeffs i for i nb pos vars i nb vars i s vars i get inf coeffs i if logger is loggable level finest logger finest ub for to string s return s
computes an upper bound estimate of a linear combination of variables
public void awake on inst int idx throws contradiction exception assert idx 0 if logger is loggable level finest logger finest val v0 to string this cste if v0 get val this cste v0 wipe out
when the one and only variable of the constraint becomes instantiated
protected int compute lower bound int s cste int nb vars get nb vars int i for i 0 i nb pos vars i s vars i get inf coeffs i for i nb pos vars i nb vars i s vars i get sup coeffs i if logger is loggable level finest logger finest lb for to string s return s
computes a lower bound estimate of a linear combination of variables
public int get first val var x return int domain var x get inf
accessing the index of the first branch for variable x
public int get best val int domain var x return x get next domain value x get inf x get sup x get inf 2
selecting a value in the middle of the domain
public boolean is consistent int ub compute upper bound int lb compute lower bound int nb vars get nb vars if op eq return has consistent lower bound has consistent upper bound else if op geq return has consistent upper bound return true
tests if the constraint is consistent
public abstract var select var return abstract var select int var
the ivar selector can be asked to return a variable
public int get first val var x return int domain var x get sup
accessing the index of the first branch for variable x
protected boolean has consistent lower bound int lb compute lower bound int nb vars get nb vars if lb 0 return false else for int i 0 i nb pos vars i int new supi arithm div floor lb coeffs i vars i get inf if vars i get sup new supi return false for int i nb pos vars i nb vars i int new infi arithm div ceil lb coeffs i vars i get sup if vars i get inf new infi return false return true
tests if the constraint is consistent
protected boolean has consistent upper bound int ub compute upper bound int nb vars get nb vars if ub 0 return false else for int i 0 i nb pos vars i int new infi arithm div ceil ub coeffs i vars i get sup if vars i get inf new infi return false for int i nb pos vars i nb vars i int new supi arithm div floor ub coeffs i vars i get inf if vars i get sup new supi return false return true
tests if the constraint is consistent
public abstract constraint opposite abstract problem pb get problem int exp term pb scalar coeffs vars if op eq return abstract constraint pb neq term cste else if op neq return abstract constraint pb eq term cste else if op geq return abstract constraint pb lt term cste else return null
computes the opposite of this constraint
public string pretty string lin comb for int i 0 i coeffs length 1 i lin comb coeffs i vars i lin comb coeffs coeffs length 1 vars coeffs length 1 if op 0 lin comb else if op 1 lin comb else if op 2 lin comb lin comb cste return lin comb
pretty print for this constraint
public int get value int var index return int var values var index
accessor to the value of a variable in a solution
public void erase constraint constraint c constraints remove c this nb constraint
removes permanently a constraint from the overall list of constraints of the problem
public void world pop environment world pop propagation engine flush events
pushing one world on the stack
public void print runtime satistics this get solver get search solver print runtime statistics
displays all the runtime statistics
public void propagate zero throws contradiction exception if v1 can be instantiated to 0 v0 instantiate 0 c idx0 if v0 can be instantiated to 0 v1 instantiate 0 c idx1
propagate the fact that v2 z is instantiated to 0
protected boolean update x throws contradiction exception boolean inf change v0 update inf get xmin if non zero c idx0 boolean sup change v0 update sup get xmax if non zero c idx0 return inf change sup change
updating x and y when z cannot be 0
private string get bundle name ifile manifest file throws exception manifest manifest new manifest manifest file get contents string bundle name manifest get main attributes get value bundle symbolic name int index bundle name index of bundle name bundle name substring 0 index return bundle name
extracts the symbolic name of a bundle from the manifest
protected void create edit policies super create edit policies install edit policy edit policy node role null install edit policy edit policy graphical node role null install edit policy edit policy selection feedback role null install edit policy edit policy component role new root component edit policy if get content pane get layout manager instanceof xylayout install edit policy edit policy layout role new model xylayout edit policy xylayout get content pane get layout manager install edit policy snap feedback new snap feedback policy non nls 1
installs edit policies specific to this
protected ifigure create figure figure f new model layer f set border new group box border diagram f set layout manager layout f set layout manager new flow layout f set border new margin border 5 return f
returns a figure to represent this
protected gems figure get gems figure return gems figure get figure
returns the figure of this as a node type figure
protected void refresh visuals point loc get node get location dimension size get node get size if loc null size null loc new point 0 0 size new dimension 50 50 rectangle r new rectangle loc size if get figure null get figure get parent null get figure get parent get layout manager instanceof freeform layout graphical edit part get parent set layout constraint this get figure r
updates the visual aspect of this
private list collapse rects list collect rect int inflate if collect rect size 0 return new linked list rectangle r compare new rectangle rectangle collect rect remove 0 list collapsed rects collapse rects r compare collect rect inflate collapsed rects add r compare return collapsed rects
this method will collapse all the rectangles together that intersect in
public boolean is avoiding obstructions connection conn return true
determines whether the router is going to avoid obstructions during the
public boolean is closest distance connection conn return true
determines whether the router is going use the closest distance during the
protected boolean is reorienting connection conn if conn get source anchor get owner null conn get target anchor get owner null return true return false
check if this connection is currently being reoriented by seeing if the
public void route bendpoints connection conn if conn get source anchor null conn get target anchor null return point list points new point list if is avoiding obstructions conn points router helper get instance route around obstructions conn else if is closest distance conn points router helper get instance route closest distance conn else points router helper get instance route from constraint conn route line conn 0 points conn set points points
route the connection accordingly to the router paradigm
private ifigure find container figure ifigure fig if fig null return null if fig get layout manager instanceof xylayout return fig return find container figure fig get parent
find container figure recursive method to find the figure that owns the
private void remove self rel connection connection conn if conn get source anchor null conn get target anchor null conn get source anchor get owner null conn get target anchor get owner null return array list key connection key new array list key conn array list connection list self rel connections get connection key if connection list null int index connection list index of conn if index 1 return self rel connections remove connection key conn
method remove self rel connection
static public boolean normalize segments point list points return normalize segments points 0
normalizes the line segments in the polyline
static public point get points supremum point list points point the supremum points get first point for int i 1 i points size i point other points get point i the supremum new point math max the supremum x other x math max the supremum y other y return the supremum
method get points supremum
public void set constraint connection connection object constraint super set constraint connection constraint router helper get instance set constraint connection constraint
sets the constraint for the given
static public point get points infimum point list points point the infimum points get first point for int i 1 i points size i point other points get point i the infimum new point math min the infimum x other x math min the infimum y other y return the infimum
method get points supremum
public mark create mark token tokens mark mark new mark get auto id plain text for int i 0 i tokens length i mark add token tokens i marks add mark return mark
creates a new mark around the given consecutive tokens
public mark create mark word composition wc return create mark wc get tokens
creates a new mark containing the specified word composition