Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  declaring Integer varibale

    Posted 02/09/13 05:53 AM

    Originally posted by: SystemAdmin


    Thanks for your support.

    I have a variable defined like ..

    int rr = RRC.Route_Cost.size();
    int lb = 0;
    int ub = 10;
    IloIntVar[] route_selected = RMPcplex.intVarArray(rr, lb, ub);
    System.out.println("variable deceleration done"+ route_selected);

    it does not print the print statement, mean it is not able to declare the variable and give following error

    Exception in thread "main" java.lang.UnsatisfiedLinkError: ilog/concert/cppimpl/concert_wrapJNI.new_IloIntVar__SWIG_1(JJJLjava/lang/String;)J
    at ilog.concert.cppimpl.IloIntVar.<init>(IloIntVar.java:58)
    at ilog.concert.IloModelerAdvImpl.intVar(IloModelerAdvImpl.java:234)
    at ilog.concert.IloModelerAdvImpl.intVar(IloModelerAdvImpl.java:243)
    at ilog.concert.IloModelerAdvImpl.intVarArray(IloModelerAdvImpl.java:253)
    at Orpssrmp.main(Orpssrmp.java:51)

    When i convert that integer variable into numvar as shown below my model run fine. ..

    IloNumVar[] route_selected = RMPcplex.numVarArray(RRC.Route_Cost.size(), 0.0, 10.0);

    Can any one help me with the error.

    Thanks
    Arun Lila
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: declaring Integer varibale

    Posted 02/09/13 06:18 AM

    Originally posted by: SystemAdmin


    Even When I run my model with saying

    IloNumVar[] route_selected = RMPcplex.boolVarArray(rr);

    it works fine, I dont know but i get exception only for int variable.

    does any body has any idea about my problem?

    Please help , thanks in advance

    regards
    Arun Lila
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: declaring Integer varibale

    Posted 02/09/13 08:25 AM

    Originally posted by: SystemAdmin


    I cannot reproduce this with either CPLEX 12.4 or 12.5. Which version of CPLEX do you use on what OS?
    In any case: Unless you want to use any OPL stuff in your code then you are most probably better off using the cplex.jar and libcplex.so/dll from the cplex subdirectory of your COS installation instead of the oplall.jar and all the OPL libraries you seem to use.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: declaring Integer varibale

    Posted 02/14/13 12:46 AM

    Originally posted by: SystemAdmin


    I am using window 7 home premium , I tried my model running with cplex.jar and oplall.jar both.

    I am using JAVA perspective of ODME 3.6.

    I am not able to use int var and piece wise linear function it give the same error

    Route_cost = subcplex.piecewiseLinear(sum6, points, slopes, RCC.Get_St_X_Cord(), RCC.Get_St_Y_Cord());

    Exception in thread "main" java.lang.UnsatisfiedLinkError: ilog/concert/cppimpl/concert_wrapJNI.new_IloNumArray__SWIG_1(JJ)J
    at ilog.concert.cppimpl.IloNumArray.<init>(IloNumArray.java:68)
    at ilog.concert.cppimpl.IloConcertUtils.ToCppIloNumArray(IloConcertUtils.java:425)
    at ilog.cplex.IloCplex.piecewiseLinear(IloCplex.java:656)
    at ilog.cplex.IloCplex.piecewiseLinear(IloCplex.java:646)
    at SubProb.Cons12367(SubProb.java:126)
    at SubProb.sup_solve(SubProb.java:254)
    at Orpssrmp.main(Orpssrmp.java:10)

    I have set my enviroment varaibles also to
    C:\Program Files (x86)\IBM\ILOG\CPLEX_Studio124\opl\bin\x64_win64

    I dont know why I am facing this problem, if you can help me that would be great.

    Thanks
    Arun Lila
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: declaring Integer varibale

    Posted 02/14/13 12:57 AM

    Originally posted by: SystemAdmin


    Does it help to only use cplex.jar? Or is there some stuff in oplall.jar that you need?
    In any case, please also try to find an answer on the OPL related forum.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: declaring Integer varibale

    Posted 02/14/13 01:22 AM

    Originally posted by: SystemAdmin


    I dont need any opl stuff , but when i use only cplex.jar it give me the following error

    Exception in thread "main" java.lang.ClassCastException: ilog.cplex.CpxMult incompatible with ilog.concert.IloLinearNumExpr
    at MainProb.FindCons1_2(MainProb.java:66)
    at MainProb.SolveMaster(MainProb.java:213)
    at Orpssrmp.main(Orpssrmp.java:7)
    for the linear expression
    IloLinearNumExpr sum1 = RMPcplex.linearNumExpr();
    sum1.add( (IloLinearNumExpr) RMPcplex.prod(RRO.Get_Weight(j), route_selectedhttp://RRC.Get_Id_By_Value(RRO.Get_Route_Id(j))));

    and when i use oplall.jar i get the error which i have previously mentioned,

    I am not using any opl stuff in my model.

    Thanks
    Arun Lila
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: declaring Integer varibale

    Posted 02/14/13 02:00 AM

    Originally posted by: SystemAdmin


    Your code is hard to read :-(
    I think there are two ways to solve the cast problem here:
    1. Use IloNumExpr instead of IloLinearNumExpr.
    2. Use addTerm() instead of add(cplex.prod(...)).
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: declaring Integer varibale

    Posted 02/14/13 02:22 AM

    Originally posted by: SystemAdmin


    Thanks,using IloNumExpr has helped me to rid off the error.

    Thanks
    Arun Lila
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: declaring Integer varibale

    Posted 03/13/13 12:57 PM

    Originally posted by: SystemAdmin


    I am able to do what i wanted to do , Thanks
    #CPLEXOptimizers
    #DecisionOptimization