this repo has no description
at develop 2.3 kB view raw
11. Calling solve with timer and solver (done) 2 3 For simplicity, default solver must be set in minizinc.py 4 It's easier and clearer to change the default solver to be used: 5 In minizinc.py, class Model, there are 3 lines: 6 def satisfy(self, ann = None, data = None, solver = default_solver, time = 0) 7 def maximize(self, expr, ann = None, data = None, solver = default_solver, time = 0) 8 def minimize(self, expr, ann = None, data = None, solver = default_solver, time = 0): 9 10 To change the default solver to, say Gecode, we change the line 11 solver = default_solver 12 to 13 solver = 'gecode' 14 15 16 NOTE: to pass the responsibility of specifying the default solver to C++ files: 17 in minizinc.py: change solver = default_solver --> solver = '' 18 in Model.h: change default_solver = SC_UNKNOWN 19 -> default_solver = SC_GECODE 20 212. Updated arguments type checking: 22 A type of None indicates that it accepts any possible type 23 24 XXX: what if users enter a list or tuple to that position of None? 25 XXX: Python Interface type checking is getting really clumpsy and expensive now 26 27---------------------------------------- 28 293. Internal variable name declaration is now removed: 30 Sets, Variables and Arrays are previously assigned with an internal name when created (this is the memory address of the objects) 31 Users can change the objects' name during declaring phase: 32 instead of: 33 a = model.Variable(1,10) 34 we use: 35 a = model.Variable(1,10,'a') 36 and the object <a> will have internal name 'a' 37 As we don't care about the internal names, this turns out to be useless and thus is now removed 38 394. Changes to minizinc_internal Set initialization: 40 Is now minizinc_internal.Set( [1,5], 7, [10,15] ) 41 instead of minizinc_internal.Set( ([1,5], 7, [10,15]) ) 42 435. Set is now model independent and can be reused across multiple models 44 Set.model = None 45 466. Introducing Model.Range: 47 Model.Range accepts up to 2 arguments: 48 ub: returns a MiniZinc Set from 0 to ub - 1 49 lb, ub: returns a MiniZinc Set from lb to ub 50 Model.Set initialization reworked: 51 previously initialized with: Set( (1,2,[3,4],5) ) 52 now initialized with: Set( 1,2,[3,4],5 ) 53 or: Set( 1,2,(3,4),5 ) 54 Model.Set.push adds more elements onto the Set, works the same as the initialization function