• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Equation solving in c++

Joined
Sep 15, 2004
Messages
1,583 (0.22/day)
Location
Poland,Slask
System Name HAL
Processor Core i5 2500K
Motherboard Asus P8P67 Pro Rev3.1
Cooling stock
Memory 2x4GB Kingston 1600Mhz Blu
Video Card(s) Asus 560Ti DirectCuII TOP
Storage Kingston 120 3K SSD,WD Black WD1502FAEX
Display(s) LG 1440x900
Case Chieftec Mesh Midi
Audio Device(s) onboard
Power Supply Corsair TX750V2
Software w8
Hello!

The business problem is calculating certain Task time's of workers. I have only their total time per day and the amount task's they did in that time those task are split into types (Its that 18 variable's I already mentioned). An example:
8x+4y+0z+...+5n=4300[seconds]
8x+0y+0z+....+0n=1000[seconds]

Yes some workers have only 1 task done and other don't but that's not a problem as I can zero-fill those spot's or easily ignore unsolvable equations.

I'm trying to solve 2000 equations (2000workers/day) with 15 variables (15 diffrent tasks) . I found an algorithm that solves an equation (Gauss elimination) so that part I have behind now I'm puzzled how to calculate all combination's of those equations. I need to match each equation with all solvable combination's of others. I want have a all the possible variable values as output then I can run some statistical program to find my sweet spot for the task time but that's another story.
Any nice c++ trick you could suggest ?
 

Fourstaff

Moderator
Staff member
Joined
Nov 29, 2009
Messages
10,020 (1.91/day)
Location
Home
System Name Orange! // ItchyHands
Processor 3570K // 10400F
Motherboard ASRock z77 Extreme4 // TUF Gaming B460M-Plus
Cooling Stock // Stock
Memory 2x4Gb 1600Mhz CL9 Corsair XMS3 // 2x8Gb 3200 Mhz XPG D41
Video Card(s) Sapphire Nitro+ RX 570 // Asus TUF RTX 2070
Storage Samsung 840 250Gb // SX8200 480GB
Display(s) LG 22EA53VQ // Philips 275M QHD
Case NZXT Phantom 410 Black/Orange // Tecware Forge M
Power Supply Corsair CXM500w // CM MWE 600w
If you have 15 unknowns, you will need at most 15 equations to solve the "system".

With that in mind, it means that you will have to readjust the order of your 2000 equations so that you run your Gaussian elimination for every combination of 15 equations, and its 2000C15 so you will need to test for 23773578694372656339690207516593086800 number of different combinations, but that will get all of your answers, with plenty of repeats.

You might possibly eliminate the 2000 equations by repeats (ie 1 of them is x times another), leaving you with a much more manageable number of equations to solve. Out of ideas for now, will come back if I have any more.

Edit:
If you have learned "basis" sets in linear algebra, then you might be able to use the concept, find all the basis sets in the 2000 equations, and then run the Gaussian elimination on each of the basis set to get your answers. Problem is that there are just about as many iterations you will need to do :eek:
 
Joined
Sep 1, 2010
Messages
7,023 (1.41/day)
To solve that you'd need 2d array. There are several methods. The best is Gauss–Seidel method
http://en.wikipedia.org/wiki/Gauss–Seidel_method
It uses iterations. That process is time consuming tho. You won't need to know any "nice c++ trick" it's pure maths. if you got the maths part the realization this method on pc won't be hard.
 
Top