Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Conditioned summation in constraints

    Posted 11/27/18 10:29 PM

    Originally posted by: Nomykan


    Hi everyone,

        i am stuck in a problem with some constraints having conditioned summation and don't know how to handle it. help in this regard will be appreciated. in total i have 3 constraints having this type of summation other constraints i have already done with but these are a bit difficult. thanks


    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: Conditioned summation in constraints

    Posted 11/28/18 12:49 AM

    Hi,

    let me show you for the fist equation:

    range G=1..4;
    range T=1..24;

    float U[g in G][t in T]=g*t;
    int Wg=2;

    dvar float A[G][T];

    subject to
    {

    forall(g in G,t in T)
      sum(x in 1..minl(t+Wg,24)) A[g][x]<=U[g][t];
     
    }

    regards

     

    https://www.linkedin.com/pulse/%E4%BC%98%E5%8C%96%E5%B0%91%E8%8A%B1%E9%92%B1%E5%A4%9A%E5%8A%9E%E4%BA%8B-%E5%8A%A8%E7%89%A9%E5%9B%AD%E5%85%AC%E5%85%B1%E6%B1%BD%E8%BD%A6%E5%92%8C%E5%84%BF%E7%AB%A5-alex-fleischer/


    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: Conditioned summation in constraints

    Posted 11/28/18 03:05 AM

    Originally posted by: Nomykan


    Hi Alex,

      Your response is always very helpful... thanks for such a quick response. Also i have one more question. i have solved the problem and have optimal solution but only the last constraint is not satisfied. as far i know the problem lies here. i have lines from a certain node to another node as shown in the network picture.  

    {line} Lines={<1, 2>,  <2, 3>,   <1, 4>,   <2, 4>,   <4, 5>,  <5, 6>,  <3, 6>};

    now if i solve the problem it gives error but when i add the opposite of the lines like <2, 1>, <3, 2> then it works. in the solution i get values for lines like 2-3=0, 3-2=50. i want it to 2-3 and 3-2 to be considered as one line and the value is positive or negative depending on the flow like 

    1-2= +ve value if it is from 2-1,

    2-1= -ve value if it is from 1-2.

    in this case if i have only lines that are mentioned in the Lines tuple , then the last constraint will be satisfied. can you help me in this regard what is the issue and how can it be fixed. 

    Again thanks for such a helpful response.   


    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: Conditioned summation in constraints

    Posted 11/28/18 03:32 AM

    Hi,

    have you had a look at the netflow example:

    Network flows

    The purpose of this model is to solve a standard minimum-cost network-flow problem with a single commodity.

    The characteristics of the network flows example are the following:

    • Industry: Transportation
    • Feature: OPL Project
    • Technique: Linear Programming
    • Complexity: Basic
    • Keywords: Network flow
    • Project Location: examples/opl/models/Netflow
    • Model Name: netflow.mod

    ?

    regards

    https://www.linkedin.com/pulse/making-decision-optimization-simple-alex-fleischer/


    #DecisionOptimization
    #MathematicalProgramming-General


  • 5.  Re: Conditioned summation in constraints

    Posted 11/28/18 04:26 AM

    Originally posted by: Nomykan


    Hi Alex, 

    i have gone through the Netflow example but in my case the supply is not known and is a decision variable. also the constraint in my model  

    forall(i in Mybus)
      sum(j in busdata[i]) pline[<i,j>]  -sum(j in busdata[i]) pline[<j,i>] + power[i]-demand[i]==0;

    for power flow balance we need flow line1-2 and flow line2-1 equal. and here the problem comes. in this case the solution engine considers line 1-2 and 2-1 as different lines. i want it to be considered as one line. and the flow to be positive or negative depending on whether it is towards the node or coming out of the node. can you help me check my model and see where needs to be changed. i shall be very thankful. i have tried a lot but did not succeed. 

    Thanks 


    #DecisionOptimization
    #MathematicalProgramming-General


  • 6.  Re: Conditioned summation in constraints

    Posted 11/29/18 01:21 AM

    Hi,

    instead of having 1-2 and 2-1 you could have ordered tuples like in

    https://www.ibm.com/developerworks/community/forums/html/topic?id=f58daf79-f752-48e4-8f25-54b2f6f71b40&ps=25

    setof(edge) Edges       = {<i,j> | ordered i,j in Cities};

    and then you may index your decision variable with Edges

    regards


    #DecisionOptimization
    #MathematicalProgramming-General