Closed Thread
Results 1 to 2 of 2

Simple example but Excel Solver can't find feasible solution

  1. #1
    Registered User
    Join Date
    05-23-2023
    Location
    Seoul
    MS-Off Ver
    2016
    Posts
    4

    Question Simple example but Excel Solver can't find feasible solution

    I want to make a travel plan using Excel Solver to decide which city to visit in order and how long to stay.
    I'm going to leave from city A and come back to city A.

    Below table shows the airfare for moving from one city to another, and the cost of accommodation per day for staying in each city.
    aa.PNG

    Target(Blue cell): To minimize Total expense (N17)
    Cells to change(Green cells): Staying days in a city ($D$17:$F$19)

    For example, 9 in F17 cell means moving from A to C and staying in C for 9 days.
    'From count'(Column H) checks the number of departures from each city
    =COUNTIF(D18:G18,">0")

    'To count'(Row 22) checks number of times you arrive in each city
    =COUNTIF(D18:D21,">0")

    'necessary?'(Column K) checks if you have ever arrived in the city (because if you have arrived, you also have to leave)
    =HLOOKUP(C19,$D$17:$G$22,6,FALSE)

    Constraints include following
    -- We're not moving to the same city
    > D18 = 0
    > E19 = 0
    > F20 = 0
    > G21 = 0
    -- Number of staying should be an integer
    D18:G21 = integer
    -- travel starts from city A
    H18 = 1
    -- come back to city A
    D22 = 1
    -- We're not going to stop by a city more than once
    > H19:H21 <= 1
    > E22:G22 <= 1
    -- if you have arrived in a city, you also have to leave
    > H19:H21 >= K19:K21
    -- Total staying days (except to come back to A and stay) should be 10
    > D26 = sum(E18:G21) = 10
    -- Total visiting cities (except A) should be 2
    > D27 = sum(E22:G22) = 2
    -- Number of days to return to A and stay at A is randomly specified as 1
    > D19:D21 <= 1

    I think the number shown on the screen would be the best travel plan. If I enter this number and run solver, I find a solution, but if I clear all the numbers and run it, I don't find a solution.

    I'd like to use this logic in five city examples, but Excel can't find a feasible solution even in this toy example.

    What's the reason and how can I make it work?

    I have attached the related Excel file.

    *I heard that solver does not recognize countif function, so I tried to use iferror, for example, in cell H18
    =IFERROR(D18/D18, 0)+IFERROR(E18/E18, 0)+IFERROR(F18/F18, 0)+IFERROR(G18/G18, 0)
    instead of countif, but I also couldn't find a solution.

    sample_problem.xlsx
    Last edited by dms_gg; 05-24-2023 at 01:49 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,929

    Re: Simple example but Excel Solver can't find feasible solution

    Administrative Note:

    Unfortunately, this is a duplicate thread, and you are allowed only ONE thread per issue here.

    Please see Forum Rule #5 about thread duplication.

    I am closing this thread, but you may continue here in the original thread: https://www.excelforum.com/excel-pro...-solution.html
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Overriding Solver "Could not find feasible solution" in VBA?
    By orchemistral in forum Excel General
    Replies: 5
    Last Post: 06-24-2019, 03:59 PM
  2. Problem with Solver: "Can't find a feasible solution"
    By whoamiquestionmark in forum Excel General
    Replies: 7
    Last Post: 10-23-2017, 12:58 PM
  3. [SOLVED] Macro to loop solver, save results, and skip when there is no feasible solution
    By isotopes88 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-20-2017, 08:27 AM
  4. Replies: 11
    Last Post: 10-30-2013, 02:11 PM
  5. Replies: 2
    Last Post: 09-04-2013, 08:36 PM
  6. [SOLVED] Solver macro... bypass no feasible solution popup
    By Cicada in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2012, 05:28 PM
  7. [SOLVED] Why is excel solver saying that there is not a feasible solution?
    By jt13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2006, 01:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1