1

I have a few continuous variables(decision variables). When the optimisation is run some variables get solution of very small decimal numbers like 0.00000123 etc. I do not want the variables to take such values, but I want to allow them to have 0 value. Hence I had put a constraint as below.

in declaration part :  dvar float+ Xbdt[Pitblocks][DumpBlocks][TimePeriods]   

in constraints part :

forall(b in PitBlocks,d in DumpBlocks,t in TimePeriods)
          {
        //NonNegative :       
    (Xbdt[b][d][t] == 0) || (Xbdt[b][d][t] >= 100) ;
      }

But these constraints gave rise to hundred thousand of binaries and made it impossible to solve.

I wanted to avoid any value of Xbdt between 0+ and 100, 0 is allowed. Is there any other way of doing this.

Ranajit
  • 49
  • 6

1 Answers1

0

If you only want to avoid very small values like you mentioned (~1e-6) you can just ignore them and round them down to zero. If you really want variables that can be zero or >= 100 then you are talking about 'semi-continuous' variables. See e.g.: https://www.ibm.com/support/pages/modeling-semi-continuous-variables-opl

Note that CPLEX itself supports these types of variables, but I don't think there is any direct support for these in OPL. If you work through one of the other APIs (e.g. C#, Java) then you can use these directly, eg if you are using OPL via one of the OPL interfaces, or directly using CPLEX via the Concert API, or even the C library interface.

TimChippingtonDerrick
  • 2,042
  • 1
  • 12
  • 13
  • Thank you for your response Tim, Semi continuous variable increases the number of Binary variables by many times. Round could be an option. I have never used Round before...not very sure how it could be used in this case - whether in the constraints (there are several constraints) or you meant while writing the results ? I need it in the constraint as the value of Xbdt has influence on other decision variables and the overall solution on whether it is 0 or > 0. If you can please clarify the round option a little more. – Ranajit Sep 27 '21 at 23:45
  • Agreed about using semi-continuous variables adding potentially many binary variables, but that is probably unavoidable if you really need to use them. In terms of rounding, I was meaning just rounding the output values. I don't know any way to do rounding directly in the CPLEX constraints and variables that doesn't introduce extra binary or integer variables. Another method is to solve like you already have done, then look for variables that are near to zero in the solution, and then re-solve the problem with additional constraints that force those near-zero variables to be really zero. – TimChippingtonDerrick Sep 29 '21 at 09:36