joebloggs

40 Reputation

2 Badges

17 years, 139 days

MaplePrimes Activity


These are answers submitted by joebloggs

@ Robert Israel

You were right and your correction got the code to run. Thanks again for taking the time to help me. Unfortunately there was no feasible solution so I'll have to go back to the drawing board with my model.

@ acer

You are right and it left me as a beginner scratching my head because from reading the 'Help' section I was pretty certain that my constraints were in the correct form. It was very misleading and I spent many hours trying to figure out why that error was coming up. But because of the error message and my misinterpretation of Robert Israel's original post about setting the objective function to 0 (I made the incorrect assumption that setting c:=0 was interpreted by Maple as meaning there is no objective function) I was banging my head against a brick wall.

It's all part of the learning curve I suppose :-)

 

@ Robert Israel

Thank you for the Optimization suggestion but unfortunately I cannot seem to get it to work. If you can spare the time any input on my code (and obvious lack of understanding of how the LPSolve[Optimization] command works) would be greatly appreciated. Here it is:-

--------------------------------------------

with(ExcelTools):
ArrayA := Import("C:\\Documents and Settings\\Administrator\\Desktop\\Misc\\CAx5.xls", "Matrix A", "A1:AF32")
ArrayCA := Import("C:\\Documents and Settings\\Administrator\\Desktop\\Misc\\CAx5.xls", "Matrix CA", "A1:A32")
MatrixA := Matrix(32, 32, ArrayA)
MatrixCA := Matrix(32, 1, ArrayCA)

with(Optimization):
VectorCA := convert(ArrayCA, Vector)
c := 0
Aeq := MatrixA
beq := VectorCA
bl := 0.0001
bu := 1
LPSolve(c, [NoUserValue, NoUserValue, Aeq, beq], [bl, bu])
Error, (in Optimization:-LPSolve) constraints must be specified as a set or list of equalities and inequalities

--------------------------------------------

All of the imported data from Excel has been checked and is accurate.

As it stands the matrices used in Ax=B (in the code above equivalent to MatrixA.x=VectorCA) are based on the model I described previously with the elements of A and B taken from data. But this model is based on underlying assumptions for initial simplification so there might not exist a solution within the constraints 0<x<=1.

Basically I need to know if LPSolve[Optimization] is failing to work because of my misuse or because there is no solution (in which case I can revise my model). Will Maple explicitly tell me if no solution exists?

@gkokovidis

Thanks again for the swift response. I did remember that when the number of equations equals the number of unknowns there was a unique solution, but when I used LinearSolve I got some unexpected results so I wasn't sure if the hazyness of my memory was affecting my recollection. Time to dust off the old college notes stored in the attic and clear the cobwebs from my brain I think :-)

It's probably the assumptions in my admittedly simplistic model that's producing the unexpected results.

Thanks again for the help.  

@gkokovidis

That worked instantly. Thank you so much. If you can spare the time is there any chance you could enlighten me as to where I went wrong (was it a Maths or programming issue)? Also is there a way to restrict the possible values of the solution set x in the A.x=B system?

What I am trying to do is figure out how a sports management simulation game I play assigns players' attributes. I've found out from going on the game's forums that there is a value that acts as a control on how attributes are distributed for a given player, and that the attributes are distributed to equate to this control.

So I formulated a basic model for a player as a starting point

CA = (w1*A1) + (w2*A2) + (w3*A3) + ........... + (w32*A33) + (w33*A33)

where

CA = Current Ability (the control, known)
wn = weighting n applied to attribute An for n = (0,1,2,3,..........,32,33) (unknowns)
An = attribute n for n = (0,1,2,3,.........,32,33) (known)

and then took 33 players to create the set of equations.

The reason I ask about restricting the values of the solution set is because the w values in the above equation (which correspond to the x vector in A.x=B) are weightings between 0 and 1.

With this model I am making a number of simplifying assumptions initially, and I would like to be certain that the solutions I get from Maple are accurate so any discrepancies I get when I test the model can be blamed solely on the model itself rather than me making mistakes in using Maple to generate the solution set.

@Axel Vogt

Thank you for the suggestions and tips.

Page 1 of 1