cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

One transport problem (linear programming) in matrix form. Why?

ValeryOchkov
24-Ruby IV

One transport problem (linear programming) in matrix form. Why?

The Mathcad Prime 4 sheet in attach!

Why4.png

1 ACCEPTED SOLUTION

Accepted Solutions

Of course in trhe actual sheet I would define those vectors in front of the solve block and also use a definition for the "Price" function which does not use predefined ranges:

B3.png

View solution in original post

24 REPLIES 24

Ну вот, а день так хорошо начинался.

ВФ, зачем Вы перешли на MCP4?

Viktor

See please the sheet for Mathcad 15 but not in Matrix form.

Now I am preparing the matrix form will send it late!

Mathcad 15 in matrix form in attach

Why an error?


@ValeryOchkov wrote:

Mathcad 15 in matrix form in attach

Why an error?


The sheet you posted does not throw any error!?

 

The effect which confuses you is due to the way Mathcad handles expression with ranges.

B1.png

B2.png

 

Sorry!

It was my error with indexes - hire are only 2 elements.

And I we cannot use indexes in Given-Find. I forgot about it!

See plrase my old message about it https://community.ptc.com/t5/PTC-Mathcad-Questions/Matrix-and-vector-in-Solver/m-p/20672

 

15-17a-matrix.-Error.png

I was pretty sure that it would be you who would find the solution for this thread, but why not simply use vectors and matrices straightforeward? Seems the most easy way to do it to me.

B3.png

BTW, if you don't like the hardcoded vector of 1's, you may replace it by funny expressions like seen in the following pic to make the solve block independent fron the matrix dimensions:

B4.png

I forgot one of the easiest ways: diag(mp)*0+1

 

P.S.: I am not sure why the condition mp >= 0 has so much influence on the outcome (give it a try and delete it).

Thanks, Viktor and Werner!

But!

I solve the transport task of transporting coal from two mines (m) to two power plants (p) with a minimal total price.
But I want to increase the number of mines and power plants, enter the required data (new elements in vectors m and p, new rows and cols in matrix pm - prices of coil transportation from one mine to one plant) and get a new answer without adding/changing the operators in the solver block.
I see that this can not be done in Mathcad 15 and Prime - we can not work with array indexes in this block.
This is not good! Sorry!



But I want to increase the number of mines and power plants, enter the required data (new elements in vectors m and p, new rows and cols in matrix pm - prices of coil transportation from one mine to one plant) and get a new answer without adding/changing the operators in the solver block.


I suspected that and thats exactly what my last reply is dealing with!

 



I see that this can not be done in Mathcad 15 and Prime - we can not work with array indexes in this block.


It CAN be done - see my last reply. And you don't have to deal with array indices which is awkward anyway.

 

Thanks, Werner.

But we can have m=2 and p=3 for example - not square matrix mp.

Val

15-17a-NSM-matrix.png

Must be

15-17a-NSM-matrix-1.png


@ValeryOchkov wrote:

Thanks, Werner.

But we can have m=2 and p=3 for example - not square matrix mp.

 


I can't see any problems here:

B1.png

Or, to be more generic, you can use one of the ideas given above:

B2.png

 

BTW, I feel that the images you insert, are far too large. Images that large tend to destroy the readability of a thread.

Of course in trhe actual sheet I would define those vectors in front of the solve block and also use a definition for the "Price" function which does not use predefined ranges:

B3.png

Yes! it may be the solution

15-17-NSM.png

And how we can here have only one not 10 equation in Solver? (the Mathcad 15 sheet in attach)

1-PE.png

Hoorray - catanary(?) again 😉

 


@ValeryOchkov wrote:

And how we can here have only one not 10 equation in Solver? (the Mathcad 15 sheet in attach)

 


Maybe simply by using an auxiliary function which calculates the vector of distances (squared).

Bild.png

 

I got rid of your mix of literal and vector subscripts and changed back the ORIGIN to 0.

 

 

Thanks Werner!

But it is not a catenary but a big problrem of Mathcad

21-1a-Catenary.png

Careful!

p/p or m/m may throw an error if a vector element happens to be zero!

Vectors m and p have only positive values!

7-6.png

I hope it can be one solution

Mathcad 15Mathcad 15Mathcad PrimeMathcad Prime

More interest form of input data. Mathcad Prime 5 in attach!

Transport.png

One More interest form of input data. Only with Mathcad Prime:

Transport.png

So why did they need tables, when arrays would do?


@Fred_Kohlhepp wrote:

So why did they need tables, when arrays would do?


For show Mathcad Prime!

Mathcad needs this tool: not only a 2D-table but a 3D table!

 

Top Tags