set I;
set J;
set P;
set SET1 within {I,J,P};
set K;
set SET3 within {I,J,K};
set SET4 within {I,K};
param Param1 {SET3};
param Param2 {SET4};
var Var1 {SET1};
subject to Var1Constraint {(i,j,p) in SET1}:
Var1[i,j,p] =
max {k in K: Param1[i,j,k] = p}
Param2[i,k] * Param1[i,j,k];
This constraint is fixing all of the values of the variables, however, so I
doubt that it's really what you want. To say anything more definite, one would
have to know where this problem comes from and what the sets, parameters,
variable, and constraint are supposed to mean.
Bob Fourer
4...@ampl.com
Since only parameters are involved in your expression to the right of "=", I
believe you would be satisfied with
... = max {k in SET2}
Param2[i,k] * (if Param1[i,j,k] = p then 1 else 0);
Or you could express the same thing more concisely as
... = max {k in SET2} (if Param1[i,j,k] = p then Param2[i,k] else 0);
or even
... = max (0, max {k in SET2: Param1[i,j,k] = p} Param2[i,k]);
Bob Fourer
4...@ampl.com
> -----Original Message-----
> From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of
> mattias
> Sent: Friday, January 25, 2008 5:59 AM
> To: AMPL Modeling Language
The second message is indeed a fallout from the first. The first message says
that AMPL is treating the strict inequality constraint as a "logical
constraint" in the output that it sends to CPLEX. But CPLEX cannot handle
logical constraints unless they are of a special kind known as "indicator"
constraints. The second message says that this particular constraint is NOT an
indicator constraint, implying that CPLEX can't handle it. (An indicator
constraint has the form "BinaryVar = 0 implies LinearConstraint" or "BinaryVar
= 1 implies LinearConstraint".)
The fix, as Paul indicates, is to use >= or <= and not > or < in constraint
expressions.
Bob Fourer
4...@ampl.com
> -----Original Message-----
> From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Paul
> Sent: Monday, January 28, 2008 10:04 PM
> To: AMPL Modeling Language
I am having some trouble understanding your description of the constraint, but it seems to me you may be looking for the following:
subject to SetVar1 {(i,j,p) in SET1}:
Var1[i,j,p] = max {k in SET2: Param1[i,j,k] = p} Param2[i,k] * p;
The indexing expression following "max" means: "all k in SET2 such that Param1[i,j,k] equals p".
Bob Fourer
From: am...@googlegroups.com [mailto:am...@googlegroups.com]
On Behalf Of leonardo.p...@gmail.com
Sent: Sunday, June 16, 2013 5:38 PM
To: am...@googlegroups.com
Cc: matti...@hotmail.co.uk
Subject: [AMPL 7173] Re: Formulating a constraint
I am trying to formulate a constraint to give the highest value for
Var1 where: . . .
Hi Guys, I have one problem.
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
subject to Max_Lines_Closed3 {(k,i,j) in DLIN}:
sum{(k,i,j) in DLIN} Zc[k,i,j] <=171;
the problem still persists... total cost and sum of binary variables in "1" do not change if I try to change the value of constraint.
Setting $presolve_inteps < 2.18e-07 or >= 5.19e-06 could change presolve results. CPLEX 12.7.0.0: timelimit=300 threads=4 CPLEX 12.7.0.0: QP Hessian is not positive semi-definite. 0 MIP simplex iterations 0 branch-and-bound nodes No basis.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+unsubscribe@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+unsubscribe@googlegroups.com.
qEven with this modification, nothing happened.
I had set up as follows:
subject to Max_Lines_Closed3 {(k,i,j) in DLIN}:
sum{(k,i,j) in DLIN} Zc[k,i,j] <=171;
the problem still persists... total cost and sum of binary variables in "1" do not change if I try to change the value of constraint.
Setting $presolve_inteps < 2.18e-07 or >= 5.19e-06
could change presolve results.
CPLEX 12.7.0.0: timelimit=300
threads=4
CPLEX 12.7.0.0: QP Hessian is not positive semi-definite.
0 MIP simplex iterations
0 branch-and-bound nodes
No basis.
On Thu, Jul 5, 2018 at 4:43 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
You have written the constraint as
subject to Max_Lines_Closed {(k,i,j) in DLIN}:
sum{(k,i,j) in DLIN}(Zk[k,i,j])=170;
but the error message indicates you have the strict inequality constraints. The optimization is not well-defined for the strict inequality, so change it to the <=.
Thanks,
--
Dr. Paras Tiwari
am...@googlegroups.com
On Wed, Jul 4, 2018 at 2:57 PM UTC, Ampl Modeling Language <am...@googlegroups.com> wrote:
--Hi Guys, I have one problem.I am using a binary variable for power lines. (0: switch off,1: switch on).After this, I am summing all variables e comparing to a max lines that can be ON, for example, 177.I have got the same problem.subject to Max_Lines_Closed {(k,i,j) in DLIN}:sum{(k,i,j) in DLIN}(Zk[k,i,j])=170;Error: amplin, line 67 (offset 2307):processing commands.Error: Caution: Treating strict inequality constraint as a logical constraint.Executing on prod-exec-3.neos-server.orgError: context: sum{(k,i,j) in >>> DLIN}(Zk[k,i,j])<170; <<<how can i resolve this?
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+unsubscribe@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+unsubscribe@googlegroups.com.