Optimization - hill climbing - designing functions (travelling salesman problem with truck load)

Hey guys,

New to R, currently on a college project on optimization using hillclimbing and completely dead in the water...

Any willing to lend a hand will be much obliged...

problem in hand: minimum distance and or maximum profit for a combination of 5 cities...

got a matrix of possible combinations of routes, starting on a sixth city, got a function to get the distance between cities but am struggling to write the functions to have the truck stop at a given city when load gets to 0...

Much appreciated

I would really encourage you to review the following guide, FAQ: Tips for writing R-related questions.
For example, the guide emphasizes asking coding questions with formatted code-chunks and a reprex.

You may have noticed folks here requesting minimal reprexes, that's because asking questions this way saves answerers a lot of time.

Reproducible Examples:

  • help make your question clear and replicable
  • increases the probability folks will reach out and try to help,
  • reduces the number of back-and-forths required to understand the question,
  • and makes your question and suggested solutions more useful to folks in the future researching similar problems.

But also please bear in mind the forum homework policy.

It seems that you recently asked a question that originated from a class or workshop, and I wanted to make sure you were seeking help here in a way that maximizes the chances of getting good help (without violating our homework policies).

Our homework guide is here: FAQ: Homework Policy

How should one ask a homework question?

  1. Never copy-paste instructions from an assignment (even for online courses).
  2. Explicitly mention the course you are taking and use the #homework tag.
  3. Ask your question as a reproducible example (reprex), preferably prepared for posting using the reprex package.

What's the best way to ask a specific homework-related question?

We made a short guide for helping folks pose their R-coding questions here.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.