Constraint programming constraints cannot be used in combination with real valued variables, only wi

334 views
Skip to first unread message

pengfei...@gmail.com

unread,
Jun 5, 2018, 3:38:21 PM6/5/18
to AIMMS - The Modeling System
Hello,

Lately I begin to learn AIMMS and now a question has occured to me. When I try to create a project for my seminar work and run the execution, an error showed like "Constraint programming constraints cannot be used in combination with real valued variables, only with integer valued variables, element valued variables, and activities.  The real valued objective variable is an exception.  The mathematical program "MaximalVolumn" has both constraint programming constraints and real valued variables, for instance constraint "LoadingRestrictions" and variable "TotalNeededWeight".  

And here are my Restrictions and my Varibles:
 Variable Loading {
        IndexDomain: (i,j);
        Range: binary;
    }
    Variable TotalNeededWeight {
        Range: free;
        Definition: Sum[(i,j), TheWeightOfPakets(i) * Loading(i,j)];
    }
    Variable TotalNeededVolumn {
        Range: free;
        Definition: Sum[(i,j), TheVolumnOfPakets(i) * Loading(i,j)];
    }
    Variable TheRankingTheVolumnAndTheWeightTogather {
        IndexDomain: i;
        Range: nonnegative;
        Definition: Sum[j, (Loading(i,j) * TheRankingsOfThePakets(i) / (TheVolumnOfPakets(i) * TheWeightOfPakets(i)))  ];
    }
    Variable ReplaceableVarible {
        Range: free;
    }
    Constraint RankingRestrictions {
        IndexDomain: i;
        Definition: TheRankingTheVolumnAndTheWeightTogather(i) <= MiddleNumberOfRanking;
    }
    Constraint ReplaceableRestrictions {
        Definition: ReplaceableVarible <=1;
    }
    Constraint LoadingRestrictions {
        IndexDomain: i;
        Definition: Sum[j,Loading(i,j) <= ReplaceableVarible];
    }
    Constraint VolumnRestrictions {
        IndexDomain: j;
        Definition: Sum[i, Loading(i,j) * TheVolumnOfPakets(i)] <= TheNumberOfLkws(j) * TheVolumnOfLkws(j);
    }
    Constraint WeightRestrictions {
        IndexDomain: j;
        Definition: Sum[i, Loading(i,j) * TheWeightOfPakets(i)] <= TheLoadingableWeightOfLkws(j) * TheNumberOfLkws(j);
    }
    MathematicalProgram MaximalWeight {
        Objective: TotalNeededWeight;
        Direction: maximize;
        Constraints: AllConstraints;
        Variables: AllVariables;
        Type: Automatic;
    }
    MathematicalProgram MaximalVolumn {
        Objective: TotalNeededVolumn;
        Direction: maximize;
        Constraints: AllConstraints;
        Variables: AllVariables;
        Type: Automatic;
    }

So I really don't understand which part of it is wrong and how can I fix it. Can you help me with it?

Best Regards
Pengfei Xu


Deanne Zhang

unread,
Jun 6, 2018, 12:15:08 AM6/6/18
to AIMMS - The Modeling System
The syntax in constraint LoadingRestrictions should be

Constraint LoadingRestrictions {
        IndexDomain: i;
        Definition: Sum[j,Loading(i,j) ] <= ReplaceableVarible;
    }


--
You received this message because you are subscribed to the Google Groups "AIMMS - The Modeling System" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aimms+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pengfei...@gmail.com

unread,
Jun 6, 2018, 1:41:16 PM6/6/18
to AIMMS - The Modeling System
Thanks a lot for your answer, but after I changed it, the problem still existed.

在 2018年6月6日星期三 UTC+8下午12:15:08,Deanne Zhang写道:
To unsubscribe from this group and stop receiving emails from it, send an email to aimms+un...@googlegroups.com.

Mohan

unread,
Jun 6, 2018, 1:46:47 PM6/6/18
to AIMMS - The Modeling System
Hi, 

Try making the variable ReplaceableVariable a binary variable instead of a free variable. 

If defined as a binary variable, you won't need the constraint ReplaceableRestrictions anymore. 

    Constraint ReplaceableRestrictions {
        Definition: ReplaceableVarible <=1;
    }

The error you are seeing says that you cannot use constraint programming constraints cannot be used with real valued variables, and ReplaceableVariable is the only other real valued variable in your model other than the objective function. 

pengfeixu220194

unread,
Jun 6, 2018, 2:06:17 PM6/6/18
to aimms
Hello, 

Thanks a lot, it works!!! Really thanks a lot!!! I have been stifled for three days.

Best regards
Pengfei Xu



------------------ Original ------------------
From: Mohan <mohan....@aimms.com>
Date: Wed,Jun 6,2018 7:46 PM
To: AIMMS - The Modeling System <ai...@googlegroups.com>
Subject: Re: [AIMMS] Constraint programming constraints cannot be used incombination with real valued variables, only wi
Reply all
Reply to author
Forward
0 new messages