Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Just to set up an objective function in Java

    Posted 12/18/08 03:09 PM

    Originally posted by: SystemAdmin


    [wingbow said:]

    To set an objective function to be:
    [color=blue][i]Min x[0][0][0][/i][/color]

    I include the following in the Java code:
    [color=brown]IloLinearNumExpr objFcn = model.linearNumExpr();
    objFcn.addTerm(1,x[0][0][0]);
    model.addMinimize(objFcn);[/color]

    But the following error messages are shown during program run:
    [color=green]Exception in thread "main" java.lang.NullPointerException
            at ilog.cplex.CpxLinearExpr.unmarkVars(CpxLinearExpr.java:377)
            at ilog.cplex.CpxLinearExpr.removeDuplicates(CpxLinearExpr.java:484)
            at ilog.cplex.CpxObjective.setExpr(CpxObjective.java:87)
            at ilog.cplex.CpxObjective.<init>(CpxObjective.java:283)
            at ilog.cplex.IloCplex.objective(IloCplex.java:534)
            at ilog.cplex.IloCplex.addObjective(IloCplex.java:565)
            at ilog.cplex.IloCplex.addMinimize(IloCplex.java:574)[/color]

    Can anyone help????
    Thanks a lot!!
    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: Just to set up an objective function in Java

    Posted 12/18/08 03:24 PM

    Originally posted by: SystemAdmin


    [Didier Vidal said:]

    How did you initialize the x array ? The error might be that x[0][0][0] = null....

    Didier.
    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: Just to set up an objective function in Java

    Posted 12/18/08 03:29 PM

    Originally posted by: SystemAdmin


    [wingbow said:]

    Do we need to initialize??
    What I did is to declare:
    [color=blue]
    IloIntVar[][][]  x;
    x = new IloIntVar[4][4][2];[/color]
    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: Just to set up an objective function in Java

    Posted 12/18/08 04:08 PM

    Originally posted by: SystemAdmin


    [wingbow said:]

    I solved the problem!
    For the reference of future users, we can initialize the Ilo-variables by statements like:
    [color=blue]x[0][0][0]=model.intVar(0,1);[/color]
    #DecisionOptimization
    #MathematicalProgramming-General