Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Zero coefficients in objective + unknownObjectException

    Posted 08/02/10 05:50 AM

    Originally posted by: ThomasGh


    Dear all,

    We are writing a MIQP we would like to solve with CPLEX using the concert technology and Scala. When calling solve, the value of our variables are called and here we get an UnknownObjectException for the variables that contain a zero coefficient in the objective.

    Can we allow variables with a 0 coefficient in the objective? Are there some parameters we should use in CPLEX to allow this and to avoid the IloCplex UnknownObjectException?

    In attached the mathematical program we want to solve and below some code of where the error is occuring:

    val opt = solve flatMap {
    w =>
    val accepted = for ((o,v)<-x;

    accept=v.value;
    acceptedVolume=accept*o.volume;
    if (abs(acceptedVolume)>volTol))
    yield (o,accept)

    def value = try {
    cplex.getValue(cplexVar)
    } catch {
    case e: IloCplex.UnknownObjectException =>
    throw new Exception("Error: variable "name" not defined in the problem.")
    }

    Anyone an idea?
    Many thanks in advance,
    Thomas
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Zero coefficients in objective + unknownObjectException

    Posted 08/02/10 07:28 AM

    Originally posted by: SystemAdmin


    I don't know Scala so I cannot tell for sure but usually you get UnknownObjectException if you access something that is not known to the model. Either because it comes from a different model or because it is not used in the model.
    I understand you get the exception only for variables that have zero coefficient in the objective function? The variable for which you get the exception, does it have non-zero coefficient in at least one constraint in the model? If not this is the reason for the exception.
    Or does the variable come from a different model instance? This could also be the reason.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Zero coefficients in objective + unknownObjectException

    Posted 08/03/10 11:08 AM

    Originally posted by: ThomasGh


    Dear Daniel,

    Many thanks for answering. In fact the variables are not used in the model, but we still need them, since their coefficients in some constraints and in the objective might be changed afterwards. Do you know whether it is possible to prevent the elimination of the variable by the presolve in this case?

    Thanks in advance,
    Thomas
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Zero coefficients in objective + unknownObjectException

    Posted 08/03/10 11:30 AM

    Originally posted by: SystemAdmin


    I think the problem is not that variables are eliminated in presolve. This should work.
    The problem is that the variables do not occur in any constraint or in the objective function. It should be sufficient to do
    cplex.add(cplexVar);
    

    for all the variables that have only zero coefficients. This adds the variables explicitly and you can query their value after a succesful solve(). If that does not work you can try
    cplex.addLe(cplexVar.getLB(), cplexVar);
    

    This redundant constraint will be eliminated by presolve but will have the effect that the variable becomes part of the model.
    #CPLEXOptimizers
    #DecisionOptimization