Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. algorithm for an optimization problem

algorithm for an optimization problem

Scheduled Pinned Locked Moved C / C++ / MFC
algorithmshelpquestiondesignperformance
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13447042
    wrote on last edited by
    #1

    The carpenter manufactures chairs and tables. He can sell them on the market, each table for Pt EUR and each chair for Pc EUR. He needs A hours and B wooden planks to produce one table and C hours and D planks for one chair. His weekly workload cannot be higher than H hours. His weekly supply for planks is S. The carpenter cannot store the planks. Help the carpenter to prepare his weekly schedule that maximizes his income. Design an algorithm that accepts A, B, C, D, H, S, Pt, Pc as an input and tells how many chairs and how many tables the carpenter should produce weekly, and what is the income assuming this production plan.

    I haven't even got a clue... Can anyone please help?

    OriginalGriffO CPalliniC J 3 Replies Last reply
    0
    • U User 13447042

      The carpenter manufactures chairs and tables. He can sell them on the market, each table for Pt EUR and each chair for Pc EUR. He needs A hours and B wooden planks to produce one table and C hours and D planks for one chair. His weekly workload cannot be higher than H hours. His weekly supply for planks is S. The carpenter cannot store the planks. Help the carpenter to prepare his weekly schedule that maximizes his income. Design an algorithm that accepts A, B, C, D, H, S, Pt, Pc as an input and tells how many chairs and how many tables the carpenter should produce weekly, and what is the income assuming this production plan.

      I haven't even got a clue... Can anyone please help?

      OriginalGriffO Online
      OriginalGriffO Online
      OriginalGriff
      wrote on last edited by
      #2

      We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. Try it yourself, you may find it is not as difficult as you think! If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      U 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. Try it yourself, you may find it is not as difficult as you think! If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

        U Offline
        U Offline
        User 13447042
        wrote on last edited by
        #3

        of course It's just that I'm a total beginner and I just figured this might be the place to look for help. Well obviously I know it'd be best to start from inputing all the variables and then decide whether the chairs or tables are more profitable. My problem is I don't know how to decide that since there are two variables for each. Any suggestions?

        OriginalGriffO B 2 Replies Last reply
        0
        • U User 13447042

          of course It's just that I'm a total beginner and I just figured this might be the place to look for help. Well obviously I know it'd be best to start from inputing all the variables and then decide whether the chairs or tables are more profitable. My problem is I don't know how to decide that since there are two variables for each. Any suggestions?

          OriginalGriffO Online
          OriginalGriffO Online
          OriginalGriff
          wrote on last edited by
          #4

          Start by looking at how to would do it manually: get a pen and paper, and start playing with numbers. Work out how you do it yourself, and an algorithm should become apparent. Working this out is part of the task - heck, it is the task, you aren't supposed to implement it yet, if ever. It's an exercise in logical thinking and analysis, intended to start you thinking in "appropriate" ways. If you don't do it yourself, the "thought patterns" that you will use later don't start to form, and things can be a load harder later.

          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          D 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Start by looking at how to would do it manually: get a pen and paper, and start playing with numbers. Work out how you do it yourself, and an algorithm should become apparent. Working this out is part of the task - heck, it is the task, you aren't supposed to implement it yet, if ever. It's an exercise in logical thinking and analysis, intended to start you thinking in "appropriate" ways. If you don't do it yourself, the "thought patterns" that you will use later don't start to form, and things can be a load harder later.

            Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            OriginalGriff wrote:

            Start by looking at how to would do it manually: get a pen and paper...

            I wholeheartedly agree.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

            1 Reply Last reply
            0
            • U User 13447042

              of course It's just that I'm a total beginner and I just figured this might be the place to look for help. Well obviously I know it'd be best to start from inputing all the variables and then decide whether the chairs or tables are more profitable. My problem is I don't know how to decide that since there are two variables for each. Any suggestions?

              B Offline
              B Offline
              Bram van Kampen
              wrote on last edited by
              #6

              Wel, I agree with all the others. Every Computer Program starts with understanding the problem you are trying to resolve. This is quite fundamental! If you do not understand the problem, you will be unlikely to write a program that will resolve the issue at hand. the best start is possibly to write the question down, and in your mind break it down into the fundamental decisions program has to make. ( I have spent weeks with problems like this spinning through my head, trying to find the right approach to the problems I faced at the time) Your question although wordy is quite basic. If you can resolve it, good and well, in that case Just consider yourself happy that you are (for now) not required to recover from "Fault" conditions. If you can not, well, maybe you are not programmer material, and, you should possibly make another career choice. Regards,

              Bram van Kampen

              1 Reply Last reply
              0
              • U User 13447042

                The carpenter manufactures chairs and tables. He can sell them on the market, each table for Pt EUR and each chair for Pc EUR. He needs A hours and B wooden planks to produce one table and C hours and D planks for one chair. His weekly workload cannot be higher than H hours. His weekly supply for planks is S. The carpenter cannot store the planks. Help the carpenter to prepare his weekly schedule that maximizes his income. Design an algorithm that accepts A, B, C, D, H, S, Pt, Pc as an input and tells how many chairs and how many tables the carpenter should produce weekly, and what is the income assuming this production plan.

                I haven't even got a clue... Can anyone please help?

                CPalliniC Offline
                CPalliniC Offline
                CPallini
                wrote on last edited by
                #7

                You could use, for instance, Lagrange Multipliers[^]. More generally you could have a look at Constrained optimization - Wikipedia[^].

                In testa che avete, signor di Ceprano?

                1 Reply Last reply
                0
                • U User 13447042

                  The carpenter manufactures chairs and tables. He can sell them on the market, each table for Pt EUR and each chair for Pc EUR. He needs A hours and B wooden planks to produce one table and C hours and D planks for one chair. His weekly workload cannot be higher than H hours. His weekly supply for planks is S. The carpenter cannot store the planks. Help the carpenter to prepare his weekly schedule that maximizes his income. Design an algorithm that accepts A, B, C, D, H, S, Pt, Pc as an input and tells how many chairs and how many tables the carpenter should produce weekly, and what is the income assuming this production plan.

                  I haven't even got a clue... Can anyone please help?

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #8

                  Member 13478986 wrote:

                  Can anyone please help?

                  Start with the chair only. So A, B and H. (Ignore S) Figure that out. Then add S. After that add C and D. It might help to only do C, D, H and S first. However after you did it for A and B this should be trivial.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups