Decision Optimization

Decision Optimization

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


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

A question of "cplex error 5002".

  • 1.  A question of "cplex error 5002".

    Posted 02/21/12 03:34 AM

    Originally posted by: SystemAdmin


    Hi,Everyone!
    when i execute my code,there will be "cplex error 5002".
    But the code has no problem ,before i add the following variable.

    ""
    INumVar] Reduce_single = new INumVarnum[; //N*M
    for (int i = 0; i < num; i++)
    {

    Reduce_single[i] = new INumVar[t];
    for (int j = 0; j < t; j++)
    {
    Reduce_single[i][j] = cplex.NumVar(0, Reduce_single_comtract[i][j]);
    }
    };
    ""
    Can you help me ??
    thank you!! and you could check the code in the attach file.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: A question of "cplex error 5002".

    Posted 02/21/12 03:36 AM

    Originally posted by: SystemAdmin


    Here is attach Files !!
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: A question of "cplex error 5002".

    Posted 02/21/12 03:53 AM

    Originally posted by: SystemAdmin


    None of your posts has any files attached.
    Could you please wrap your code into '{code}' tags so that it is not scrambled by the Forum software?
    Do you actually use the variables in some constraints or in the objective function? The important things to see would be where you use the variables.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: A question of "cplex error 5002".

    Posted 02/21/12 03:59 AM

    Originally posted by: SystemAdmin


    ok
    Why i can not upload the files attached.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: A question of "cplex error 5002".

    Posted 02/21/12 04:00 AM

    Originally posted by: SystemAdmin


    Hi,Everyone!
    when i execute my code,there will be "cplex error 5002".
    But the code has no problem ,before i add the following variable.

    "{
    INumVar] Reduce_single = new INumVarnum[; //N*M
    for (int i = 0; i < num; i++)
    {

    Reduce_single[i] = new INumVar[t];
    for (int j = 0; j < t; j++)
    {
    Reduce_single[i][j] = cplex.NumVar(0, Reduce_single_comtract[i][j]);
    }
    };
    }"
    Can you help me ??
    thank you!! and you could check the code in the attach file.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: A question of "cplex error 5002".

    Posted 02/21/12 04:03 AM

    Originally posted by: T_O


    > pxhcool wrote:
    > thank you!! and you could check the code in the attach file.

    There is no attached file!
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: A question of "cplex error 5002".

    Posted 02/21/12 04:10 AM

    Originally posted by: SystemAdmin


    soory!
    here is attached file!
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: A question of "cplex error 5002".

    Posted 02/21/12 04:10 AM

    Originally posted by: SystemAdmin


    here is attach file
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: A question of "cplex error 5002".

    Posted 02/21/12 04:13 AM

    Originally posted by: SystemAdmin


    ok ,thanks

    INumVar[][] Reduce_single = new INumVar[num][]; //N*M
                for (int i = 0; i < num; i++)
                {
     
                    Reduce_single[i] = new INumVar[t];
                    for (int j = 0; j < t; j++)
                    {
                        Reduce_single[i][j] = cplex.NumVar(0, Reduce_single_comtract[i][j]);
                    }
                };
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: A question of "cplex error 5002".

    Posted 02/21/12 04:59 AM

    Originally posted by: SystemAdmin


    The problem is that you have products like this:
    cplex.Prod(decide[j][i], Reduce_single[j][i])
    

    where both decide and Reduce_single are variables. This results in a quadratic objective function and quadratic constraints. And some of them are not positive semi-definite.
    What is the relation between Reduce_single and decide ? Could this relation be expressed in a different way? Maybe like this:
    Reduce_single[i][j] <= decide[i][j] * Reduce_single_comtract[i][j]
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: A question of "cplex error 5002".

    Posted 02/21/12 06:43 AM

    Originally posted by: SystemAdmin


    if i do that in another way,like this:
    INumVar[][] Reduce_single = new INumVar[num][]; //N*M
                for (int i = 0; i < num; i++)
                {
     
                    Reduce_single[i] = new INumVar[t];
                    for (int j = 0; j < t; j++)
                    {
                       cplex.AddLe ( Reduce_single[i][j],cplex.Prod (decide[i][j], Reduce_single_comtract[i][j]));
                    }
                };
    


    but there will be system.nullreferenceException.
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: A question of "cplex error 5002".

    Posted 02/22/12 05:38 AM

    Originally posted by: SystemAdmin


    Of course there will be a nullreferenceexception. This is because you never initialize the elements Reduce_single[i][j], so they are still null when you first use them. That part of the code was correct in one of your previous posts.
    Note that the problem is not the way in which you create the constraints or variables but the fact that the constraints use multiplication of variables in an unsupported way (see my other post in this thread).
    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: A question of "cplex error 5002".

    Posted 02/24/12 03:33 AM

    Originally posted by: SystemAdmin


    If the constraints have to use multiplication of variables ,but some of them are not positive semi-definite.
    then ,how could change the way supported to use multiplication of variables ??
    #CPLEXOptimizers
    #DecisionOptimization