Search found 8 matches

by cbhomia
7 months ago
Forum: Archive Google Group
Topic: uniformInt : Why does not this function produce different numbers?
Replies: 4
Views: 851

Re: uniformInt : Why does not this function produce different numbers?

Hi Linkho, The numbers which are important to you (21,52,68... etc) are appearing as an index of MyParameter with non-zero value, rather than value in your parameter MyParameter(I). Per your code, for the randomly generated values 'pick' , you are essentially doing the following pick == some I from ...
by cbhomia
7 months ago
Forum: Archive Google Group
Topic: uniformInt : Why does not this function produce different numbers?
Replies: 4
Views: 851

Re: uniformInt : Why does not this function produce different numbers?

Hi, The uniformInt is working fine. Look at the indices for MyParameter(I). When I ran the code, the indices were all random, but the values were all 1 because you assigned the value 1 in the code. MyParameter(I)$(pick=ord(I))=1; Also, as I understand your process, you want to have 10 loops with num...
by cbhomia
7 months ago
Forum: Syntax
Topic: Closed form of a constraint
Replies: 2
Views: 957

Re: Closed form of a constraint

Hello, Assuming that 'k is also same set with m' means have the same elements defined in the same order, (or they are declared aliases), you can use the dollar control option to define equations only when m is not equal to k as follows eq1(i,m,k) $(ord(m) <> ord(k)).. L(A(i),C(m)) +e =l= L(A(i),C(k)...
by cbhomia
8 months ago
Forum: Modeling
Topic: tricking in equation
Replies: 4
Views: 333

Re: tricking in equation

Hello,

For indexed arguments, or rather parameter values, one can use the smin() operation, which works similar to sum() operation.
For equations, you can use the max() function. Goes something like max(arg1,arg2,arg3).

a<x<b is actually two separate inequalities, and should be written as such.
by cbhomia
8 months ago
Forum: Modeling
Topic: Error 149, Uncontrolled set entered as constant
Replies: 6
Views: 1220

Re: Error 149, Uncontrolled set entered as constant

Hello Sachin,

Quick question : were you able to run the model for just 1 instance ?
by cbhomia
8 months ago
Forum: Modeling
Topic: Altering the standard transportation problem
Replies: 3
Views: 347

Re: Altering the standard transportation problem

Hi, The fact that your solution is zero makes sense if you set some distances to zero. You are minimizing cost, which is proportional to the distance between plant i and market j. If the distance for an (i,j) pair is zero, there is no cost involved in transporting product between those two. Hence mi...
by cbhomia
9 months ago
Forum: Modeling
Topic: Error 149, Uncontrolled set entered as constant
Replies: 6
Views: 1220

Re: Error 149, Uncontrolled set entered as constant

Sachin, I don't think the error has anything to do with your logic, which was difficult to understand to begin with. But, the fix of your error is simple. In the profit equation, you have the set scn, which is not controlled. Profit_eq.. PROFIT =E= TIME*PRICE(s) - TIME*sum(t,PCON(t)*ECONCOST(t,scn))...
by cbhomia
9 months ago
Forum: Syntax
Topic: Sum with limited domain
Replies: 2
Views: 276

Re: Sum with limited domain

Hi, You will need to understand the use of conditional statements and dollar($) control over sets. You may use the syntax of ord(i) which refers to the position of element in a set, or the value function i.val() . sum (i from 1 to 4 , X(i)) =e= 1 --> sum(i$ [ord(i) <= 4], x(i)) =e= 1; OR sum (i from...