Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Q about how to use the pointer to a CPLEX problem object

  • 1.  Q about how to use the pointer to a CPLEX problem object

    Posted 05/19/08 04:16 PM

    Originally posted by: SystemAdmin


    [tksung said:]

    HI!
    I am not good in programming , hope this question is not too trivial.  Really need some help.


      I am trying to retrive the rhs valuse of a presolved LP through
      CPXgetredlp and CPXgetrhs.

    In the manual
    The routine CPXgetredlp returns a pointer for the presolved problem.
        I am using function:
    CPXPUBLIC CPXgetredlp(CPXCENVptr env, CPXCLPptr lp, CPXCLPptr * redlp_p)
      where Parameters:
      env: A pointer to the CPLEX environment, as returned by CPXopenCPLEX.

        lp: A pointer to a CPLEX LP problem object, as returned by CPXcreateprob.

      redlp_p: A pointer to receive the problem object pointer that results when presolve has been applied to the LP problem object.

    and The routine CPXgetrhs is used to access the right-hand side coefficients for a range of constraints in a CPLEX problem object.
        I am using function:
    CPXgetrhs(CPXCENVptr env, CPXCLPptr lp, double * rhs, int begin, int end)
    where Parameters:
        env: A pointer to the CPLEX environment as returned by CPXopenCPLEX.

        lp: A pointer to a CPLEX problem object as returned by CPXcreateprob.

        rhs: An array where the specified right-hand side coefficients are to be returned. 
       
    -----------------------
    My question is
    Does "lp"  parameter in CPXgetrhs(env,  lp,  rhs, begin, end) have to be "returned by CPXcreateprob", as mentioned in manual?

    Can I use redlp_p, instead of lp, in CPXgetrhs(env,  redlp_p,  rhs, begin, end) where redlp_p is returned in CPXgetredlp(env,  lp, redlp_p)

    The redlp_p is  "a pointer to receive the problem object pointer that results when presolve has been applied to the LP problem object",  not  "returned by CPXcreateprob".

    I did this in my codes try to get RHS of the presolved problem, but it did not wrok.
    Do my codes have bugs?  or redlp_p cant be passed to CPXgetrhs as the lp parameter?

    Thanks!




    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Q about how to use the pointer to a CPLEX problem object

    Posted 05/20/08 10:33 AM

    Originally posted by: SystemAdmin


    [MaryFenelon said:]

    You should use

      CPXCLPptr redlp;
     
      CPXgetredlp (env, lp, &redlp);
      CPXgetrhs (env,  redlp,  rhs, begin, end);

    The "&" notation tells C to use the address of the argument, which makes "&redlp" a pointer to a CPXLPptr object, which is what "CPXCLPptr *" means.  I still think the best C book is Kernighan & Ritchie's book; give it a look.


    #CPLEXOptimizers
    #DecisionOptimization