this repo has no description
1/* 2% Controls 3% 4*/ 5 6%-----------------------------------------------------------------------------% 7%---------- USER and LAZY CUTS -----------------------------------------------% 8/* 9 PLEASE NOTE: 10 If you export FZN file with lazy_constraint/user_cut annotations, 11 their declarations are not exported currently (as of 7.11.17). 12 WORKAROUND: when solving that fzn, add -G linear, 13 e.g., as follows: mzn-cplex -G linear model.fzn 14 * For Gurobi, the constraints marked as MIP_cut and/or MIP_lazy are added 15 * into the overall model and marked with the foll values of Lazy attribute: 16 * ::MIP_lazy 1 17 * ::MIP_cut ::MIP_lazy 2 18 * ::MIP_cut 3 19 */ 20ann: user_cut; 21ann: lazy_constraint; 22%%% comment away the below assignments (leaving, e.g., ann: MIP_cut;) to have them as normal constraints 23%%% In particular, they may be used by redundant_constraint() and symmetry_breaking_constraint(), see redefs-2.0.2.mzn 24ann: MIP_cut = user_cut; %% MIP_cut: make sure no feasible solutions are cut off 25 %% -- seems better on average but in CPLEX, wrong LB e.g. on carpet-cutting 26ann: MIP_lazy = lazy_constraint; 27 28%-----------------------------------------------------------------------------% 29opt bool: fIndConstr; 30bool: fMZN__UseIndicators = %% Pass on indicator constraints 31 if absent( fIndConstr ) then false 32 else deopt( fIndConstr ) endif; 33 %% CPLEX 12.6.2 Concert: reifs give wrong result on 2012/amaze, so using implications only 34 35%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Subtour elimination in circuit %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 36% --------------------------------------------------------------------------------------- % 37opt int: nSECcuts; %% 0,1: use MTZ formulation 38int: nMZN__fSECcuts = %% 1,2: pass on circuit constraints to the MIP_solverinstance's cut gen 39 if absent( nSECcuts ) then 0 40 else deopt( nSECcuts ) endif; 41 42 43%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MIPdomains %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 44% --------------------------------------------------------------------------------------- % 45%% Paper: % Belov, Stuckey, Tack, Wallace. Improved Linearization of Constraint Programming Models. CP 2016 Proceedings. 46 %%% The below option enables translation of domain constraints into the ...POST predicates. 47 %%% The code in MIPdomains.cpp processes them and also non-contiguous domains 48 %%% (only-range-domains is then standardly off). MIPdomains.cpp needs all the required 49 %%% __POST predicates to be declared to kick in. 50opt bool: fMIPDomains; %% unified decomposition constraints (...__POST) to FlatZinc 51opt bool: fMIPdomains; %% Can be defined from cmdline: -D "fMIPdomains=false" 52bool: fPostprocessDomains = %% True to pass all domain-related 53 if absent( fMIPdomains ) /\ absent( fMIPDomains ) then false %% seems best for all 28.5.19 54 elseif not absent( fMIPdomains ) then deopt( fMIPdomains ) 55 else deopt( fMIPDomains ) 56 endif; 57opt bool: fMIPdomAux; 58bool: fPostproDom_AUX = %% Specialized for aux_ constr 59 if absent( fMIPdomAux ) then false 60 else deopt( fMIPdomAux ) endif; 61opt bool: fMIPdomDiff; 62bool: fPostproDom_DIFF = %% Specialized for differences: x<y <-> z=x-y<0 63 if absent( fMIPdomDiff ) then false %% seems best for Gurobi, worse for CBC 64 else deopt( fMIPdomDiff ) endif; 65 66mzn_opt_only_range_domains = not fPostprocessDomains; %% currently unused 67 68%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Avoid creating new int vars %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 69% --------------------------------------------------------------------------------------- % 70opt bool: fAvoidNewInts; 71bool: fAvoidNI = %% Actually this is only for ..._lin_..., not for just x-y 72 if absent( fAvoidNewInts ) then false 73 else deopt( fAvoidNewInts ) endif; 74opt bool: fNewVarsInAuxEq; 75bool: fAuxIntEqOLD00 = if absent(fNewVarsInAuxEq) then false else deopt(fNewVarsInAuxEq) endif; 76bool: fAuxFloatEqOLD00 = if absent(fNewVarsInAuxEq) then false else deopt(fNewVarsInAuxEq) endif; 77 78%%%%%%%%%%%%%%%%%%%%% Redundant constraints ---------------------------------------------- % 79bool: fMZN__IgnoreRedundantCumulative=false; 80%% NOT WORKING NOW, use redefs_2.0.2.mzn: 81%%%%% bool: fMZN__IgnoreAllUserRedundant=false; %% ignore all user-spec redundant constr 82 83%%%%%%%%%%%%%%%%%%%%% Element, minimuum convex hull --------------------------------------- % 84opt bool: fXBZCuts01; %% orders 0, 1 85opt bool: fXBZCutGen; %% only works if Cuts01 86bool: fElementCutsXZ=false; %% Use simple XZ & XZB cuts for element 87bool: fElementCutsXZB = if absent(fXBZCuts01) then false else deopt(fXBZCuts01) endif; 88bool: fMinimumCutsXZ=false; %% Use simple XZ & XZB cuts for minimum 89bool: fMinimumCutsXZB = if absent(fXBZCuts01) then false else deopt(fXBZCuts01) endif; 90bool: fUseXBZCutGen = if absent(fXBZCutGen) then false else deopt(fXBZCutGen) endif; 91 92% ----------------------------------------------------------------------------------------- % 93bool: fIntTimesBool=true; %% Special handling of multiplication with a boolean(*const) 94 95%-----------------------------------------------------------------------------% 96% If not postprocessing domains: For unary encoding: maximal domain length to invoke it 97 98int: nMZN__UnarySizeMax_intTimes=20; 99int: nMZN__UnarySizeMax_cumul=2000; 100int: nMZN__UnarySizeMax_1step_regular=20000; %% network-flow decomp in the regular constraint 101 102int: nMZN__UnaryLenMin__ALL=1; %% can be used by the indiv. cases 103int: nMZN__UnaryLenMax__ALL=2000; %% can be used by the indiv. cases 104% Some more detailed parameters 105int: nMZN__UnaryLenMin_leq = 1; 106int: nMZN__UnaryLenMin_neq = nMZN__UnaryLenMin__ALL; 107int: nMZN__UnaryLenMin_eq = nMZN__UnaryLenMin__ALL; 108int: nMZN__UnaryLenMax_leq = -1; 109int: nMZN__UnaryLenMax_neq = nMZN__UnaryLenMax__ALL; 110int: nMZN__UnaryLenMax_eq = nMZN__UnaryLenMax__ALL; 111int: nMZN__UnaryLenMax_setIn = nMZN__UnaryLenMax__ALL; 112int: nMZN__UnaryLenMax_setInReif = nMZN__UnaryLenMax__ALL; 113 114%-----------------------------------------------------------------------------% 115% Strict inequality 116% The relative epsilon 117%%% Has the problem that when relating to upper bound of various differences, 118%%% getting different absolute eps...? 119%% float: float_lt_EPS_coef__ = 1e-03; ABANDONED 12.4.18 due to #207 120%%% Absolute one, used everywhere 121%%% Might make no sense for floats with smaller domains etc. 122opt float: float_EPS; 123float: float_lt_EPS = if absent( float_EPS ) then 1e-6 else deopt( float_EPS ) endif; 124 125%-----------------------------------------------------------------------------% 126%%% Set =true to PRINT TRACING messages for some constraints: 127opt bool: fMIPTrace; 128bool: mzn__my_trace_on = 129 if absent( fMIPTrace ) then false else deopt( fMIPTrace ) endif; 130test my_trace(string: msg) ::promise_total 131 = if mzn__my_trace_on then trace(msg) 132 else true endif; 133test my_trace(string: msg, bool: bb) ::promise_total 134 = if mzn__my_trace_on then trace(msg, bb) 135 else bb endif; 136function var bool: my_trace(string: msg, var bool: bb) ::promise_total 137 = if mzn__my_trace_on then trace(msg, bb) 138 else bb endif; 139%%% Set =true to PRINT TRACING messages for the currently debugged constraints: 140opt bool: fMIPTraceDBG; 141bool: mzn__my_trace__DBG_on = 142 if absent( fMIPTraceDBG ) then false else deopt( fMIPTraceDBG ) endif; 143test my_trace__DBG(string: msg) ::promise_total 144 = if mzn__my_trace__DBG_on then trace(msg) 145 else true endif; 146