Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.3 kB · 54 lines
at develop
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253541. Calling solve with timer and solver (done) For simplicity, default solver must be set in minizinc.py It's easier and clearer to change the default solver to be used: In minizinc.py, class Model, there are 3 lines: def satisfy(self, ann = None, data = None, solver = default_solver, time = 0) def maximize(self, expr, ann = None, data = None, solver = default_solver, time = 0) def minimize(self, expr, ann = None, data = None, solver = default_solver, time = 0): To change the default solver to, say Gecode, we change the line solver = default_solver to solver = 'gecode' NOTE: to pass the responsibility of specifying the default solver to C++ files: in minizinc.py: change solver = default_solver --> solver = '' in Model.h: change default_solver = SC_UNKNOWN -> default_solver = SC_GECODE2. Updated arguments type checking: A type of None indicates that it accepts any possible type XXX: what if users enter a list or tuple to that position of None? XXX: Python Interface type checking is getting really clumpsy and expensive now----------------------------------------3. Internal variable name declaration is now removed: Sets, Variables and Arrays are previously assigned with an internal name when created (this is the memory address of the objects) Users can change the objects' name during declaring phase: instead of: a = model.Variable(1,10) we use: a = model.Variable(1,10,'a') and the object <a> will have internal name 'a' As we don't care about the internal names, this turns out to be useless and thus is now removed4. Changes to minizinc_internal Set initialization: Is now minizinc_internal.Set( [1,5], 7, [10,15] ) instead of minizinc_internal.Set( ([1,5], 7, [10,15]) )5. Set is now model independent and can be reused across multiple models Set.model = None6. Introducing Model.Range: Model.Range accepts up to 2 arguments: ub: returns a MiniZinc Set from 0 to ub - 1 lb, ub: returns a MiniZinc Set from lb to ub Model.Set initialization reworked: previously initialized with: Set( (1,2,[3,4],5) ) now initialized with: Set( 1,2,[3,4],5 ) or: Set( 1,2,(3,4),5 ) Model.Set.push adds more elements onto the Set, works the same as the initialization function