Nice Article!

]]>I tried the solver using NW 7.40 SP4 and got an error messages the the current bowser version doesn’t support non-continous models:

- if_genios_model_c=>GC_VAR_BINARY
- if_genios_model_c=>GC_VAR_DISCRETE

I tried it also with a mixed-integer linear solver:

lr_solver = lr_environment->create_solver( ‘MILP’ ).

But you can use the algorithm above as a heuristic for the knapsack problem by using a simplex solver (‘SIMP’) and continous models as above:

The linear constraints are necessary if your products are limited (f.e. in certain time period). But if there are no constraints you should set them to *x1 >= 0, x2 >= 0….*

There may be constraints about the freight weight if the goods have different weights. So this is about the capacity of the knapsack:

10 x1 + 50 x2 + 80 x3 <= 2000

Then you have to optimize the sum of x1, x2 and x3.

Since you use a continous model you have to round down the values which creates usually a non-optimal solution. You can try to “repair” by adding objects with small weight. This could create a good solution but not necessarily an optimum.

Best Regards,

Tobias

]]>

Hi Tobias….. thx a lot again for your time.

i am going through the wikipedia article , its very useful , although a bit complex to understand the equation. I also tried with ABAP LP Solver but dint succeed may be i am not creating right objective and constraints or may be it can not be solved using ABAP LP model .

Please if you can give it a try either using ABAP LP model or knapsack algorithm.

P.S I dint not delete my Post but was just editing and i think somehow it got deleted , as its not showing now.

]]>Hi Yogendra,

did you delete that post?

I think this a typical knapsack problem: Please have a look at http://en.wikipedia.org/wiki/Knapsack_problem Can you check the Wikipedia entry to find out if this is indeed a knapsack problem?

This problem is hard to solve in terms of computational complexity – we call it NP-hard which means that there is probably no efficient algorithm that can solve the problem. Nevertheless computers got so fast that even unefficient algorithms have a chance to find solutions.

The problem is that the approach in this blog entry describes linear programming (LP) models and for knapsack the so called integer linear programming (ILP) is natural. I have no experience whether the ABAP LP solver supports ILP problems but If you are interested I can try it out end of this week. If you need a solution right now I think you should try a heuristic. Above mentioned Wikipedia article describes a Greedy algorithm proposed by George Dantzig that is quite good from my experience.

Best Regards,

Tobias

Hi Octav,

thank you for your correction, I just changes the blog entry.

Would you like to tell what kind of LP models do you use in the ABAP world?

Best Regards,

Tobias

]]>Hi Tobias ,

Very good example. Thank you .

Please mind that there is a typing mistake in your problem . You’re stating :

1 – “Each completed workflow of type 1 has a benefit of 10, workflow type 2 has a benefit of 50 and workflow type 3 has 80 ”

2 – “So we have to maximize the objective function 15 x1 + 10 x2 + 40 x3 ” .

Therefore I assume that 1’s statement should be :

“Each completed workflow of type 1 has a benefit of 15, workflow type 2 has a benefit of 10 and workflow type 3 has 40 ”

For my LP models I used to declare :

lv_value TYPE P DECIMALS 2

Thank you ,

Octav

Within the last days I found another interesting use case in the are of technical operations: jobs nets. The SAP LT tool creates job nets and using tests we know the runtime of every job and the dependencies. With scheduling methods we could optimize the model and so the overall runtime. I think the same can be true for comlex parallelization.

But now to business: As SAP For Insurance guy I would like to discuss OR methods in the are of financial and insurance products and expecially in the area of Provision Management and Reinsurance.

I agree with you: ABAP isn’t a platform for doing econometrics but I think ERP with Planning is like SOA without HTTP.

Cheers,

Tobias
]]>

Uwe Fetzer:

> We only have to document the code together with the BPXer.

Tobias Trapp:

> I thought that topics like linear optimization (or least squares and so on) are so trivial…

Operations Research works well for problems that can be modeled, or stated in a mathematically defined way. Something like the traveling salesperson, logistics or most supply chain transportation questions are answerable, but this solution has been so commoditized by now there is no point in anyone trying to build their own models, except as an academic exercise.

In the problems I see, most are simple enough that the computing power built into spreadsheets for the last couple decades can manage them (e.g., choose data set, “add trendline”, chose “linear”), with other questions too complex for the data constraints to be easily enumerated, and thus impossible to wield operations research as a tool. The number of exceptions, special cases, overrides and plain freedom of choice would prevent such topics from being calculated. I could see a truck driver following the guidance issued by the dispatcher on which deliveries to make, and which route to take, but asking a salesperson to do the same might be trickier. Yes, you’ll want to contact your prospects, your hot list, or whatever, but how do you build in the gut checks? And on the product development side, modelling expected consumer acceptance is certainly tried, but everyone can appreciate that past experiences are no predictor of future events. Just read your stock brokers fine print.

I would think there has to be an integrator or architect role between the developer and the BPXer. I don’t see most code slingers being able to work directly with the business users to fully scope which models work for which questions. Not trying to offend, but the developers job usually seems to be restricted to making the code “work” not making the code “useful.” I’ve needed to explain input sensitivity to various models more than once (i.e., Quicksizer).

I also don’t think a subject like least squares is trivial in most contexts. It is basic math, of course, but bringing algebra into a discussion of financial choices requires a receptive audience. That doesn’t always happen, I think.

Jim
]]>

Yes the comments help a lot! I’m still working my way through it. This intrigues me enough that I want to understand it.

If I understand it, I may use it. But even better, I’ll feel more comfortable using a mathematical model in my programming. I’m guessing there were / are times when it would make my programming easier.

Thank you! It’s a great blog. And I’m so glad you are keeping up with the questions.

Michelle ]]>