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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

24-Ruby IV

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

The Mathcad Prime 4 sheet in attach!

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:Werner_E)

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:

24 REPLIES 24
13-Aquamarine
(To:ValeryOchkov)

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

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

Viktor
24-Ruby IV
(To:ViktorKorobov)

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

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

24-Ruby IV
(To:ValeryOchkov)

Mathcad 15 in matrix form in attach

Why an error?

24-Ruby V
(To:ValeryOchkov)

@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.

24-Ruby IV
(To:Werner_E)

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

24-Ruby V
(To:ValeryOchkov)

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.

24-Ruby V
(To:Werner_E)

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:

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).

24-Ruby IV
(To:Werner_E)

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!

24-Ruby V
(To:ValeryOchkov)

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.

24-Ruby IV
(To:Werner_E)

Thanks, Werner.

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

Val

24-Ruby IV
(To:ValeryOchkov)

Must be

24-Ruby V
(To:ValeryOchkov)

@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:

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

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

24-Ruby V
(To:Werner_E)

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:

24-Ruby IV
(To:Werner_E)

Yes! it may be the solution

24-Ruby IV
(To:ValeryOchkov)

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

24-Ruby V
(To:ValeryOchkov)

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).

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

24-Ruby IV
(To:Werner_E)

Thanks Werner!

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

24-Ruby V
(To:ValeryOchkov)

Careful!

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

24-Ruby IV
(To:Werner_E)

Vectors m and p have only positive values!

24-Ruby IV
(To:ValeryOchkov)

I hope it can be one solution

Mathcad 15Mathcad Prime

24-Ruby IV
(To:ValeryOchkov)

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

24-Ruby IV
(To:ValeryOchkov)

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

23-Emerald I
(To:ValeryOchkov)

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

24-Ruby IV
(To:Fred_Kohlhepp)

@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!

Announcements
Top Tags